summaryrefslogtreecommitdiffstats
path: root/src/transport.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 02:06:59 +0200
committertv <tv@krebsco.de>2026-10-20 02:06:59 +0200
commit11a8ec06429b639e9fefec85b72a48451acad456 (patch)
tree5dd5d9e7bd277e928a55f1651430519a5b09f57d /src/transport.rs
parent3acbbd6cd6b64c6c39408dd254cc2dbcab1b3e65 (diff)
fix catch-up
Diffstat (limited to 'src/transport.rs')
-rw-r--r--src/transport.rs23
1 files changed, 18 insertions, 5 deletions
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<u8>,
+ 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<u8>,
+ /// 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()
}
}