From 11a8ec06429b639e9fefec85b72a48451acad456 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 20 Oct 2026 02:06:59 +0200 Subject: fix catch-up --- src/transport.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/transport.rs') diff --git a/src/transport.rs b/src/transport.rs index b7a4094..51faf16 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -68,22 +68,35 @@ pub struct SnapshotRequest { pub epoch: Epoch, /// The epoch whose document is wanted. pub wanted: Epoch, + /// Byte offset of the wanted chunk in the saved document. + pub offset: u64, } +/// One chunk of the sender's saved document, or a refusal. #[derive(Clone)] pub struct SnapshotReply { - /// The sender's epoch, which is the epoch of `document`. + /// The sender's epoch; equals `wanted` unless refused. pub epoch: Epoch, - /// `AutoCommit::save()` of the sender's document; empty if it isn't on the wanted - /// epoch (any more). - pub document: Vec, + pub wanted: Epoch, + /// SHA-256 of the whole saved document; identifies the copy chunks come from. + pub digest: [u8; 32], + /// Length of the whole saved document. + pub total: u64, + pub offset: u64, + pub data: Vec, + /// Non-empty if the sender won't serve the document, with the reason. + pub refused: String, } impl std::fmt::Debug for SnapshotReply { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("SnapshotReply") .field("epoch", &self.epoch) - .field("document_bytes", &self.document.len()) + .field("wanted", &self.wanted) + .field("total", &self.total) + .field("offset", &self.offset) + .field("data_bytes", &self.data.len()) + .field("refused", &self.refused) .finish() } } -- cgit v1.3.1