openzeppelin_monitor::services::blockwatcher

Trait BlockStorage

Source
pub trait BlockStorage:
    Clone
    + Send
    + Sync {
    // Required methods
    fn get_last_processed_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_last_processed_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network_id: &'life1 str,
        block: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        network_id: &'life1 str,
        blocks: &'life2 [BlockType],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_blocks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn save_missed_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network_id: &'life1 str,
        block: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Interface for block storage implementations

Defines the required functionality for storing and retrieving blocks and tracking the last processed block for each network.

Required Methods§

Source

fn get_last_processed_block<'life0, 'life1, 'async_trait>( &'life0 self, network_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves the last processed block number for a network

§Arguments
  • network_id - Unique identifier for the network
§Returns
  • Result<Option<u64>, anyhow::Error> - Last processed block number or None if not found
Source

fn save_last_processed_block<'life0, 'life1, 'async_trait>( &'life0 self, network_id: &'life1 str, block: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Saves the last processed block number for a network

§Arguments
  • network_id - Unique identifier for the network
  • block - Block number to save
§Returns
  • Result<(), anyhow::Error> - Success or error
Source

fn save_blocks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, network_id: &'life1 str, blocks: &'life2 [BlockType], ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Saves a collection of blocks for a network

§Arguments
  • network_id - Unique identifier for the network
  • blocks - Collection of blocks to save
§Returns
  • Result<(), anyhow::Error> - Success or error
Source

fn delete_blocks<'life0, 'life1, 'async_trait>( &'life0 self, network_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Deletes all stored blocks for a network

§Arguments
  • network_id - Unique identifier for the network
§Returns
  • Result<(), anyhow::Error> - Success or error
Source

fn save_missed_block<'life0, 'life1, 'async_trait>( &'life0 self, network_id: &'life1 str, block: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Saves a missed block for a network

§Arguments
  • network_id - Unique identifier for the network
  • block - Block number to save
§Returns
  • Result<(), anyhow::Error> - Success or error

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§