From a363c9958788dc648828410126f0f93c0c9bee5f Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 04:34:59 +0000 Subject: wire: version 53, what is the document's as bytes, and the kind in handshakes Spoken beside 52 (OLDEST), so a swarm upgrades node by node: a node writes each peer the newest version both speak. From 53 on (wire::KINDS, wire::kinds), what is a document's kind's goes as bytes the wire carries and doesn't read: a SYNC's body, with whether it is taken as delivered, and what vouches for what it carries; where a STATUS says its sender stands; what a BLOB request asks for in bulk; a BLOB is of a unit or of what is offered in bulk, by their names. Automerge's bytes are what 52 carries in the messages' own fields. HELLO and HELLO_REPLY say the kind of the sender's document (document::KIND, automerge) from 53 on; one in 52 says none and is of that kind. A peer whose document is of another kind is refused in the handshake, saying so. The bytes of 52 stay as golden_bytes has them; golden_bytes_of_kinds has those of 53. scripts/wire-check v0.0.1: its nodes and this tree's talk. --- src/transport/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/transport/mod.rs') diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 4fa3ec3..61abe9c 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -587,6 +587,18 @@ pub(crate) struct HelloRequest { /// The party the sender is of, in a swarm holding a store (`--store-party`): nodes of /// one sync with the nodes its parties list, each as its party's. None elsewhere. pub(crate) party: Option, + /// The kind of the sender's document (`document::KIND`): nodes whose documents are of + /// different kinds don't sync. Said from the wire version on that carries what is a + /// kind's as bytes (`wire::KINDS`); a build speaking none says none, and is of the + /// kind there was then. + #[serde(skip, default = "unsaid_kind")] + pub(crate) kind: String, +} + +/// The kind of a document whose node says none (`HelloRequest::kind`): Automerge's, the +/// only one there was before kinds were said. +fn unsaid_kind() -> String { + crate::document::KIND.to_owned() } /// A peer a HELLO_REPLY lists: who it is, and where the sender reaches it. @@ -677,6 +689,9 @@ pub(crate) struct HelloReply { pub(crate) root: Option>, /// As `HelloRequest::party`. pub(crate) party: Option, + /// The kind of the sender's document, as `HelloRequest::kind` has it. + #[serde(skip, default = "unsaid_kind")] + pub(crate) kind: String, } /// Bytes shown as lowercase hex, e.g. run IDs in logs. -- cgit v1.3.1