Skip to main content

Module store

Module store 

Source
Expand description

Storage backend abstraction and the content-addressable path layout.

A snapdir store is any backing location that holds two kinds of content-addressable blobs:

  • objects — the raw bytes of each file, addressed by their content checksum, under .objects/.
  • manifests — the snapshot manifest text, addressed by its snapshot id (the BLAKE3 of the comment-stripped manifest), under .manifests/.

Both use the same three-level sharded layout, slicing the hex address into 3 / 3 / 3 / rest segments to keep any single directory small. This layout is a frozen interop contract: it must match the Bash oracle (snapdir’s _snapdir_get_object_rel_path / _snapdir_get_manifest_rel_path) byte-for-byte so that a store written by either implementation is readable by the other.

.objects/<h[0..3]>/<h[3..6]>/<h[6..9]>/<h[9..]>
.manifests/<id[0..3]>/<id[3..6]>/<id[6..9]>/<id[9..]>

§Sync trait, async implementations

Store is a synchronous, object-safe trait. The orchestrator’s walk and hash stages are synchronous, and the on-disk FileStore (a later gate) is naturally synchronous, so a sync surface keeps the common path allocation-light and dyn-dispatchable (&dyn Store).

Network stores (S3, B2, GCS) use async native SDKs. They satisfy this sync trait by owning a private tokio runtime and bridging each method with runtime.block_on(async { … }). That bridge lives entirely inside the concrete store crate; it never leaks async/await or a runtime requirement into snapdir-core or the orchestrator. This is deliberate: making the trait async would force a runtime onto the otherwise-sync FileStore and the CLI, and would cost object-safety without async_trait.

Enums§

StoreError
Errors a Store backend can surface.

Constants§

MANIFESTS_DIR
Top-level directory under a store that holds snapshot manifests.
OBJECTS_DIR
Top-level directory under a store that holds content objects.

Traits§

Store
A content-addressable storage backend for snapdir snapshots.

Functions§

manifest_path
Returns the relative, sharded path of a manifest given its snapshot id.
object_path
Returns the relative, sharded path of a content object given its hex checksum.