referrerpolicy=no-referrer-when-downgrade
sc_statement_store

Trait StatementStore

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

Statement store API.

Required Methods§

fn statements(&self) -> Result<Vec<([u8; 32], Statement)>, Error>

Return all statements.

fn statement(&self, hash: &[u8; 32]) -> Result<Option<Statement>, Error>

Get statement by hash.

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

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

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

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).

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

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

fn broadcasts_stmt( &self, match_all_topics: &[[u8; 32]], ) -> Result<Vec<Vec<u8>>, Error>

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

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

Return 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).

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

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

The result is for each statement: the SCALE-encoded statement concatenated to the decrypted data.

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

Submit a statement.

fn remove(&self, hash: &[u8; 32]) -> Result<(), Error>

Remove a statement from the store.

Implementors§