Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler: Send + Sync {
    // Required methods
    fn handle<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        event: &'life1 DecodedEvent,
        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 schema_name(&self) -> &str;
}
Expand description

Trait for user-provided event handlers.

Implement this to process specific event types during indexing.

Required Methods§

Source

fn handle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, event: &'life1 DecodedEvent, 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 for each decoded event that matches the handler’s schema.

Source

fn schema_name(&self) -> &str

The event schema name this handler processes (e.g. "ERC20Transfer").

Implementors§