Skip to main content

SetupHandler

Trait SetupHandler 

Source
pub trait SetupHandler: Send + Sync {
    // Required methods
    fn setup<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 IndexContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), IndexerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &str;
}
Expand description

Handler that fires once before indexing starts.

Use this for one-time initialization tasks such as creating database tables, registering metrics, or loading reference data.

Required Methods§

Source

fn setup<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 IndexContext, ) -> Pin<Box<dyn Future<Output = Result<(), IndexerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called once during indexer initialization, before any blocks are processed.

The context contains the starting block information.

Source

fn name(&self) -> &str

Human-readable handler name for logging and diagnostics.

Implementors§