From 2a475153b715c954935ae46d3773ffbf3d007f03 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 04:05:41 +0000 Subject: document: where a document stands, and a peer, is the document's to compare document::passing: a Mark, where a document stood, by which what changed since and the node's own units since are told (changed_since, own_since: the change publisher, the sync worker); and of where a peer says it stands, what the document lacks, whether the peer holds what the document held, a pull of what is lacking, and what it has counting as sent no more (lacking, peer_holds, pull, heard: the relay, keepalives). The published stamp gives its summary and its mark. --- src/document/replica.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/document/replica.rs') diff --git a/src/document/replica.rs b/src/document/replica.rs index a6eaade..092878b 100644 --- a/src/document/replica.rs +++ b/src/document/replica.rs @@ -166,6 +166,18 @@ pub(crate) struct Stamp { pub(crate) heads: Arc<[ChangeHash]>, } +impl Stamp { + /// Where the document stands, as a keepalive says it. + pub(crate) fn summary(&self) -> crate::transport::HeadsSummary { + crate::transport::HeadsSummary::of(self.heads.to_vec()) + } + + /// Where the document stands, to tell later what came since. + pub(crate) fn mark(&self) -> super::passing::Mark { + super::passing::Mark::at(&self.heads) + } +} + impl Replica { pub(crate) fn new(epoch: Epoch, doc: Document) -> Self { let (stamp, _) = watch::channel(Stamp { -- cgit v1.3.1