Skip to main content

VV

Struct VV 

Source
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

Source§

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

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

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 end(&self)

Signals and waits for the middleware to terminate.

Source§

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>

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>

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

Source§

fn tcbstable(&mut self, _: usize, _: usize)

ACKS a stable message, but is not necessary to call in the VV approach.

  • §Arguments

id - Stable dot id field

counter - Stable dot counter field

Auto Trait Implementations§

§

impl Freeze for VV

§

impl RefUnwindSafe for VV

§

impl Send for VV

§

impl Sync for VV

§

impl Unpin for VV

§

impl UnsafeUnpin for VV

§

impl UnwindSafe for VV

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.