diff options
| author | tv <tv@krebsco.de> | 2026-11-29 03:31:26 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-29 03:31:26 +0000 |
| commit | a5b58282e496de7243f4f433deb3984e8fab8b3c (patch) | |
| tree | 33d89bfb811654aea7f2877cd6901192a31f68c2 /docs/document.md | |
| parent | d84d18395f12af5d22aa1dda68c6eaca1079cdcf (diff) | |
document.md: passing on, as asked of a kind, and what the wire carries of it
Not built. What of passing a document on is the swarm's for every kind
and what is a kind's; the three names above the seam (a stamp, a unit's
name, a writer) and what a kind's session with a peer is asked; a wire
version in which what is a kind's is bytes, spoken beside the one now;
and the same as a document of merged state without a history would
give it.
Diffstat (limited to 'docs/document.md')
| -rw-r--r-- | docs/document.md | 91 |
1 files changed, 88 insertions, 3 deletions
diff --git a/docs/document.md b/docs/document.md index 4830cd7..fa96aa1 100644 --- a/docs/document.md +++ b/docs/document.md @@ -239,6 +239,91 @@ named where nodes meet, and nodes of different kinds refuse each other saying so * **A set of events**: bytes by their hash, added and never removed, which is what a federation's store asks. +## Passing on + +Not built: how a document of any kind is passed on, and what the wire carries of it. + +### Whose it is + +**The swarm's**, for every kind: whom a node syncs with, and when (handshakes, who is +ready, who is level with whom, backing off); along whose tree a write is pushed and to +whom it is only announced (`swarm::tree`, `plumtree`, `flood`); that neighbours tell +each other where they stand and pull when behind (`swarm::relay`); moving many bytes in +chunks, from several nodes at once where they hold the same (`swarm::blob`); telling a +peer what was refused of it (`swarm::refusals`); the epoch a message is of. + +**A kind's**: what a message says, what a peer is known to have and what goes to it +next, what is done when one is lost, what the bytes moved in bulk are, and what a unit +is. The swarm hands these on without reading them. + +### What a kind gives + +Above the seam, three names, each opaque: + +* **A stamp**: where a document stands, in a few bytes a keepalive carries (Automerge's: + its heads, or a digest of many). Two are the same or not; and a document says of a + peer's whether it lacks something the peer has, has all of it, or can't tell. +* **A unit's name**: 32 bytes (Automerge's: a change's hash). What is announced, asked + for, refused and counted is named so. +* **A writer**: the node a unit is of, by its node ID, as now: a tree is a writer's. + +And a session per peer, the kind's own, with the document: + +| Asked of a kind | When | Automerge's | +|---|---|---| +| The next message for this peer, if there is any: its bytes, what vouches for what it carries, and the units it carries, each with its writer | the document changed, the peer answered, a reply is overdue | a sync message, or changes as they are, or an offer of a delta | +| Take a message: what it made of it | one came | changes screened and applied, the rest fed to the sync state | +| The peer got that message; it didn't | the transport says | what was carried counts as sent, or goes again | +| The peer stands here | its stamp came in a keepalive | everything in those heads' history is the peer's | +| The peer gets these units from another | the tree has another bring them | counted as sent, with a time | +| Start over | a handshake, another document | a new sync state | +| Units since this stamp, each with its writer and its time | after anything was taken, and for the node's own writes | the changes since those heads | +| The bytes of something offered in bulk, and whether every node holding it gives the same bytes; and take such bytes | a peer asks for a blob it was offered; one was fetched | a delta between heads; one change by its hash | + +What a kind makes of a message it took, it says in terms the swarm knows: the units +taken, with their writers and times; the paths that changed; the units refused, and +whose they were; whether the peer is now known to hold what this node holds, and this +node what the peer does; whether to answer; and what to fetch in bulk. + +Each unit taken was judged first: the kind turns what came into units, and asks the +rules (`access::rules::judge_seen`). + +### On the wire + +A wire version beside the one spoken now, in which what is a kind's is bytes: + +| Message | Now | Then | +|---|---|---| +| SYNC | an Automerge sync message, or changes with heads, or a delta's heads; signatures of changes; `delivered` | the kind's bytes; what vouches, the kind's bytes | +| STATUS | heads, or a digest and some of them | a stamp, the kind's bytes, no more than a keepalive may carry | +| BLOB | a change by its hash, a delta by its heads, content by its hash | a unit by its name, something offered in bulk by its name with what the kind says of it, content by its hash | +| REFUSALS | changes by their hashes | units by their names | +| HELLO | the root's hash | the same, and the kind | + +What stays as it is: the epoch in every message, `ready`, the writer a push is along +whose tree, when a message was sent, PRUNE and GRAFT, and everything that is no +document's. + +Automerge's bytes are what the version spoken now carries, so a node speaks both to its +peers as each can (`transport::wire`, versions side by side): a swarm of Automerge +documents upgrades node by node. A node that speaks the older version alone is of that +kind, and one of another kind tells it so, by the release that knows it, and syncs +nothing. + +### As merged state without a history would give it + +To see that what is asked isn't Automerge's in other words: + +* **A stamp**: a digest of the count seen up to per writer. +* **A unit**: one writer's writes from one count to another, signed by it: its name the + hash of that. +* **A session**: the counts the peer has seen up to, as it said when the session began + and as what was sent since adds. The next message is what the document holds beyond + those counts, as it holds it now: a place written ten times since is sent once. A + message lost is nothing to repair: what the peer has is learned again from its counts. +* **In bulk**: all it holds, for a node that has nothing. +* **Units since a stamp**: by writer, the counts beyond it. + ## Stages 1. **The seam written down**: this. @@ -246,9 +331,9 @@ named where nodes meet, and nodes of different kinds refuse each other saying so the engine's side (the writers a node wrote under, the walk that drops a change, the reading of received changes apart from the rules that judge them); what crosses the seam gets names of its own for a state, a unit and a writer; the closures that take - a document or a transaction take a view to read or to write; SYNC's body becomes the - kind's bytes; remakes become something a kind can do. Each step leaves the tests as - they are. + a document or a transaction take a view to read or to write; passing on is asked of + a kind ([Passing on](#passing-on)), first in the node, then on the wire; remakes + become something a kind can do. Each step leaves the tests as they are. 3. **The kind named** where nodes meet, with one kind to name. 4. **Merged state without a history**, as a second kind, with what is written often as its test. |
