Skip to main content

MutableStore

Trait MutableStore 

Source
pub trait MutableStore {
    // Required methods
    fn load(&self, key: &str) -> Result<Vec<u8>>;
    fn store(&mut self, key: &str, data: &[u8]) -> Result<()>;
    fn cas(
        &mut self,
        key: &str,
        expected: Option<&[u8]>,
        new: &[u8],
    ) -> Result<bool>;
    fn list(&self, prefix: &str) -> Result<Vec<String>>;
}
Expand description

Cache-state store for the bitchain protocol layer (e.g. a “latest” pointer keyed by name) — distinct from ImmutableStore, which has no notion of a mutable pointer: every address it serves is a stable content hash. Declared per the 2026-06 lock’s target trait shape so the vocabulary exists; no implementation ships with this relocation — bitchain’s manifest protocol treats manifests as immutable, content-addressed artifacts and has no current caller for this trait.

Required Methods§

Source

fn load(&self, key: &str) -> Result<Vec<u8>>

Source

fn store(&mut self, key: &str, data: &[u8]) -> Result<()>

Source

fn cas( &mut self, key: &str, expected: Option<&[u8]>, new: &[u8], ) -> Result<bool>

Compare-and-swap: succeeds (returns Ok(true)) only if the value currently stored at key equals expected (None means “key must not exist yet”).

Source

fn list(&self, prefix: &str) -> Result<Vec<String>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§