zamsync-core 1.3.0

Core types, traits, and protocol messages for the ZamSync sync engine
Documentation
1
2
3
4
5
6
7
8
use crate::{NodeId, SyncMessage, ZamResult};

pub trait Transport {
    /// Encodes and sends `message` to `peer_id`. Returns the number of bytes
    /// written to the wire so callers can track bandwidth consumption.
    fn send(&mut self, peer_id: NodeId, message: &SyncMessage) -> ZamResult<usize>;
    fn receive(&mut self) -> ZamResult<Option<(NodeId, SyncMessage)>>;
}