Trait gear_common::storage::Mailbox
source · pub trait Mailbox {
type Key1;
type Key2;
type Value;
type BlockNumber;
type Error: MailboxError;
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 peek(key1: &Self::Key1, key2: &Self::Key2) -> Option<Self::Value>;
fn clear();
}
Expand description
Represents mailbox managing logic.
Required Associated Types§
sourcetype BlockNumber
type BlockNumber
Block number type.
Stored with Self::Value
.
sourcetype Error: MailboxError
type Error: MailboxError
Inner error type of mailbox storing algorithm.
sourcetype OutputError: From<Self::Error>
type OutputError: From<Self::Error>
Output error type of the mailbox.
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 mailbox 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 mailbox.
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 mailbox by given keys, if present, else returns error.
Object Safety§
This trait is not object safe.