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. - Record
Options - How a record type is written: sealed or not, and its limits.
- Record
Ref - Which record a sealed value belongs to: its type, record id and writer node.
- Seal
Info - Which key a sealed payload is under: the rotation
keyatepoch, and the nonce. - Value
- The full value of an entry whose
opis only a fallback.
Enums§
- Record
Value - What
crate::SyncState::readfound.
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
Valueformat this crate reads.
Functions§
- assemble
- Reassemble a blob from
log’s chunks oftyp, 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
plainfor recordrunder rotationid’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.