pub struct SvsNode { /* private fields */ }Expand description
State Vector Sync (SVS).
Each node maintains a state vector — a map from node-name key to the highest sequence number the local node has seen for that peer. When a peer’s sequence number in a received sync Interest is higher than the local entry, the gap is recorded as “missing data” that should be fetched.
Node names are stored as canonical string keys so the vector can be compared
across the network without re-encoding Name objects on every merge.
Implementations§
Source§impl SvsNode
impl SvsNode
pub fn new(local_name: &Name) -> Self
pub fn local_key(&self) -> &str
Sourcepub async fn advance(&self) -> u64
pub async fn advance(&self) -> u64
Increment the local sequence number by 1 and return the new value.
Sourcepub async fn merge(&self, received: &[(String, u64)]) -> Vec<(String, u64, u64)>
pub async fn merge(&self, received: &[(String, u64)]) -> Vec<(String, u64, u64)>
Merge a received state vector into the local one.
For each entry, if the received sequence number is higher than the
locally known value the local entry is updated. Returns a list of
(node_key, gap_from, gap_to) tuples describing missing data that
should be fetched.
Sourcepub async fn snapshot(&self) -> Vec<StateVectorEntry>
pub async fn snapshot(&self) -> Vec<StateVectorEntry>
Return a snapshot of the current state vector.