pub struct Link { /* private fields */ }Expand description
The delivery state of one peer: the unacknowledged messages, the current connection, and
the acknowledgements received. It outlives connections, so a reconnect sends every pending
message again. It is Send + Sync; the I/O lives in the connection code, which hands the
link a channel of outgoing frame texts on connect.
Implementations§
Source§impl Link
impl Link
Sourcepub fn offer(&self, env: Envelope) -> Offer
pub fn offer(&self, env: Envelope) -> Offer
Offers env for delivery: sends it if connected and not yet sent on this connection,
and reports whether the peer has acknowledged it. Offering the same message id again is
how the outbox retries; it is sent once per connection.
Sourcepub fn watch(&self, id: &str)
pub fn watch(&self, id: &str)
Asks to hear of the acknowledgement (or refusal) of message id through
Link::take_settled instead of a later Link::offer.
Sourcepub fn take_settled(&self) -> Vec<(String, Result<(), String>)>
pub fn take_settled(&self) -> Vec<(String, Result<(), String>)>
The watched messages acknowledged or failed since the last call.
Sourcepub fn is_pending(&self, id: &str) -> bool
pub fn is_pending(&self, id: &str) -> bool
Whether message id waits for an acknowledgement.
Sourcepub fn pending_len(&self) -> usize
pub fn pending_len(&self) -> usize
The number of messages waiting for an acknowledgement.
Sourcepub fn connected(&self, generation: u64, tx: UnboundedSender<String>)
pub fn connected(&self, generation: u64, tx: UnboundedSender<String>)
A connection with number generation is open (and accepted): its writer takes the
frame texts sent into tx. Every pending message is sent again, oldest first, and a
refusal is forgotten.
Sourcepub fn disconnected(&self, generation: u64)
pub fn disconnected(&self, generation: u64)
The connection generation closed (a later connection is left alone).
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether a connection is open.
Sourcepub fn send_frame(&self, f: &Frame) -> bool
pub fn send_frame(&self, f: &Frame) -> bool
Sends a frame on the current connection; false when there is none.
Sourcepub fn refused(&self, reason: &str) -> Vec<String>
pub fn refused(&self, reason: &str) -> Vec<String>
The credential was refused: watched pending messages fail, the others are dropped from the link (the outbox offers them again and learns of the refusal then). The refusal holds until the next accepted connection.
Sourcepub fn refusal(&self) -> Option<String>
pub fn refusal(&self) -> Option<String>
Whether the peer refused the credential (and no connection was accepted since).
Sourcepub fn learn_route(&self, iri: &str)
pub fn learn_route(&self, iri: &str)
Learns that actor iri is reachable through this link (the origin of a message it
sent).