diff options
| author | tv <tv@krebsco.de> | 2026-11-05 04:36:58 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-05 04:36:58 +0100 |
| commit | c7226385f3765b2a72b7b4d95129fb20fec58d5c (patch) | |
| tree | 6d6f6e1b6c58c16789551068f2daa8e19524abe2 /src/transport | |
| parent | 39980623f81e9e75f142f55a35794bf7a53aa38b (diff) | |
push changes experiment
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/mod.rs | 9 | ||||
| -rw-r--r-- | src/transport/traffic.rs | 4 | ||||
| -rw-r--r-- | src/transport/wire.rs | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 474e386..7e5d41b 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -743,6 +743,15 @@ pub(crate) enum SyncBody { Message(#[serde(with = "crate::transport::wire::codec::sync_message")] SyncPayload), /// An Automerge sync message, deflated (`compress`): a large one, which shrank. Deflated(#[serde(with = "crate::transport::wire::codec::sync_message")] SyncPayload), + /// Changes passed on along a writer's tree as they are, with the sender's heads, + /// instead of an Automerge sync message (`AppState::push_changes`): where the sender + /// takes the message as delivered, it has everything the receiver has, and needs + /// none of the rest of one (`SyncSession::push`). + Changes { + #[serde(with = "crate::transport::wire::codec::change_hashes")] + heads: Vec<ChangeHash>, + changes: Vec<serde_bytes::ByteBuf>, + }, /// Instead of a message too large to send in one piece: fetch these changes as a /// blob (`BlobId::Delta`), then sync on. Delta(DeltaSpec), diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs index df95bce..11aa70d 100644 --- a/src/transport/traffic.rs +++ b/src/transport/traffic.rs @@ -198,7 +198,9 @@ fn related(peer: &str, message: &ParsedMessage) -> Option<String> { SyncBody::Delta(spec) => { format!("blob {}", crate::transport::BlobId::Delta(spec.id())) } - SyncBody::Message(_) | SyncBody::Deflated(_) => return None, + SyncBody::Message(_) | SyncBody::Deflated(_) | SyncBody::Changes { .. } => { + return None; + } }, _ => return None, }) diff --git a/src/transport/wire.rs b/src/transport/wire.rs index 2794e69..70ac3ce 100644 --- a/src/transport/wire.rs +++ b/src/transport/wire.rs @@ -14,7 +14,7 @@ use super::{EncodedMessage, MessageKind, ParsedMessage}; /// The wire format's version, the first byte of every payload. Bump it with every change /// to a message type or a codec (`golden_bytes` fails then). -pub(crate) const VERSION: u8 = 32; +pub(crate) const VERSION: u8 = 33; /// What the second byte of a payload says. fn tag(kind: MessageKind) -> u8 { |
