hopr_db_api::logs

Trait HoprDbLogOperations

Source
pub trait HoprDbLogOperations {
    // Required methods
    fn ensure_logs_origin<'life0, 'async_trait>(
        &'life0 self,
        contract_address_topics: Vec<(Address, Hash)>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn store_log<'a, 'async_trait>(
        &'a self,
        log: SerializableLog,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn store_logs<'life0, 'async_trait>(
        &'life0 self,
        logs: Vec<SerializableLog>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<()>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_log<'life0, 'async_trait>(
        &'life0 self,
        block_number: u64,
        tx_index: u64,
        log_index: u64,
    ) -> Pin<Box<dyn Future<Output = Result<SerializableLog>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_logs<'a, 'async_trait>(
        &'a self,
        block_number: Option<u64>,
        block_offset: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableLog>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn get_logs_count<'life0, 'async_trait>(
        &'life0 self,
        block_number: Option<u64>,
        block_offset: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_logs_block_numbers<'a, 'async_trait>(
        &'a self,
        block_number: Option<u64>,
        block_offset: Option<u64>,
        processed: Option<bool>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn set_log_processed<'life0, 'async_trait>(
        &'life0 self,
        log: SerializableLog,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_logs_processed<'life0, 'async_trait>(
        &'life0 self,
        block_number: Option<u64>,
        block_offset: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_logs_unprocessed<'life0, 'async_trait>(
        &'life0 self,
        block_number: Option<u64>,
        block_offset: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_last_checksummed_log<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SerializableLog>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_logs_checksums<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn ensure_logs_origin<'life0, 'async_trait>( &'life0 self, contract_address_topics: Vec<(Address, Hash)>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ensures that logs in this database have been created by scanning the given contract address and their corresponding topics. If the log DB is empty, the given addresses and topics are used to prime the table.

§Arguments
  • contract_address_topics - list of topics for a contract address. There may be multiple topics with the same contract address.
§Returns

A Result which is Ok(()) if the database contains correct log data, or it has been primed successfully. An Err is returned otherwise.

Source

fn store_log<'a, 'async_trait>( &'a self, log: SerializableLog, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Stores a single log entry in the database.

§Arguments
  • log - The log entry to store, of type SerializableLog.
§Returns

A Result which is Ok(()) if the operation succeeds or an error if it fails.

Source

fn store_logs<'life0, 'async_trait>( &'life0 self, logs: Vec<SerializableLog>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<()>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stores multiple log entries in the database.

§Arguments
  • logs - A vector of log entries to store, each of type SerializableLog.
§Returns

A Result containing a vector of Result<()>, each representing the result of storing an individual log entry.

Source

fn get_log<'life0, 'async_trait>( &'life0 self, block_number: u64, tx_index: u64, log_index: u64, ) -> Pin<Box<dyn Future<Output = Result<SerializableLog>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves a specific log entry from the database.

§Arguments
  • block_number - The block number of the log entry.
  • tx_index - The transaction index of the log entry.
  • log_index - The log index of the log entry.
§Returns

A Result containing the SerializableLog if the operation succeeds or an error if it fails.

Source

fn get_logs<'a, 'async_trait>( &'a self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<SerializableLog>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves multiple log entries from the database.

§Arguments
  • block_number - An optional block number filter.
  • block_offset - An optional block offset filter.
§Returns

A Result containing a Vec of SerializableLog entries if the operation succeeds or an error if it fails.

Source

fn get_logs_count<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the count of log entries from the database.

§Arguments
  • block_number - An optional block number filter.
  • block_offset - An optional block offset filter.
§Returns

A Result containing the count of log entries if the operation succeeds or an error if it fails.

Source

fn get_logs_block_numbers<'a, 'async_trait>( &'a self, block_number: Option<u64>, block_offset: Option<u64>, processed: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Retrieves block numbers of log entries from the database.

§Arguments
  • block_number - An optional block number filter.
  • block_offset - An optional block offset filter.
  • processed - An optional processed filter.
§Returns

A Result containing a Vec of block numbers if the operation succeeds or an error if it fails.

Source

fn set_log_processed<'life0, 'async_trait>( &'life0 self, log: SerializableLog, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks a specific log entry as processed.

§Arguments
  • log - The log entry to mark as processed, of type SerializableLog.
§Returns

A Result which is Ok(()) if the operation succeeds or an error if it fails.

Source

fn set_logs_processed<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks multiple log entries as processed.

§Arguments
  • block_number - An optional block number filter.
  • block_offset - An optional block offset filter.
§Returns

A Result which is Ok(()) if the operation succeeds or an error if it fails.

Source

fn set_logs_unprocessed<'life0, 'async_trait>( &'life0 self, block_number: Option<u64>, block_offset: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks multiple log entries as unprocessed.

§Arguments
  • block_number - An optional block number filter.
  • block_offset - An optional block offset filter.
§Returns

A Result which is Ok(()) if the operation succeeds or an error if it fails.

Source

fn get_last_checksummed_log<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<SerializableLog>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the last checksummed log entry from the database.

§Returns

A Result containing an Option<SerializableLog> if the operation succeeds or an error if it fails.

Source

fn update_logs_checksums<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates checksums for log entries in the database.

§Returns

A Result which is Ok(Hash) if the operation succeeds or an error if it fails.

Implementors§