pub struct DistributedCheckpointer { /* private fields */ }Expand description
Checkpoints stream state across nodes with Merkle verification.
Each node submits its local checkpoint; once all expected nodes contribute, a global checkpoint is formed and its combined Merkle root is verified.
Implementations§
Source§impl DistributedCheckpointer
impl DistributedCheckpointer
Sourcepub fn new(expected_nodes: HashSet<String>) -> Self
pub fn new(expected_nodes: HashSet<String>) -> Self
Creates a new checkpointer expecting contributions from the given nodes.
Sourcepub fn submit_node_checkpoint(
&self,
checkpoint: NodeCheckpoint,
) -> StateResult<Option<GlobalDistributedCheckpoint>>
pub fn submit_node_checkpoint( &self, checkpoint: NodeCheckpoint, ) -> StateResult<Option<GlobalDistributedCheckpoint>>
Submits a node checkpoint.
Returns Some(GlobalDistributedCheckpoint) when all expected nodes
have contributed for this checkpoint_id.
Sourcepub fn latest_checkpoint(&self) -> Option<GlobalDistributedCheckpoint>
pub fn latest_checkpoint(&self) -> Option<GlobalDistributedCheckpoint>
Returns the latest completed global checkpoint, if any.
Sourcepub fn all_checkpoints(&self) -> Vec<GlobalDistributedCheckpoint>
pub fn all_checkpoints(&self) -> Vec<GlobalDistributedCheckpoint>
Returns all completed checkpoints.
Sourcepub fn stats(&self) -> CheckpointerStats
pub fn stats(&self) -> CheckpointerStats
Returns checkpointer statistics.
Sourcepub fn compute_merkle_root(data: &[u8]) -> String
pub fn compute_merkle_root(data: &[u8]) -> String
Computes a simple Merkle root as the hex-encoded SHA-256 of the data.
In a production system this would build a full Merkle tree; here we use a single-level hash for correctness without external crypto deps.
Auto Trait Implementations§
impl Freeze for DistributedCheckpointer
impl !RefUnwindSafe for DistributedCheckpointer
impl Send for DistributedCheckpointer
impl Sync for DistributedCheckpointer
impl Unpin for DistributedCheckpointer
impl UnsafeUnpin for DistributedCheckpointer
impl !UnwindSafe for DistributedCheckpointer
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.