pub struct CommitHistory { /* private fields */ }Expand description
In-memory accumulator over a verified first-parent chain.
Implementations§
Source§impl CommitHistory
impl CommitHistory
pub fn open() -> Self
Sourcepub fn append(&mut self, commit_hash: &Hash) -> Result<Position, HistoryError>
pub fn append(&mut self, commit_hash: &Hash) -> Result<Position, HistoryError>
Append one hash and return its leaf position.
Sourcepub fn extend<'a>(
&mut self,
commit_hashes: impl IntoIterator<Item = &'a Hash>,
) -> Result<(), HistoryError>
pub fn extend<'a>( &mut self, commit_hashes: impl IntoIterator<Item = &'a Hash>, ) -> Result<(), HistoryError>
Append many hashes in one batch: a single new_batch/merkleize/
apply_batch cycle instead of one per hash. Leaf positions and the
resulting root are identical to calling Self::append once per
hash in the same order — the underlying MMB batch API is explicitly
designed to merkleize many leaves at once, so batching only changes
how many allocations it performs, not the tree it builds. Used by
AncestrySnapshot::build
to build a chain’s MMB without one allocation-heavy batch cycle per
commit.
Sourcepub fn root(&self) -> Hash
pub fn root(&self) -> Hash
Return the root over every current leaf.
§Panics
Panics only if commonware rejects zero inactive peaks, which its contract permits.
pub fn len(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn prove(&self, position: Position) -> Result<InclusionProof, HistoryError>
Trait Implementations§
Source§impl Debug for CommitHistory
impl Debug for CommitHistory
Auto Trait Implementations§
impl Freeze for CommitHistory
impl RefUnwindSafe for CommitHistory
impl Send for CommitHistory
impl Sync for CommitHistory
impl Unpin for CommitHistory
impl UnsafeUnpin for CommitHistory
impl UnwindSafe for CommitHistory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more