Skip to main content

Module store

Module store 

Source
Expand description

Content-addressed object store.

Objects are addressed by the lowercase hex SHA-256 of their UNCOMPRESSED content and persisted DEFLATE-compressed (pure-Rust flate2/miniz_oxide backend — the workspace stays free of C dependencies). Compression is an internal detail behind put_object/get_object; because the address is the hash of the plaintext, the codec can be swapped (e.g. to zstd) without changing object identity or breaking dedup.

Functions§

get_object
Load and decompress the object addressed by hash for doc_id.
has_object
True if an object with hash already exists for doc_id.
object_hash
Compute the lowercase-hex SHA-256 address of content. Pure; no IO.
object_size
The on-disk (compressed) byte size of the object addressed by hash. Errors if the object does not exist.
put_object
Store content, returning its hash address. Idempotent / dedup’d: if the object already exists it is NOT rewritten.
put_object_with_hash
Store content at the already-computed address hash. Idempotent / dedup’d: if the object already exists it is NOT rewritten. Callers that have already hashed content (e.g. for a dedup check) use this to avoid hashing twice; hash MUST equal object_hash(content).