pub enum SyncProtocol {
None,
DeltaSync {
missing_delta_ids: Vec<[u8; 32]>,
},
HashComparison {
root_hash: [u8; 32],
divergent_subtrees: Vec<[u8; 32]>,
},
Snapshot {
compressed: bool,
verified: bool,
},
BloomFilter {
filter_size: u64,
false_positive_rate: f64,
},
SubtreePrefetch {
subtree_roots: Vec<[u8; 32]>,
},
LevelWise {
max_depth: u32,
},
}Expand description
Sync protocol selection for negotiation.
Each variant represents a different synchronization strategy with different trade-offs in terms of bandwidth, latency, and computational overhead.
See CIP §1 - Sync Protocol Types.
Variants§
None
No sync needed - root hashes already match.
DeltaSync
Delta-based sync via DAG traversal.
Best for: Small gaps, real-time updates.
HashComparison
Hash-based Merkle tree comparison.
Best for: General-purpose catch-up, 10-50% divergence.
Fields
Snapshot
Full state snapshot transfer.
CRITICAL: Only valid for fresh nodes (Invariant I5). Initialized nodes MUST use state-based sync with CRDT merge instead.
Fields
BloomFilter
Bloom filter-based quick diff.
Best for: Large trees with small diff (<10% divergence).
Fields
SubtreePrefetch
Subtree prefetch for deep localized changes.
Best for: Deep hierarchies with localized changes.
LevelWise
Level-wise sync for wide shallow trees.
Best for: Trees with depth ≤ 2 and many children.
Implementations§
Source§impl SyncProtocol
impl SyncProtocol
Sourcepub fn kind(&self) -> SyncProtocolKind
pub fn kind(&self) -> SyncProtocolKind
Returns the protocol kind (discriminant) for this protocol.
Useful for capability matching where the protocol-specific data is irrelevant.
Trait Implementations§
Source§impl BorshDeserialize for SyncProtocol
impl BorshDeserialize for SyncProtocol
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for SyncProtocol
impl BorshSerialize for SyncProtocol
Source§impl Clone for SyncProtocol
impl Clone for SyncProtocol
Source§fn clone(&self) -> SyncProtocol
fn clone(&self) -> SyncProtocol
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyncProtocol
impl Debug for SyncProtocol
Source§impl Default for SyncProtocol
impl Default for SyncProtocol
Source§impl EnumExt for SyncProtocol
impl EnumExt for SyncProtocol
Source§impl From<&SyncProtocol> for SyncProtocolKind
impl From<&SyncProtocol> for SyncProtocolKind
Source§fn from(protocol: &SyncProtocol) -> Self
fn from(protocol: &SyncProtocol) -> Self
Source§impl PartialEq for SyncProtocol
impl PartialEq for SyncProtocol
impl StructuralPartialEq for SyncProtocol
Auto Trait Implementations§
impl Freeze for SyncProtocol
impl RefUnwindSafe for SyncProtocol
impl Send for SyncProtocol
impl Sync for SyncProtocol
impl Unpin for SyncProtocol
impl UnsafeUnpin for SyncProtocol
impl UnwindSafe for SyncProtocol
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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