summaryrefslogtreecommitdiffstats
path: root/src/transport.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport.rs')
-rw-r--r--src/transport.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/transport.rs b/src/transport.rs
index 51faf16..9cfb026 100644
--- a/src/transport.rs
+++ b/src/transport.rs
@@ -23,9 +23,6 @@ pub enum ParsedMessage {
Sync(SyncEnvelope),
Ping(Keepalive),
Pong(Keepalive),
- /// Asks a peer for its document of a newer epoch (late or new nodes).
- SnapshotRequest(SnapshotRequest),
- SnapshotReply(SnapshotReply),
}
impl ParsedMessage {
@@ -36,8 +33,6 @@ impl ParsedMessage {
ParsedMessage::HelloReply(reply) => reply.epoch,
ParsedMessage::Sync(envelope) => envelope.epoch,
ParsedMessage::Ping(keepalive) | ParsedMessage::Pong(keepalive) => keepalive.epoch,
- ParsedMessage::SnapshotRequest(request) => request.epoch,
- ParsedMessage::SnapshotReply(reply) => reply.epoch,
}
}
}
@@ -62,45 +57,6 @@ pub struct SyncEnvelope {
pub message: Message,
}
-#[derive(Debug, Clone)]
-pub struct SnapshotRequest {
- /// The requester's epoch.
- 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; equals `wanted` unless refused.
- pub epoch: Epoch,
- 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("wanted", &self.wanted)
- .field("total", &self.total)
- .field("offset", &self.offset)
- .field("data_bytes", &self.data.len())
- .field("refused", &self.refused)
- .finish()
- }
-}
-
/// A message serialized for the wire. Cloning is cheap (shared buffer).
#[derive(Clone, Debug)]
pub struct EncodedMessage {