Skip to main content

SyncTransport

Trait SyncTransport 

Source
pub trait SyncTransport {
    type Error: Debug + Display;

    // Required methods
    fn send_hash(&mut self, hash: &Hash) -> Result<(), Self::Error>;
    fn recv_hash(&mut self) -> Result<Hash, Self::Error>;
    fn send_event_hashes(
        &mut self,
        hashes: &[String],
    ) -> Result<(), Self::Error>;
    fn recv_event_hashes(&mut self) -> Result<Vec<String>, Self::Error>;
    fn send_events(&mut self, events: &[Event]) -> Result<(), Self::Error>;
    fn recv_events(&mut self) -> Result<Vec<Event>, Self::Error>;
}
Expand description

Abstraction over the wire protocol.

Implementations shuttle hashes and events between two replicas. The trait is intentionally simple; higher-level protocols (compression, batching, authentication) are layered on top.

Required Associated Types§

Source

type Error: Debug + Display

Error type for transport operations.

Required Methods§

Source

fn send_hash(&mut self, hash: &Hash) -> Result<(), Self::Error>

Send a root hash to the remote.

§Errors

Returns Self::Error if the send fails.

Source

fn recv_hash(&mut self) -> Result<Hash, Self::Error>

Receive a root hash from the remote.

§Errors

Returns Self::Error if the receive fails.

Source

fn send_event_hashes(&mut self, hashes: &[String]) -> Result<(), Self::Error>

Send a list of event hashes that we want the remote to check.

§Errors

Returns Self::Error if the send fails.

Source

fn recv_event_hashes(&mut self) -> Result<Vec<String>, Self::Error>

Receive a list of event hashes from the remote.

§Errors

Returns Self::Error if the receive fails.

Source

fn send_events(&mut self, events: &[Event]) -> Result<(), Self::Error>

Send events to the remote.

§Errors

Returns Self::Error if the send fails.

Source

fn recv_events(&mut self) -> Result<Vec<Event>, Self::Error>

Receive events from the remote.

§Errors

Returns Self::Error if the receive fails.

Implementors§