[][src]Trait grin_chain::linked_list::ListIndex

pub trait ListIndex {
    type List: Readable + Writeable;
    type Entry: ListIndexEntry;
    pub fn list_key(&self, commit: Commitment) -> Vec<u8>;
pub fn entry_key(&self, commit: Commitment, pos: u64) -> Vec<u8>;
pub fn peek_pos(
        &self,
        batch: &Batch<'_>,
        commit: Commitment
    ) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>;
pub fn push_pos(
        &self,
        batch: &Batch<'_>,
        commit: Commitment,
        new_pos: <Self::Entry as ListIndexEntry>::Pos
    ) -> Result<(), Error>;
pub fn pop_pos(
        &self,
        batch: &Batch<'_>,
        commit: Commitment
    ) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>; pub fn get_list(
        &self,
        batch: &Batch<'_>,
        commit: Commitment
    ) -> Result<Option<Self::List>, Error> { ... }
pub fn get_entry(
        &self,
        batch: &Batch<'_>,
        commit: Commitment,
        pos: u64
    ) -> Result<Option<Self::Entry>, Error> { ... } }

Index supporting a list of (duplicate) entries per commitment. Each entry will be at a unique MMR pos.

Associated Types

type List: Readable + Writeable[src]

List type

type Entry: ListIndexEntry[src]

List entry type

Loading content...

Required methods

pub fn list_key(&self, commit: Commitment) -> Vec<u8>[src]

Construct a key for the list.

pub fn entry_key(&self, commit: Commitment, pos: u64) -> Vec<u8>[src]

Construct a key for an individual entry in the list.

pub fn peek_pos(
    &self,
    batch: &Batch<'_>,
    commit: Commitment
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
[src]

Peek the head of the list for the specified commitment.

pub fn push_pos(
    &self,
    batch: &Batch<'_>,
    commit: Commitment,
    new_pos: <Self::Entry as ListIndexEntry>::Pos
) -> Result<(), Error>
[src]

Push a pos onto the list for the specified commitment.

pub fn pop_pos(
    &self,
    batch: &Batch<'_>,
    commit: Commitment
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
[src]

Pop a pos off the list for the specified commitment.

Loading content...

Provided methods

pub fn get_list(
    &self,
    batch: &Batch<'_>,
    commit: Commitment
) -> Result<Option<Self::List>, Error>
[src]

Returns either a "Single" with embedded "pos" or a "list" with "head" and "tail". Key is "prefix|commit". Note the key for an individual entry in the list is "prefix|commit|pos".

pub fn get_entry(
    &self,
    batch: &Batch<'_>,
    commit: Commitment,
    pos: u64
) -> Result<Option<Self::Entry>, Error>
[src]

Returns one of "head", "tail" or "middle" entry variants. Key is "prefix|commit|pos".

Loading content...

Implementors

impl<T> ListIndex for MultiIndex<T> where
    T: PosEntry
[src]

type List = ListWrapper<T>

type Entry = ListEntry<T>

pub fn pop_pos(
    &self,
    batch: &Batch<'_>,
    commit: Commitment
) -> Result<Option<T>, Error>
[src]

Pop the head of the list. Returns the output_pos. Returns None if list was empty.

Loading content...