Trait sp_runtime::offchain::storage_lock::Lockable[][src]

pub trait Lockable: Sized {
    type Deadline: Sized + Codec + Clone;
    fn deadline(&self) -> Self::Deadline;
fn has_expired(deadline: &Self::Deadline) -> bool; fn snooze(_deadline: &Self::Deadline) { ... } }

Lockable item for use with a persisted storage lock.

Bound for an item that has a stateful ordered meaning without explicitly requiring Ord trait in general.

Associated Types

type Deadline: Sized + Codec + Clone[src]

An instant type specifying i.e. a point in time.

Loading content...

Required methods

fn deadline(&self) -> Self::Deadline[src]

Calculate the deadline based on a current state such as time or block number and derives the deadline.

fn has_expired(deadline: &Self::Deadline) -> bool[src]

Verify the deadline has not expired compared to the current state, i.e. time or block number.

Loading content...

Provided methods

fn snooze(_deadline: &Self::Deadline)[src]

Snooze at least until deadline is reached.

Note that deadline is only passed to allow optimizations for Lockables which have a time based component.

Loading content...

Implementors

impl Lockable for Time[src]

type Deadline = Timestamp

impl<B: BlockNumberProvider> Lockable for BlockAndTime<B>[src]

type Deadline = BlockAndTimeDeadline<B>

Loading content...