[−][src]Struct tcb::graph::graph::GRAPH
Client side of the graph based middleware service. Maintains the API and necessary state to send and deliver messages.
Trait Implementations
impl TCB for GRAPH
[src]
type SendCallReturn = Result<Vec<Dot>, SendError<ClientPeerMiddleware>>
Type of the return from a send call, which is the sent message context 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, msg: Vec<u8>) -> Self::SendCallReturn
[src]
Broadcasts a message to every peer in the group. Returns the sent message context if successfull.
Arguments
msg
- 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, id: usize, counter: usize)
[src]
ACKS a stable message. This is needed for the GRAPH approach so the node with the message's information can be deleted from the graph and its position in the array be available and reused for another message. Otherwise the array that maps the causal dependency graph will grow exponentially. However, if stability was disabled from the configuration file, then the message's are directly removed from the graph upon delivery, rendering the call to this method unnecessary.
The VV implementation doesn't require the call of this method.
Arguments
id
- Stable dot id field
counter
- Stable dot counter field
Auto Trait Implementations
impl RefUnwindSafe for GRAPH
impl Send for GRAPH
impl Sync for GRAPH
impl Unpin for GRAPH
impl UnwindSafe for GRAPH
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>,