Expand description
How NibKeep replicas pair and sync their spaces: the messages they send, reconciling
what two replicas hold with negentropy, and the exchanges of pairing and syncing, which
run over any Transport and work on the replica’s data through the traits
Holder and Sponsoring. The crate does no I/O of its own, so that the simulation
can run many replicas in one process.
The protocol is specified in docs/spec/sync.md, and the reasons for it are in
docs/Technical-design.md, section 10.
Structs§
- Challenge
- What a remover asks a prover to answer of a sealed blob, or of a content’s own bytes.
- Counts
- How many things of a space went one way.
- Invitation
- What an invitation did, on either side: who asked, what was offered and what granted.
- Joined
- What a joiner was granted, once it has made its library.
- Pack
Reader - A pack as it reads: its space, the update that wrote it, and its items, one after the other, each checked as it is read.
- Range
- A range of a sealed blob’s bytes: where it starts, and how many bytes it takes.
- Space
Synced - What a space’s sync sent and received.
- Sponsored
- What a sponsor did: whom it added, and what it granted.
- Synced
- What a sync did.
- Transport
Error - Why a connection failed.
Enums§
- Holding
- A thing that a space holds, as a replica tells it to reconciliation. Sealed blobs are not
among them: each side asks for those it keeps (
crate::Holder::wanted_blobs). - Pack
Item - An item of a pack.
- Reason
- Why a side ended a connection, as
[0, reason]says. - Sync
Error - Why pairing or syncing failed.
Constants§
- CHALLENGES_
AT_ ONCE - How many challenges one message carries at most.
- MAX_
MESSAGE_ LEN - How long a message may be: 16 MiB.
- MOST_
INTRODUCTIONS - How many listings by a recovery code an initiator’s hello carries at most: one for each space or group that lists it by a code (Sync).
- MOST_
PACK_ BLOB - The largest sealed blob that a pack holds, 1 MiB: a larger one has a file of its own.
- MOST_
RANGES - How many ranges a challenge may name at most, as the prover reads them: those that a remover draws.
- MOST_
RANGE_ LEN - How many bytes a range may take at most: the whole of a blob that a remover reads in one range, so that a prover reads at most 64 KiB for each challenge.
- PACK_
SIZE - How many bytes a pack takes at most, 64 MiB, but for a single item that is larger: a writer with more to write writes another.
- RANGES
- How many ranges a challenge reads of a blob larger than they take together.
- RANGE_
LEN - How many bytes each range of a challenge takes, but in a blob smaller than all of them.
Traits§
- Accepting
- The joiner’s side of an invitation: its listing for what the admin offers, and how it takes the space.
- Holder
- A replica’s data, as a sync reads and changes it. Each method works on one space.
- Inviting
- The admin’s side of an invitation: what it offers the one who asks, once the person confirms, what it grants once the joiner signed its listing, and how it records the new member.
- Sponsoring
- The library’s side of pairing: what grants a new replica the space keys, and records it once it has joined.
- Transport
- A connection between two replicas, which carries whole messages in order, and is encrypted and bound to the two endpoints’ keys (Sync).
Functions§
- accept
- Joins a space by the invitation of the admin’s replica at the other end of
transport, with the code that the person typed andrequest, which says who asks, and takes the space asacceptingdoes. - initiate
- Syncs with the replica at the other end of
transport, as the side that connected. - invite
- Invites the joiner at the other end of
transportto a space, as the admin’s replica, with the code it showed. The code is spent whatever happens. - item_id
- The ID of an item: the BLAKE3 hash of the canonical encoding of what it is.
- join
- Pairs with the sponsor at the other end of
transport, as the joiner, with the code the person typed, and returns what the sponsor granted. The joiner then makes its library and says so withjoined. - joined
- Tells the sponsor that the joiner made its library: the end of pairing, with the listings that its key signed, in the personal space first, then, for an AI agent’s replica, in the spaces that the grant chose for it, in their order.
- pack_
header - The encoding of a pack’s first value: its space, and the number of the update that wrote it.
- pack_
item - The encoding of an item in a pack of
space: the message that a sync sends of it, and of a blob, its bytes after it. - refuse
- Ends a pairing or a sync before it starts, telling the other side why, as a replica that cannot take it now does.
- respond
- Syncs with the replica at the other end of
transport, as the side that was connected to. - sponsor
- Pairs with the joiner at the other end of
transport, as the sponsor, with the code it showed. The code is spent whatever happens.
Type Aliases§
- Blob
Bytes - The bytes of a sealed blob, as a replica reads them.