referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::traits::schedule::v3::Named

pub trait Named<BlockNumber, Call, Origin> {
    type Address: Codec + MaxEncodedLen + Clone + Eq + EncodeLike + Debug;
    type Hasher: Hash;

    // Required methods
    fn schedule_named(
        id: [u8; 32],
        when: DispatchTime<BlockNumber>,
        maybe_periodic: Option<(BlockNumber, u32)>,
        priority: u8,
        origin: Origin,
        call: Bounded<Call, Self::Hasher>,
    ) -> Result<Self::Address, DispatchError>;
    fn cancel_named(id: [u8; 32]) -> Result<(), DispatchError>;
    fn reschedule_named(
        id: [u8; 32],
        when: DispatchTime<BlockNumber>,
    ) -> Result<Self::Address, DispatchError>;
    fn next_dispatch_time(id: [u8; 32]) -> Result<BlockNumber, DispatchError>;
}
Expand description

A type that can be used as a scheduler.

Required Associated Types§

type Address: Codec + MaxEncodedLen + Clone + Eq + EncodeLike + Debug

An address which can be used for removing a scheduled task.

type Hasher: Hash

The hasher used in the runtime.

Required Methods§

fn schedule_named( id: [u8; 32], 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.

  • id: The identity of the task. This must be unique and will return an error if not.

NOTE: This will request call to be made available.

fn cancel_named(id: [u8; 32]) -> Result<(), DispatchError>

Cancel a scheduled, named task. If periodic, then it will cancel all further instances of that, also.

Will return an Unavailable 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.

fn reschedule_named( id: [u8; 32], 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.

Will return an Unavailable error if the id is invalid.

fn next_dispatch_time(id: [u8; 32]) -> Result<BlockNumber, DispatchError>

Return the next dispatch time for a given task.

Will return an Unavailable error if the id is invalid.

Object Safety§

This trait is not object safe.

Implementors§