Skip to main content

Module storage

Module storage 

Source
Expand description

Where one container’s bytes live.

The .bwx layout — which file, in what order, fsync’d before what — is the container’s business and is written once, over this trait. What a Storage answers is narrower: read, write, append, truncate, list and remove, by container-relative Entry name, the three facts about the container itself (what it is called, where it is, how much of it is worth holding in memory), and the lock that says who may write it.

Async below, synchronous above. The editor’s read path is synchronous and stays so, while origin-private storage in a browser is not: every method answers a future, and a storage whose futures are ready the moment they are made (Native, Memory) is resolved with one poll (ready_now). A storage whose futures are not ready is read into memory at open instead (Residency::Resident), so the reads the editor makes never reach it and the writes it makes are owed to the storage rather than made through it (Container::drain).

Re-exports§

pub use erased::Any;
pub use memory::Memory;
pub use native::Native;

Modules§

erased
A storage whose kind is known only at run time.
memory
A container in a map, for a session with nothing to write to and for tests on every target.
native
A container that is a directory of real files.

Structs§

DocumentRef
Which document a door names, as the shell that opens it spells one: a path on a desktop, a name in the library in a browser.
Entry
One file of a container, named relative to it: manifest.jsonl, revs/000012.json.gz. Never a platform path — the storage is what knows whether there is one.
Name
What a container is called, wherever it is kept.

Enums§

Residency
How much of a container is worth holding in memory.

Constants§

CONTAINER_EXTENSION
The document format’s extension, on a container.

Traits§

Storage
Where one container’s bytes live.

Functions§

named_as_a_container 🔒
ready_now
Resolve a future that promised to be ready the moment it was made.