pub trait ListIndex {
type List: Readable + Writeable;
type Entry: ListIndexEntry;
// Required methods
fn list_key(&self, commit: Commitment) -> Vec<u8> ⓘ;
fn entry_key(&self, commit: Commitment, pos: u64) -> Vec<u8> ⓘ;
fn peek_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>;
fn push_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
new_pos: <Self::Entry as ListIndexEntry>::Pos,
) -> Result<(), Error>;
fn pop_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>;
// Provided methods
fn get_list(
&self,
batch: &Batch<'_>,
commit: Commitment,
) -> Result<Option<Self::List>, Error> { ... }
fn get_entry(
&self,
batch: &Batch<'_>,
commit: Commitment,
pos: u64,
) -> Result<Option<Self::Entry>, Error> { ... }
}Expand description
Index supporting a list of (duplicate) entries per commitment. Each entry will be at a unique MMR pos.
Required Associated Types§
Required Methods§
Sourcefn entry_key(&self, commit: Commitment, pos: u64) -> Vec<u8> ⓘ
fn entry_key(&self, commit: Commitment, pos: u64) -> Vec<u8> ⓘ
Construct a key for an individual entry in the list.
Sourcefn peek_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
fn peek_pos( &self, batch: &Batch<'_>, commit: Commitment, ) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
Peek the head of the list for the specified commitment.
Sourcefn push_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
new_pos: <Self::Entry as ListIndexEntry>::Pos,
) -> Result<(), Error>
fn push_pos( &self, batch: &Batch<'_>, commit: Commitment, new_pos: <Self::Entry as ListIndexEntry>::Pos, ) -> Result<(), Error>
Push a pos onto the list for the specified commitment.
Sourcefn pop_pos(
&self,
batch: &Batch<'_>,
commit: Commitment,
) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
fn pop_pos( &self, batch: &Batch<'_>, commit: Commitment, ) -> Result<Option<<Self::Entry as ListIndexEntry>::Pos>, Error>
Pop a pos off the list for the specified commitment.