Struct LeafSet

Source
pub struct LeafSet { /* private fields */ }
Expand description

Compact (roaring) bitmap representing the set of positions of leaves that are currently unpruned in the MMR.

Implementations§

Source§

impl LeafSet

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<LeafSet>

Open the remove log file. The content of the file will be read in memory for fast checking.

Source

pub fn copy_snapshot<P: AsRef<Path>>(path: P, cp_path: P) -> Result<()>

Copies a snapshot of the utxo file into the primary utxo file.

Source

pub fn removed_pre_cutoff( &self, cutoff_pos: u64, rewind_rm_pos: &Bitmap, prune_list: &PruneList, ) -> Bitmap

Calculate the set of pruned positions up to and including the cutoff_pos. Uses both the leaf_set and the prune_list to determine prunedness.

Source

pub fn rewind(&mut self, cutoff_pos: u64, rewind_rm_pos: &Bitmap)

Rewinds the leaf_set back to a previous state. Removes all pos after the cutoff. Adds back all pos in rewind_rm_pos.

Source

pub fn add(&mut self, pos0: u64)

Append a new position to the leaf_set.

Source

pub fn remove(&mut self, pos0: u64)

Remove the provided position from the leaf_set.

Source

pub fn flush(&mut self) -> Result<()>

Flush the leaf_set to file.

Source

pub fn discard(&mut self)

Discard any pending changes.

Source

pub fn includes(&self, pos0: u64) -> bool

Whether the leaf_set includes the provided position.

Source

pub fn len(&self) -> usize

Number of positions stored in the leaf_set.

Source

pub fn is_empty(&self) -> bool

Is the leaf_set empty.

Source

pub fn iter(&self) -> impl Iterator<Item = u64> + '_

Iterator over positionns in the leaf_set (all leaf positions).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SafeBorrow<T> for T
where T: ?Sized,

Source§

fn borrow_replacement(ptr: &T) -> &T

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V