pub trait ImmutableStore {
// Required methods
fn get(&self, hash: &Hash) -> Result<Vec<u8>>;
fn has(&self, hash: &Hash) -> bool;
fn put(&mut self, data: &[u8]) -> Result<Hash>;
fn partition_id(&self) -> PartitionId;
}Expand description
The full content-addressed storage contract a backend must satisfy: partition-scoped, immutable once written, hash-verified on every read.
Naming reconciliation (the design review, 2026-08-23): the 2026-06
storage-alignment lock specified ImmutableStore/MutableStore as the
trait vocabulary; the shipped v2 code (pre-relocation) split this same
contract into ReadBlock/WriteBlock sub-traits plus a composed
ImmutableStore marker. This trait collapses that split — same four
methods, same signatures, same implementors — under the single locked
name. No behavior changed by the collapse.
Required Methods§
fn has(&self, hash: &Hash) -> bool
Sourcefn put(&mut self, data: &[u8]) -> Result<Hash>
fn put(&mut self, data: &[u8]) -> Result<Hash>
Store data, returning its content hash. A put for content already
present in this partition is a no-op dedup hit, not a duplicate
write.
fn partition_id(&self) -> PartitionId
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".