Expand description
Sync protocol types for state synchronization between nodes.
This module provides types for the various sync protocols:
- Handshake: Initial negotiation between peers (
handshake) - Protocol Selection: Choosing the optimal sync strategy (
protocol) - Delta Sync: DAG-based delta synchronization (
delta) - HashComparison: Merkle tree traversal sync (
hash_comparison) - BloomFilter: Bloom filter-based sync for large trees (
bloom_filter) - Snapshot: Full state transfer for fresh nodes (
snapshot) - SubtreePrefetch: Subtree prefetch for deep trees with clustered changes (
subtree) - LevelWise: Level-by-level sync for wide shallow trees (
levelwise)
§Module Organization
Each sync protocol has its own module with types and tests:
sync/
├── handshake.rs # SyncHandshake, SyncCapabilities, etc.
├── protocol.rs # SyncProtocol, SyncProtocolKind, select_protocol()
├── delta.rs # DeltaSyncRequest, DeltaPayload, etc.
├── hash_comparison.rs # TreeNode, TreeNodeRequest, compare_tree_nodes()
├── bloom_filter.rs # DeltaIdBloomFilter, BloomFilterRequest, etc.
├── snapshot.rs # SnapshotPage, BroadcastMessage, StreamMessage, etc.
├── subtree.rs # SubtreePrefetchRequest, SubtreeData, etc.
└── levelwise.rs # LevelWiseRequest, LevelWiseResponse, etc.Re-exports§
pub use handshake::SyncCapabilities;pub use handshake::SyncHandshake;pub use handshake::SyncHandshakeResponse;pub use handshake::SYNC_PROTOCOL_VERSION;pub use protocol::calculate_divergence;pub use protocol::is_protocol_supported;pub use protocol::select_protocol;pub use protocol::select_protocol_with_fallback;pub use protocol::ProtocolSelection;pub use protocol::SyncProtocol;pub use protocol::SyncProtocolKind;pub use delta::DeltaApplyResult;pub use delta::DeltaPayload;pub use delta::DeltaSyncRequest;pub use delta::DeltaSyncResponse;pub use delta::DEFAULT_DELTA_SYNC_THRESHOLD;pub use hash_comparison::compare_tree_nodes;pub use hash_comparison::LeafMetadata;pub use hash_comparison::TreeCompareResult;pub use hash_comparison::TreeLeafData;pub use hash_comparison::TreeNode;pub use hash_comparison::TreeNodeRequest;pub use hash_comparison::TreeNodeResponse;pub use hash_comparison::MAX_CHILDREN_PER_NODE;pub use hash_comparison::MAX_LEAF_VALUE_SIZE;pub use hash_comparison::MAX_NODES_PER_RESPONSE;pub use hash_comparison::MAX_TREE_DEPTH;pub use bloom_filter::BloomFilterRequest;pub use bloom_filter::BloomFilterResponse;pub use bloom_filter::DeltaIdBloomFilter;pub use bloom_filter::DEFAULT_BLOOM_FP_RATE;pub use wire::InitPayload;pub use wire::MessagePayload;pub use wire::StreamMessage;pub use wire::MAX_TREE_REQUEST_DEPTH;pub use snapshot::check_snapshot_safety;pub use snapshot::BroadcastMessage;pub use snapshot::SnapshotBoundaryRequest;pub use snapshot::SnapshotBoundaryResponse;pub use snapshot::SnapshotComplete;pub use snapshot::SnapshotCursor;pub use snapshot::SnapshotEntity;pub use snapshot::SnapshotEntityPage;pub use snapshot::SnapshotError;pub use snapshot::SnapshotPage;pub use snapshot::SnapshotRequest;pub use snapshot::SnapshotStreamRequest;pub use snapshot::SnapshotVerifyResult;pub use snapshot::DEFAULT_SNAPSHOT_PAGE_SIZE;pub use snapshot::MAX_COMPRESSED_PAYLOAD_SIZE;pub use snapshot::MAX_DAG_HEADS;pub use snapshot::MAX_ENTITIES_PER_PAGE;pub use snapshot::MAX_ENTITY_DATA_SIZE;pub use snapshot::MAX_SNAPSHOT_PAGES;pub use snapshot::MAX_SNAPSHOT_PAGE_SIZE;pub use subtree::should_use_subtree_prefetch;pub use subtree::SubtreeData;pub use subtree::SubtreePrefetchRequest;pub use subtree::SubtreePrefetchResponse;pub use subtree::DEEP_TREE_THRESHOLD;pub use subtree::DEFAULT_SUBTREE_MAX_DEPTH;pub use subtree::MAX_CLUSTERED_SUBTREES;pub use subtree::MAX_DIVERGENCE_RATIO;pub use subtree::MAX_ENTITIES_PER_SUBTREE;pub use subtree::MAX_SUBTREES_PER_REQUEST;pub use subtree::MAX_SUBTREE_DEPTH;pub use subtree::MAX_TOTAL_ENTITIES;pub use levelwise::compare_level_nodes;pub use levelwise::should_use_levelwise;pub use levelwise::LevelCompareResult;pub use levelwise::LevelNode;pub use levelwise::LevelWiseRequest;pub use levelwise::LevelWiseResponse;pub use levelwise::MAX_LEVELWISE_DEPTH;pub use levelwise::MAX_NODES_PER_LEVEL;pub use levelwise::MAX_PARENTS_PER_REQUEST;pub use levelwise::MAX_REQUESTS_PER_SESSION;pub use state_machine::build_handshake;pub use state_machine::build_handshake_from_raw;pub use state_machine::estimate_entity_count;pub use state_machine::estimate_max_depth;pub use state_machine::LocalSyncState;pub use transport::EncryptionState;pub use transport::SyncTransport;pub use protocol_trait::SyncProtocolExecutor;pub use storage_bridge::create_runtime_env;
Modules§
- bloom_
filter - BloomFilter sync types (CIP Appendix B - Protocol Selection Matrix).
- delta
- Delta sync types (CIP §4 - State Machine, DELTA SYNC branch).
- handshake
- Sync handshake protocol types (CIP §2 - Sync Handshake Protocol).
- hash_
comparison - HashComparison sync types (CIP §4 - State Machine, STATE-BASED branch).
- levelwise
- LevelWise sync types (CIP Appendix B - Protocol Selection Matrix).
- protocol
- Sync protocol types and selection logic (CIP §2.3 - Protocol Selection Rules).
- protocol_
trait - Common trait for sync protocol implementations.
- snapshot
- Snapshot sync types (CIP §6 - Snapshot Sync Constraints).
- state_
machine - Shared sync state abstractions for protocol negotiation.
- storage_
bridge - Storage bridge utilities for sync protocols.
- subtree
- SubtreePrefetch sync types (CIP Appendix B - Protocol Selection Matrix).
- transport
- Transport abstraction for sync protocols.
- wire
- Wire protocol types for sync stream communication.
Enums§
- Crdt
Type - CRDT type indicator for merge semantics.