Expand description
Laterite media: content-addressed blob storage with streaming ingest.
Three concepts are kept apart, which is the whole design:
- a blob is physical bytes, named by their own BLAKE3 hash;
- a record is a file with a stable identity, pointing at a blob;
- a link attaches a record to something that owns it.
Conflating them is what makes a media library hard to replace a file in, or to reference from two places. Here, replacing a file writes a new blob and a new hash while the record’s id and every reference to it stay put.
This crate currently carries the bottom layer: the storage driver, the ingest primitive, and the record table. The library browser, virtual folders, variants and the finder widget arrive with the CMS work.
Re-exports§
pub use driver::BlobMeta;pub use driver::ByteStream;pub use driver::Disposition;pub use driver::StorageDriver;pub use driver::StorageError;pub use folder::Folder;pub use folder::FolderError;pub use ingest::blob_path;pub use ingest::ingest;pub use ingest::stream_of;pub use ingest::IngestError;pub use ingest::Ingested;pub use kind::Kind;pub use link::Link;pub use link::Owner;pub use local::LocalDisk;pub use preset::Format;pub use preset::Mode;pub use preset::Preset;pub use record::MediaRecord;pub use record::NewMedia;pub use record::NewMediaExtra;pub use record::RecordError;pub use variant::Variant;pub use variant::VariantError;pub use variant::Variants;
Modules§
- driver
- Where blob bytes physically live, and the trait that hides which.
- folder
- Library folders: rows, never disk directories. A folder has a parent and a
materialized path (
/photos/2026), so a subtree is one prefix query and browsing never asks the storage driver to list anything. - gc
- Garbage collection: a record outside the library that nothing links to, past a grace period, and a blob no record names any more. Liveness is a query, never a counter.
- image
- Pixels: what is read from an upload before it is stored (its size, its orientation, with the metadata gone), and how a variant is rendered from it under decode limits.
- ingest
- Taking bytes in: hash while streaming, then store.
- kind
- What a file is to a browser, from its sniffed content type.
- library
- Browsing the library: the records in a folder, searched, filtered by kind and sorted, a page at a time.
- link
- Links: the relation between a media record and the record and field that holds it. Liveness is a query over these rows, never a counter: a record outside the library with no link is garbage, and a library file still linked names who uses it.
- local
- The local-filesystem driver: the only one a default deployment compiles.
- migrations
- The media schema, as portable one-file migrations.
- preset
- Presets: the named sizes a variant may be made in. A URL names a preset, never a width, so the set of derivatives a file can have is the set an author declared.
- record
- The media record: a file’s stable identity, pointing at a blob.
- variant
- Variants: named, cached derivatives of a media record (a
thumb, acard), each a row pointing at its own blob path, made on the first request behind a lock per file and preset so a burst renders once. - verify
- Verification: every record’s blob re-hashed against its row, so a lost file, a truncated write or bit-rot shows up as a named fault.
Structs§
- DiskReg
- A named disk the application declares, for a module that stores files to find.
- Media
Module - The
laterite.mediamodule: the media record table.
Functions§
- module
- This crate’s module. An application that stores files registers it on
Bootstrap; one that does not never compiles this crate at all.