Expand description
weirdnet-sync/v1 messages and length-prefixed CBOR framing.
After the authenticated channel is up, payloads that carry records, cursors or
certificates are sealed under crate::sync_key. An Envelope carries the type and
epoch in the clear so the receiver can pick the key; the body is sealed.
Structs§
- Ack
- Envelope
- What goes on the request-response wire: type, epoch and (after a rotation) the rotation id in the clear, body sealed.
- Hello
- HelloOk
- KeyRef
- Which key an envelope is sealed under: the seed-derived one at
epoch, or the rotated one with this id. - Page
- Pull
- Refuse
- Roster
Msg
Enums§
- Message
- Application-level message, before sealing.
Constants§
- PAGE_
BUDGET - Plaintext budget for the ops in one page. The sealed body is hex in the envelope (two
bytes per plaintext byte), and weirdnet-net 0.8 sends the encoded envelope as one CBOR
byte string (one byte per byte, a few bytes of header). So a page is about twice its
plaintext on the wire, plus the envelope fields. This reserves 16 KiB for those and for
the gap between
LogEntry::wire_sizeand the real encoding (which is an estimate), then halves the rest: a full page is about 120 KiB plus slack underPAGE_MAX. (Through 0.4 this was a quarter, because 0.7 sent the bytes as integer arrays.) - PAGE_
MAX - Largest sealed page on the wire (and the request and reply cap to set on a sync node).
- PROTOCOL
- Request-response protocol id.
/2since weirdnet-net 0.8 sends byte fields as CBOR byte strings; a 0.4 (/1) node fails to negotiate instead of failing to decode.
Statics§
- SYNC_
PROFILE - Identifier profile:
/weirdnet/sync/2for request-response, otherwiseWEIRDNET.
Functions§
- decode
- decode_
framed - encode
- Length-prefixed CBOR (u32 big-endian length, then the item). For a raw stream;
Node::requestalready framesEnvelopeas CBOR through libp2p. - encode_
framed - page_
for_ type - Build a
Pagemessage from a log page, dropping ops whose typ does not match (they stay in the log for a later pull of that type).
Type Aliases§
- Cursors
- Last seq applied from each node, as sent in Hello.
- Refuse
Reason