pub struct LiveSession { /* private fields */ }Expand description
A session that stays open after the initial exchange.
Dropping it closes the session; close is the same thing said out loud.
Implementations§
Source§impl LiveSession
impl LiveSession
Sourcepub async fn push(&self, updates: Vec<PathUpdate>) -> Result<()>
pub async fn push(&self, updates: Vec<PathUpdate>) -> Result<()>
Send updates to the peer.
Fails rather than waiting once the session has closed, so a caller looping over peers does not stall on one that went away.
Sourcepub fn updates(&self) -> Receiver<Vec<PathUpdate>>
pub fn updates(&self) -> Receiver<Vec<PathUpdate>>
Updates that arrived from the peer, after they were applied.
A batch is published once every hash it was waiting on has been answered — with the
bytes, or with Missing — so a subscriber forwarding it forwards what this host can
answer for.
Sourcepub fn peer_vv(&self) -> VersionVector
pub fn peer_vv(&self) -> VersionVector
Everything the peer is known to have.
Consulted before forwarding: an entry the peer already covers must not be sent again, or three connected hosts will pass one edit round in a circle. It advances as the peer’s batches arrive, because each one carries what the peer had when it sent it.
It also advances when the peer acknowledges a push (see the module docs), so it covers this side’s own entries once they have reached the peer.
Sourcepub fn acknowledged(&self) -> Receiver<VersionVector>
pub fn acknowledged(&self) -> Receiver<VersionVector>
peer_vv as it changes: marked changed whenever an arriving batch or
an acknowledgement advances it. Closed once the session is.
Starts at what the initial exchange left: what the peer said it had, plus everything this side sent it then — the exchange completes only once the peer has all of that.
Sourcepub fn peer_acknowledges(&self) -> bool
pub fn peer_acknowledges(&self) -> bool
Whether the peer acknowledges pushes. false for a peer from before
acknowledgements: what this side pushes to it never shows in
peer_vv until a later exchange.