pub struct VV { /* private fields */ }Expand description
Client side of the version vector based middleware service. Maintains the API and necessary state to send and deliver messages.
Trait Implementations§
Source§impl TCB for VV
impl TCB for VV
Source§type SendCallReturn = Result<(), SendError<ClientPeerMiddleware>>
type SendCallReturn = Result<(), SendError<ClientPeerMiddleware>>
Type of the return from a send call, which is an empty value or an error.
Source§fn new(
local_id: usize,
local_port: usize,
peer_addresses: Vec<String>,
configuration: Configuration,
) -> Self
fn new( local_id: usize, local_port: usize, peer_addresses: Vec<String>, configuration: Configuration, ) -> Self
Creates a new middleware instance. This function only returns after the middleware has a connection to every other peer in both directions.
§Arguments
local_id - Peer’s globally unique id in the group.
local_port - Port where the middleware will be listening for connections.
peer_addresses - Addresses the middleware will connect to.
configuration - Middleware’s configuration file.
Source§fn send(&mut self, message: Vec<u8>) -> Self::SendCallReturn
fn send(&mut self, message: Vec<u8>) -> Self::SendCallReturn
Broadcasts a message to every peer in the group. Returns the sent message context if successfull.
§Arguments
message - Serialized message to be broadcast
Source§fn recv(&mut self) -> Result<GenericReturn, RecvError>
fn recv(&mut self) -> Result<GenericReturn, RecvError>
Delivers a message from the middleware. Blocks the calling thread until a message is delivered or the channel to the middleware is empty or disconnected.
Source§fn try_recv(&mut self) -> Result<GenericReturn, TryRecvError>
fn try_recv(&mut self) -> Result<GenericReturn, TryRecvError>
Attempts to deliver a message from the middleware without blocking the caller thread. Either a message is immeadiately delivered from the channel or an error is returned if the channel is empty.
Source§fn recv_timeout(
&mut self,
duration: Duration,
) -> Result<GenericReturn, RecvTimeoutError>
fn recv_timeout( &mut self, duration: Duration, ) -> Result<GenericReturn, RecvTimeoutError>
Waits for a message to be delivered from the middleware for a limited time. If the channel is empty and not disconnected, the caller thread is blocked until a message is received in the channel or the timeout ends. If there are no messages until the timeout ends or the channel becomes disconnected, an error is returned.
§Arguments
duration - Timeout duration