[][src]Trait holochain_persistence_api::cas::storage::ContentAddressableStorage

pub trait ContentAddressableStorage: Clone + Send + Sync + Debug + ReportStorage {
    fn add(&mut self, content: &dyn AddressableContent) -> PersistenceResult<()>;
fn contains(&self, address: &Address) -> PersistenceResult<bool>;
fn fetch(&self, address: &Address) -> PersistenceResult<Option<Content>>;
fn get_id(&self) -> Uuid; }

content addressable store (CAS) implements storage in memory or persistently anything implementing AddressableContent can be added and fetched by address CAS is append only

Required methods

fn add(&mut self, content: &dyn AddressableContent) -> PersistenceResult<()>

adds AddressableContent to the ContentAddressableStorage by its Address as Content

fn contains(&self, address: &Address) -> PersistenceResult<bool>

true if the Address is in the Store, false otherwise. may be more efficient than retrieve depending on the implementation.

fn fetch(&self, address: &Address) -> PersistenceResult<Option<Content>>

returns Some AddressableContent if it is in the Store, else None AddressableContent::from_content() can be used to allow the compiler to infer the type @see the fetch implementation for ExampleCas in the cas module tests

fn get_id(&self) -> Uuid

Loading content...

Trait Implementations

impl PartialEq<dyn ContentAddressableStorage + 'static> for dyn ContentAddressableStorage[src]

Implementors

impl ContentAddressableStorage for ExampleContentAddressableStorage[src]

Loading content...