Skip to main content

ImmutableStore

Trait ImmutableStore 

Source
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§

Source

fn get(&self, hash: &Hash) -> Result<Vec<u8>>

Fetch and verify content by hash.

Source

fn has(&self, hash: &Hash) -> bool

Source

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.

Source

fn partition_id(&self) -> PartitionId

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§