Skip to main content

Store

Trait Store 

Source
pub trait Store {
    type Tree: MerkleTree;
    type Error;
    type L: Loss;

    // Required methods
    fn get(&self, oid: &Oid) -> Imperfect<Self::Tree, Self::Error, Self::L>;
    fn put(&mut self, tree: Self::Tree) -> Imperfect<Oid, Self::Error, Self::L>;
    fn has(&self, oid: &Oid) -> Imperfect<Luminosity, Self::Error, Self::L>;
}
Expand description

Where crystals live. Every operation returns Imperfect.

The Store is the third primitive alongside Beam and Prism.

  • Beam: the value in motion
  • Prism: the transformation
  • Store: the persistence

Typed over a MerkleTree — the store knows its tree shape.

Required Associated Types§

Source

type Tree: MerkleTree

The tree type this store persists.

Source

type Error

Source

type L: Loss

Required Methods§

Source

fn get(&self, oid: &Oid) -> Imperfect<Self::Tree, Self::Error, Self::L>

Retrieve a tree by address. Partial if some dimensions are dark.

Source

fn put(&mut self, tree: Self::Tree) -> Imperfect<Oid, Self::Error, Self::L>

Persist a tree. Returns its Oid. Partial if not fully replicated.

Source

fn has(&self, oid: &Oid) -> Imperfect<Luminosity, Self::Error, Self::L>

Check luminosity at address. Light, Dimmed, or Dark.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§