Skip to main content

Module sync

Module sync 

Source
Expand description

Synchronization protocol for P2P state coordination

This module defines the protocol messages and types for peer-to-peer state synchronization using geometric deltas and vector clocks.

§Protocol Overview

The sync protocol operates in three phases:

  1. Discovery: Peers announce themselves and exchange clock information
  2. Sync: Peers exchange deltas to converge on consistent state
  3. Maintenance: Periodic heartbeats and partition recovery

§Example

use cliffy_protocols::sync::{SyncMessage, SyncState, PeerInfo};
use cliffy_protocols::VectorClock;
use uuid::Uuid;

// Create sync state for a node
let node_id = Uuid::new_v4();
let mut sync_state = SyncState::new(node_id);

// Register a peer
let peer_id = Uuid::new_v4();
sync_state.register_peer(peer_id, VectorClock::new());

Structs§

PeerCapabilities
Capabilities a peer may support.
PeerInfo
Information about a peer node.
PeerState
Tracked state for a connected peer.
SyncConfig
Configuration for sync behavior.
SyncMessage
A message in the sync protocol.
SyncState
The synchronization state for a node.

Enums§

PeerConnectionState
Connection state with a peer.
SyncPayload
The payload of a sync message.