Skip to main content

Module record

Module record 

Source
Expand description

Record values larger than one page, and values sealed per record.

A LogEntry’s op is what every version of this crate reads. Since 0.4 an entry may also carry a Value: then op is only a fallback (empty, or a preview the application chose) and the full value is in the Value, either inline (body) or split into content-addressed chunks (Blob). Older peers ignore the field, keep the fallback and never see a chunk, so nothing they hold changes meaning.

Chunks are ordinary log entries of the companion type chunk_type(typ) (<typ>#chunks), keyed by the BLAKE3 hash of their bytes. They are pulled right after their type (Limits::eager_chunks) or on demand (crate::pull_chunks), and reassembled only when every chunk and the whole value match their hashes.

A type configured RecordOptions::sealed has every value sealed under a key derived for that record from the head epoch key (record_key). Only members of the head rotation hold that key, so a device revoked before the write cannot open it, even with the seed and every older key. Members keep older epoch keys and admitted devices receive them, so values sealed before a rotation stay readable; crate::SyncState::reseal_stale moves them to the head key. Sealing happens before chunking, so chunks of a sealed value are ciphertext.

Structs§

Blob
A chunked payload: its length, BLAKE3 hash, and the chunk hashes in order.
Limits
Per-type size limits for crate::SyncState::write.
RecordOptions
How a record type is written: sealed or not, and its limits.
RecordRef
Which record a sealed value belongs to: its type, record id and writer node.
SealInfo
Which key a sealed payload is under: the rotation key at epoch, and the nonce.
Value
The full value of an entry whose op is only a fallback.

Enums§

RecordValue
What crate::SyncState::read found.

Constants§

CHUNK_MAX
Largest chunk (and inline value) that still fits a page with room to spare.
CHUNK_SUFFIX
Suffix of the companion type that carries a type’s chunks.
VALUE_VERSION
Newest Value format this crate reads.

Functions§

assemble
Reassemble a blob from log’s chunks of typ, checking every chunk hash, the length and the whole hash.
base_type
The type a companion chunk type belongs to.
chunk_type
The companion type holding typ’s chunks.
is_chunk_type
open_record
Open a value sealed for record r.
record_aad
Associated data of a sealed record: type, epoch, rotation, writer node and record id, so a sealed value cannot be moved to another record, type, key or writer.
record_key
Per-record key: HKDF-SHA256(epoch key, salt = user id, info = weirdnet-sync/v1/record/<type>/e<n>/k<rotation id>/<record id>).
seal_record
Seal plain for record r under rotation id’s epoch key.
split
Split a payload into chunks of chunk_size; returns the blob and the chunks.

Type Aliases§

Chunk
One chunk of a payload: its BLAKE3 hash and bytes.