Skip to main content

Module round

Module round 

Source
Expand description

One round of sync with one peer, for one collection (SPEC_USER_DATA_SYNC_LAYER §4.2, the loop’s body): the asking side of the sync.* ops. A round learns the membership changes each side lacks (sync.members), takes the keys of any epoch this machine lacks (sync.keys), pulls the records it lacks, and pushes the ones the peer lacks. It is pure over a PeerCalls (the calls to the peer) and a Session (this machine’s own state): a transport hands it both and it never opens a connection, so it is tested against in-memory machines. A Session lends the round this machine’s Ctx only for the length of one closure, so a transport that keeps the store locked while a closure runs never keeps it locked across a call to the peer (which is itself asking this machine for the same store). Which peers, when, and what wakes the loop belong to the transport.

A round never gives up the others’ records because one is refused: each record is checked and applied on its own, the refusals are counted by kind, and a refusal that is the peer’s news (an epoch this machine has not reached, a sequence skipped) ends the pull so the next round takes it again from the membership step.

Structs§

Round
What a round did.

Enums§

CallError
Why a call to the peer did not give an answer.
Ended
How a round ended.

Constants§

MAX_BATCHES
The most batches one round pulls or pushes: a peer with more waits for the next round.
MAX_MEMBER_ASKS
The most times one round asks for membership entries (a longer chain than one answer carries).

Traits§

PeerCalls
The calls to one peer. Each is one remote op; the transport signs and carries it.
Session
This machine’s side: its sync state, lent to one closure at a time.

Functions§

sync_collection
One round with one peer for one collection.