pub trait Store {
    // Required methods
    fn get_entry(&self, hash: &EntryHash) -> StateQueryResult<Option<Entry>>;
    fn get_public_or_authored_entry(
        &self,
        hash: &EntryHash,
        author: Option<&AgentPubKey>
    ) -> StateQueryResult<Option<Entry>>;
    fn get_action(
        &self,
        hash: &ActionHash
    ) -> StateQueryResult<Option<SignedActionHashed>>;
    fn get_record(&self, hash: &AnyDhtHash) -> StateQueryResult<Option<Record>>;
    fn get_public_or_authored_record(
        &self,
        hash: &AnyDhtHash,
        author: Option<&AgentPubKey>
    ) -> StateQueryResult<Option<Record>>;
    fn contains_entry(&self, hash: &EntryHash) -> StateQueryResult<bool>;
    fn contains_action(&self, hash: &ActionHash) -> StateQueryResult<bool>;

    // Provided method
    fn contains_hash(&self, hash: &AnyDhtHash) -> StateQueryResult<bool> { ... }
}

Required Methods§

source

fn get_entry(&self, hash: &EntryHash) -> StateQueryResult<Option<Entry>>

Get an [Entry] from this store.

source

fn get_public_or_authored_entry( &self, hash: &EntryHash, author: Option<&AgentPubKey> ) -> StateQueryResult<Option<Entry>>

Get an [Entry] from this store.

  • Will return any public entry.
  • If an author is provided and an action for this entry matches the author then any entry will be return regardless of visibility .
source

fn get_action( &self, hash: &ActionHash ) -> StateQueryResult<Option<SignedActionHashed>>

Get an [SignedActionHashed] from this store.

source

fn get_record(&self, hash: &AnyDhtHash) -> StateQueryResult<Option<Record>>

Get an [Record] from this store.

source

fn get_public_or_authored_record( &self, hash: &AnyDhtHash, author: Option<&AgentPubKey> ) -> StateQueryResult<Option<Record>>

Get an [Record] from this store that is either public or authored by the given key.

source

fn contains_entry(&self, hash: &EntryHash) -> StateQueryResult<bool>

Check if an entry is contained in the store

source

fn contains_action(&self, hash: &ActionHash) -> StateQueryResult<bool>

Check if an action is contained in the store

Provided Methods§

source

fn contains_hash(&self, hash: &AnyDhtHash) -> StateQueryResult<bool>

Check if a hash is contained in the store

Implementors§

source§

impl Store for Scratch

source§

impl<'borrow, 'txn> Store for DbScratch<'borrow, 'txn>

source§

impl<'stmt> Store for Txn<'stmt, '_>

source§

impl<'stmt> Store for Txns<'stmt, '_>