pub trait IntervalHandler: Send + Sync {
// Required methods
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
block: &'life1 BlockSummary,
ctx: &'life2 IndexContext,
) -> Pin<Box<dyn Future<Output = Result<(), IndexerError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn interval(&self) -> u64;
fn name(&self) -> &str;
}Expand description
Handler that fires every N blocks.
Useful for periodic tasks such as taking snapshots, computing aggregates, flushing caches, or emitting metrics at regular block intervals.
Required Methods§
Sourcefn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
block: &'life1 BlockSummary,
ctx: &'life2 IndexContext,
) -> Pin<Box<dyn Future<Output = Result<(), IndexerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
block: &'life1 BlockSummary,
ctx: &'life2 IndexContext,
) -> Pin<Box<dyn Future<Output = Result<(), IndexerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called every interval() blocks.
The handler receives the current block summary and indexing context. Returning an error will propagate up to the index loop.