Skip to main content

TransportAdapter

Trait TransportAdapter 

Source
pub trait TransportAdapter<D> {
    // Required methods
    fn subscribe(&mut self, peer: u64);
    fn is_subscribed(&self, peer: u64) -> bool;
    fn set_connected(&mut self, a: u64, b: u64, connected: bool);
    fn is_connected(&self, a: u64, b: u64) -> bool;
    fn send(
        &mut self,
        from: u64,
        to: u64,
        records: Vec<Record<D>>,
    ) -> Result<(), TransportError>;
    fn drain(&mut self, peer: u64) -> Vec<TransportEnvelope<D>>;
}
Expand description

Engineered transport coverage contract.

A transport adapter is responsible for peer subscription, connectivity checks, and moving record batches. It is tested infrastructure, not a proof that any real network delivers packets.

Required Methods§

Source

fn subscribe(&mut self, peer: u64)

Source

fn is_subscribed(&self, peer: u64) -> bool

Source

fn set_connected(&mut self, a: u64, b: u64, connected: bool)

Source

fn is_connected(&self, a: u64, b: u64) -> bool

Source

fn send( &mut self, from: u64, to: u64, records: Vec<Record<D>>, ) -> Result<(), TransportError>

Source

fn drain(&mut self, peer: u64) -> Vec<TransportEnvelope<D>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§