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§
sourcetype BlockNumber
type BlockNumber
Block number type.
Stored with Self::Value
.
sourcetype Error: WaitlistError
type Error: WaitlistError
Inner error type of waitlist storing algorithm.
sourcetype OutputError: From<Self::Error>
type OutputError: From<Self::Error>
Output error type of the waitlist.
Required Methods§
sourcefn contains(key1: &Self::Key1, key2: &Self::Key2) -> bool
fn contains(key1: &Self::Key1, key2: &Self::Key2) -> bool
Returns bool, defining does first key’s waitlist contain second key.
sourcefn insert(
value: Self::Value,
bn: Self::BlockNumber,
) -> Result<(), Self::OutputError>
fn insert( value: Self::Value, bn: Self::BlockNumber, ) -> Result<(), Self::OutputError>
Inserts given value in waitlist.
sourcefn remove(
key1: Self::Key1,
key2: Self::Key2,
) -> Result<(Self::Value, Interval<Self::BlockNumber>), Self::OutputError>
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.
Object Safety§
This trait is not object safe.