pub struct BlockTracker<S> { /* private fields */ }
Expand description
BlockTracker is responsible for monitoring the sequence of processed blocks across different networks and identifying any gaps or irregularities in block processing.
It maintains a history of recently processed blocks for each network and can optionally persist information about missed blocks using the provided storage implementation.
§Type Parameters
S
- A type that implements theBlockStorage
trait for persisting missed block information
Trait Implementations§
Source§impl<S: BlockStorage> BlockTrackerTrait<S> for BlockTracker<S>
impl<S: BlockStorage> BlockTrackerTrait<S> for BlockTracker<S>
Source§fn record_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network: &'life1 Network,
block_number: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Records a processed block and identifies any gaps in block sequence.
This method performs several checks:
- Detects gaps between the last processed block and the current block
- Identifies out-of-order or duplicate blocks
- Stores information about missed blocks if storage is configured
§Arguments
network
- The network information for the processed blockblock_number
- The block number being recorded
§Warning
This method will log warnings for out-of-order blocks and errors for missed blocks.
Source§impl<S: Clone> Clone for BlockTracker<S>
impl<S: Clone> Clone for BlockTracker<S>
Source§fn clone(&self) -> BlockTracker<S>
fn clone(&self) -> BlockTracker<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<S> Freeze for BlockTracker<S>
impl<S> !RefUnwindSafe for BlockTracker<S>
impl<S> Send for BlockTracker<S>
impl<S> Sync for BlockTracker<S>
impl<S> Unpin for BlockTracker<S>
impl<S> !UnwindSafe for BlockTracker<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more