pub trait Runner {
    type Error;

    // Required methods
    fn run<'async_trait, T, U>(
        processor: Collector<T, U>
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where T: 'async_trait + JsonRpcClient + Clone + Send + Sync,
             U: 'async_trait + Storage + Auth + Clone + Send + Sync,
             Self: 'async_trait;
    fn run_par<'async_trait, T, U>(
        processor: Collector<T, U>
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where T: 'async_trait + JsonRpcClient + Clone + Send + Sync,
             U: 'async_trait + Storage + Auth + Clone + Send + Sync,
             Self: 'async_trait;
}
Expand description

A trait for executing blockchain-related operations.

The Runner trait abstracts the logic for running operations in both single-threaded and multi-threaded environments. It’s designed for applications that interact with blockchain data, allowing for flexible implementation of data fetching, processing, and storage.

This trait is particularly useful for managing the execution flow of blockchain data processing tasks, whether running sequentially or in parallel (when enabled through feature flags).

Required Associated Types§

Required Methods§

source

fn run<'async_trait, T, U>( processor: Collector<T, U> ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + JsonRpcClient + Clone + Send + Sync, U: 'async_trait + Storage + Auth + Clone + Send + Sync, Self: 'async_trait,

Executes defined operations in a single-threaded manner.

This method is responsible for iterating over blockchain blocks, processing logs, and handling data storage. It should be implemented to perform these operations sequentially.

source

fn run_par<'async_trait, T, U>( processor: Collector<T, U> ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + JsonRpcClient + Clone + Send + Sync, U: 'async_trait + Storage + Auth + Clone + Send + Sync, Self: 'async_trait,

Executes defined operations in a multi-threaded environment.

Available when the multi-thread feature is enabled. This method handles the concurrent processing of logs and blocks, leveraging asynchronous programming and task spawning for improved performance.

This method is only available when compiled with the multi-thread feature flag enabled.

Object Safety§

This trait is not object safe.

Implementors§