Trait BlockTrackerTrait

Source
pub trait BlockTrackerTrait {
    // Required methods
    fn new(history_size: usize) -> Self;
    fn get_last_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network_slug: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn detect_missing_blocks<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        network: &'life1 Network,
        fetched_blocks: &'life2 [BlockType],
    ) -> Pin<Box<dyn Future<Output = Vec<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn check_processed_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network: &'life1 Network,
        block_number: u64,
    ) -> Pin<Box<dyn Future<Output = BlockCheckResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reset_expected_next<'life0, 'life1, 'async_trait>(
        &'life0 self,
        network: &'life1 Network,
        start_block: u64,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for the BlockTracker

This trait defines the interface for the BlockTracker.

Required Methods§

Source

fn new(history_size: usize) -> Self

Source

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

Source

fn detect_missing_blocks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, network: &'life1 Network, fetched_blocks: &'life2 [BlockType], ) -> Pin<Box<dyn Future<Output = Vec<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Detects missing blocks in a batch of fetched blocks

Takes the entire fetched block set, detects gaps using optimized min/max approach, records all fetched blocks to history in batch, and returns list of missed block numbers.

Source

fn check_processed_block<'life0, 'life1, 'async_trait>( &'life0 self, network: &'life1 Network, block_number: u64, ) -> Pin<Box<dyn Future<Output = BlockCheckResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks a processed block for duplicates or out-of-order issues

Tracks processed sequence separately from fetched sequence, detects duplicates and out-of-order blocks, and returns result enum.

Source

fn reset_expected_next<'life0, 'life1, 'async_trait>( &'life0 self, network: &'life1 Network, start_block: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resets the expected next block number for a network to a new starting point. This should be called at the start of each process_new_blocks execution to synchronize expected_next with the start_block.

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§