Trait framenode_runtime::ScheduleNamed
pub trait ScheduleNamed<BlockNumber, Call, RuntimeOrigin> {
type Address: Codec + Clone + Eq + EncodeLike<Self::Address> + Debug + MaxEncodedLen;
// Required methods
fn schedule_named(
id: Vec<u8, Global>,
when: DispatchTime<BlockNumber>,
maybe_periodic: Option<(BlockNumber, u32)>,
priority: u8,
origin: RuntimeOrigin,
call: Call
) -> Result<Self::Address, ()>;
fn cancel_named(id: Vec<u8, Global>) -> Result<(), ()>;
fn reschedule_named(
id: Vec<u8, Global>,
when: DispatchTime<BlockNumber>
) -> Result<Self::Address, DispatchError>;
fn next_dispatch_time(id: Vec<u8, Global>) -> Result<BlockNumber, ()>;
}
Expand description
A type that can be used as a scheduler.
Required Associated Types§
Required Methods§
fn schedule_named(
id: Vec<u8, Global>,
when: DispatchTime<BlockNumber>,
maybe_periodic: Option<(BlockNumber, u32)>,
priority: u8,
origin: RuntimeOrigin,
call: Call
) -> Result<Self::Address, ()>
fn schedule_named( id: Vec<u8, Global>, when: DispatchTime<BlockNumber>, maybe_periodic: Option<(BlockNumber, u32)>, priority: u8, origin: RuntimeOrigin, call: Call ) -> Result<Self::Address, ()>
Schedule a dispatch to happen at the beginning of some block in the future.
id
: The identity of the task. This must be unique and will return an error if not.
fn cancel_named(id: Vec<u8, Global>) -> Result<(), ()>
fn cancel_named(id: Vec<u8, Global>) -> Result<(), ()>
Cancel a scheduled, named task. If periodic, then it will cancel all further instances of that, also.
Will return an error if the id
is invalid.
NOTE: This guaranteed to work only before the point that it is due to be executed. If it ends up being delayed beyond the point of execution, then it cannot be cancelled.