Skip to main content

Module protocol

Module protocol 

Source
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
RosterMsg

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, and weirdnet-net’s request-response CBOR sends the envelope bytes as an array of integers (two bytes each for hex digits), so a page is about four times its plaintext on the wire. This keeps a full page under PAGE_MAX, which is also what a 0.3 puller accepts.
PAGE_MAX
Largest sealed page (and the reply cap to set on a sync node). Still under weirdnet-net’s 8 MiB default.
PROTOCOL
Request-response protocol id, same style as /weirdnet/link/1.

Statics§

SYNC_PROFILE
Identifier profile: /weirdnet/sync/1 for request-response, otherwise WEIRDNET.

Functions§

decode
decode_framed
encode
Length-prefixed CBOR (u32 big-endian length, then the item). For a raw stream; Node::request already frames Envelope as CBOR through libp2p.
encode_framed
page_for_type
Build a Page message 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.
RefuseReason