Trait polkadot_sdk_frame::traits::schedule::v3::Anon
pub trait Anon<BlockNumber, Call, Origin> {
type Address: Codec + MaxEncodedLen + Clone + Eq + EncodeLike + Debug + TypeInfo;
type Hasher: Hash;
// Required methods
fn schedule(
when: DispatchTime<BlockNumber>,
maybe_periodic: Option<(BlockNumber, u32)>,
priority: u8,
origin: Origin,
call: Bounded<Call, Self::Hasher>,
) -> Result<Self::Address, DispatchError>;
fn cancel(address: Self::Address) -> Result<(), DispatchError>;
fn reschedule(
address: Self::Address,
when: DispatchTime<BlockNumber>,
) -> Result<Self::Address, DispatchError>;
fn next_dispatch_time(
address: Self::Address,
) -> Result<BlockNumber, DispatchError>;
}
Expand description
A type that can be used as a scheduler.
Required Associated Types§
Required Methods§
fn schedule(
when: DispatchTime<BlockNumber>,
maybe_periodic: Option<(BlockNumber, u32)>,
priority: u8,
origin: Origin,
call: Bounded<Call, Self::Hasher>,
) -> Result<Self::Address, DispatchError>
fn schedule( when: DispatchTime<BlockNumber>, maybe_periodic: Option<(BlockNumber, u32)>, priority: u8, origin: Origin, call: Bounded<Call, Self::Hasher>, ) -> Result<Self::Address, DispatchError>
Schedule a dispatch to happen at the beginning of some block in the future.
This is not named.
fn cancel(address: Self::Address) -> Result<(), DispatchError>
fn cancel(address: Self::Address) -> Result<(), DispatchError>
Cancel a scheduled task. If periodic, then it will cancel all further instances of that, also.
Will return an Unavailable
error if the address
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.
NOTE2: This will not work to cancel periodic tasks after their initial execution. For
that, you must name the task explicitly using the Named
trait.
fn reschedule(
address: Self::Address,
when: DispatchTime<BlockNumber>,
) -> Result<Self::Address, DispatchError>
fn reschedule( address: Self::Address, when: DispatchTime<BlockNumber>, ) -> Result<Self::Address, DispatchError>
Reschedule a task. For one-off tasks, this dispatch is guaranteed to succeed
only if it is executed before the currently scheduled block. For periodic tasks,
this dispatch is guaranteed to succeed only before the initial execution; for
others, use reschedule_named
.
Will return an Unavailable
error if the address
is invalid.
fn next_dispatch_time(
address: Self::Address,
) -> Result<BlockNumber, DispatchError>
fn next_dispatch_time( address: Self::Address, ) -> Result<BlockNumber, DispatchError>
Return the next dispatch time for a given task.
Will return an Unavailable
error if the address
is invalid.