Trait gear_common::storage::Waitlist

source ·
pub trait Waitlist {
    type Key1;
    type Key2;
    type Value;
    type BlockNumber;
    type Error: WaitlistError;
    type OutputError: From<Self::Error>;

    // Required methods
    fn contains(key1: &Self::Key1, key2: &Self::Key2) -> bool;
    fn insert(
        value: Self::Value,
        bn: Self::BlockNumber,
    ) -> Result<(), Self::OutputError>;
    fn remove(
        key1: Self::Key1,
        key2: Self::Key2,
    ) -> Result<(Self::Value, Interval<Self::BlockNumber>), Self::OutputError>;
    fn clear();
}
Expand description

Represents waitlist managing logic.

Required Associated Types§

source

type Key1

First key type.

source

type Key2

Second key type.

source

type Value

Stored values type.

source

type BlockNumber

Block number type.

Stored with Self::Value.

source

type Error: WaitlistError

Inner error type of waitlist storing algorithm.

source

type OutputError: From<Self::Error>

Output error type of the waitlist.

Required Methods§

source

fn contains(key1: &Self::Key1, key2: &Self::Key2) -> bool

Returns bool, defining does first key’s waitlist contain second key.

source

fn insert( value: Self::Value, bn: Self::BlockNumber, ) -> Result<(), Self::OutputError>

Inserts given value in waitlist.

source

fn remove( key1: Self::Key1, key2: Self::Key2, ) -> Result<(Self::Value, Interval<Self::BlockNumber>), Self::OutputError>

Removes and returns value from waitlist by given keys, if present, else returns error.

source

fn clear()

Removes all values from all key’s waitlisted.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen> Waitlist for WaitlistImpl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen>
where T: DoubleMapStorage<Value = (Value, Interval<BlockNumber>)>, Error: WaitlistError, OutputError: From<Error>, Callbacks: WaitlistCallbacks<Value = Value, BlockNumber = BlockNumber>, KeyGen: KeyFor<Key = (T::Key1, T::Key2), Value = Value>,

§

type Key1 = <T as DoubleMapStorage>::Key1

§

type Key2 = <T as DoubleMapStorage>::Key2

§

type Value = Value

§

type BlockNumber = BlockNumber

§

type Error = Error

§

type OutputError = OutputError