pub trait StatementStore: Send + Sync {
    // Required methods
    fn statements(&self) -> Result<Vec<(Hash, Statement)>>;
    fn statement(&self, hash: &Hash) -> Result<Option<Statement>>;
    fn broadcasts(&self, match_all_topics: &[Topic]) -> Result<Vec<Vec<u8>>>;
    fn posted(
        &self,
        match_all_topics: &[Topic],
        dest: [u8; 32]
    ) -> Result<Vec<Vec<u8>>>;
    fn posted_clear(
        &self,
        match_all_topics: &[Topic],
        dest: [u8; 32]
    ) -> Result<Vec<Vec<u8>>>;
    fn submit(
        &self,
        statement: Statement,
        source: StatementSource
    ) -> SubmitResult;
    fn remove(&self, hash: &Hash) -> Result<()>;
}
Expand description

Statement store API.

Required Methods§

source

fn statements(&self) -> Result<Vec<(Hash, Statement)>>

Return all statements.

source

fn statement(&self, hash: &Hash) -> Result<Option<Statement>>

Get statement by hash.

source

fn broadcasts(&self, match_all_topics: &[Topic]) -> Result<Vec<Vec<u8>>>

Return the data of all known statements which include all topics and have no DecryptionKey field.

source

fn posted( &self, match_all_topics: &[Topic], dest: [u8; 32] ) -> Result<Vec<Vec<u8>>>

Return the data of all known statements whose decryption key is identified as dest (this will generally be the public key or a hash thereof for symmetric ciphers, or a hash of the private key for symmetric ciphers).

source

fn posted_clear( &self, match_all_topics: &[Topic], dest: [u8; 32] ) -> Result<Vec<Vec<u8>>>

Return the decrypted data of all known statements whose decryption key is identified as dest. The key must be available to the client.

source

fn submit(&self, statement: Statement, source: StatementSource) -> SubmitResult

Submit a statement.

source

fn remove(&self, hash: &Hash) -> Result<()>

Remove a statement from the store.

Implementors§