[−][src]Struct tcb::vv::version_vector::VV
Client side of the version vector based middleware service. Maintains the API and necessary state to send and deliver messages.
Trait Implementations
impl TCB for VV
[src]
type SendCallReturn = Result<(), SendError<ClientPeerMiddleware>>
Type of the return from a send call, which is an empty value or an error.
fn new(
local_id: usize,
local_port: usize,
peer_addresses: Vec<String>,
configuration: Configuration
) -> Self
[src]
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.
fn send(&mut self, message: Vec<u8>) -> Self::SendCallReturn
[src]
Broadcasts a message to every peer in the group. Returns the sent message context if successfull.
Arguments
message
- Serialized message to be broadcast
fn end(&self)
[src]
Signals and waits for the middleware to terminate.
fn recv(&mut self) -> Result<GenericReturn, RecvError>
[src]
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.
fn try_recv(&mut self) -> Result<GenericReturn, TryRecvError>
[src]
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.
fn recv_timeout(
&mut self,
duration: Duration
) -> Result<GenericReturn, RecvTimeoutError>
[src]
&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
fn tcbstable(&mut self, _: usize, _: usize)
[src]
ACKS a stable message, but is not necessary to call in the VV approach.
id
- Stable dot id field
counter
- Stable dot counter field
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,