Skip to main content

Module container

Module container 

Source
Expand description

The .bwx container: a manifest, the revs it names, and the artwork they place.

doc.bwx/
  revs/           the whole document at every rev, compressed — THE document
  manifest.jsonl  one appended row per rev: who, when, where, what it named
  assets/         content-addressed artwork
  lock            advisory single-writer lock
  .gitattributes  how git must treat them

Which file, in what order, and fsync’d before what is written here and once, over a Storage that says only where the bytes go — a directory of real files on a desktop, a map in a test. On a filesystem that makes the container a directory rather than a packed file, because appends, content-addressed blobs and per-writer sidecars all want to be separate files, and because git and text tools then handle a container natively.

Structs§

Artwork
A container’s assets/ directory.
Container
Drained
How many of the writes it owed a container has made.
Glance
What a library shows of a container without opening it: its newest rev, and when that rev was written.
Held 🔒
Revs
A container’s rev files, as the shelf a rev is read off and written to.

Enums§

Access
Whether this handle may write. The writable arm is the lock: it is taken when the container is attached and given up when the handle closes or is demoted, so no caller has a guard to remember.
ContainerError
Why a container could not be opened at all — as opposed to opened read-only, which is an outcome rather than a failure.
Discarded
What became of a container offered for discard_pristine.
Kept 🔒
What of the container is kept in memory.
Op 🔒
One write a container has made to its memory and not yet to its storage.
ReadOnlyReason
Why a container is open without the right to write it. Every arm is something the user must be told, which is why this is not a bool.
WriteRefusal

Constants§

ASSETS
The directory a container files its artwork in.
GITATTRIBUTES
GITATTRIBUTES_TEMPLATE 🔒
Two divergent manifest.jsonls are concurrent editing through the back door, which this design deliberately has no answer for, so the conflict is surfaced at merge time instead of waiting for a replay to refuse the result.
LAID_DOWN 🔒
The files Container::create lays down. Anything else in a container belongs to whoever put it there.
LAID_DOWN_DIRS 🔒
The directories it lays down. Each must be empty for the container to count as pristine.
LOCK
MANIFEST

Functions§

asset_entry
Where a payload of hash is filed, given the format that reads it.
discard_pristine
Remove a container nothing was ever written into, so a launch and a quit leave the documents directory as they found it.
discard_unclaimed
The same cleanup, narrowed by the lock instead of by a caller’s memory of what it made: a container nobody holds and nothing was ever written into.