Skip to main content

Module revs

Module revs 

Source
Expand description

revs/: the whole document at every rev — the document itself (docs/log-vs-snapshot.md).

One file per rev the manifest holds — revs/000012.json.gz, gzip over the compact serde_json bytes of the document at that rev. Rev 0 is the empty document and is written nothing, so a container with nothing in it holds an empty directory.

A rev carries no payloads. assets/ is the one home for bytes, so a 1 MB PNG is written once under its own hash rather than into every rev that stands after it; a rev file goes out stripped (Document::without_assets) and comes back with everything it references re-attached. An export, which has no container beside it to read them from, keeps embedding its payloads.

The name and the encoding live here alone, over a Backing that is a container’s own shelf for an attached session and a map for one with no files — so a scratch session steps exactly as a container does, and the store, the fsck and Save-as cannot spell a rev differently from each other.

Structs§

Memory
A session with no files: the same compressed bytes, in a map.

Enums§

RevFault
What went wrong between a session’s revs and the history that names them.

Constants§

LEVEL 🔒
One compressor everywhere, so the same bytes are in a container whether a browser or a desktop wrote it and a copy moves between them with nothing to translate.
REVS
The directory a container keeps its rev files in.

Traits§

Backing
Where a session keeps the document at every rev: a directory, or a map that dies with the process. The same bytes either way.

Functions§

attached
Put back every payload document references, out of the one place bytes live.
bytes
The bytes rev at holds, or the fault that says why they are not there.
encode 🔒
Errors
entry
Where rev at is written. Zero-padded so the directory sorts as the history reads.
pack 🔒
read
The document rev at holds, as the file holds it: no payloads. attached is what puts them back.
stamp
The digest of the bytes rev at holds — what a manifest row’s hash is checked against.
through
Every rev a history through at holds, oldest first. Rev 0 is the empty document and was never written, so counting starts at one.
unpack 🔒
witnessed
Whether rev at holds the bytes named says it does — the fsck’s question, and the one a writable open asks of its head.
write
Write document as rev at and hand back the digest of the bytes that landed — which is what the manifest row stamps, and the only state digest this format has.