Skip to main content

CheckpointLineageVerifier

Struct CheckpointLineageVerifier 

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

Streaming verifier for a checkpoint lineage read from newest to oldest.

The verifier starts from an exact trusted tip and accepts only the full checkpoint named by that head, followed by its exact parent, until the superstep-zero root is reached. It buffers one compact head rather than the checkpoint state history, so stores can validate arbitrarily long lineages through bounded reverse pages. Rejection leaves the verifier unchanged.

Implementations§

Source§

impl CheckpointLineageVerifier

Source

pub const fn from_tip(tip: CheckpointHead) -> Self

Constructs a reverse-lineage verifier from an exact checkpoint tip.

Source

pub const fn expected(&self) -> Option<&CheckpointHead>

Returns the exact checkpoint head required next, or None at the root.

Source

pub const fn is_complete(&self) -> bool

Returns whether the complete lineage through superstep zero was accepted.

Source

pub fn verify_next( &mut self, checkpoint: &Checkpoint, ) -> Result<(), CheckpointLineageError>

Verifies and accepts the next checkpoint in newest-to-oldest order.

§Errors

Returns CheckpointLineageError::HeadMismatch when checkpoint is not the exact full value named by the expected head, or CheckpointLineageError::AlreadyComplete after the root was accepted.

Trait Implementations§

Source§

impl Debug for CheckpointLineageVerifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.