pub struct HandlerRegistry { /* private fields */ }Expand description
Registry of event + block + reorg handlers.
Implementations§
Source§impl HandlerRegistry
impl HandlerRegistry
pub fn new() -> Self
Sourcepub fn on_event(&mut self, handler: Arc<dyn EventHandler>)
pub fn on_event(&mut self, handler: Arc<dyn EventHandler>)
Register an event handler for a specific schema name.
Sourcepub fn on_block(&mut self, handler: Arc<dyn BlockHandler>)
pub fn on_block(&mut self, handler: Arc<dyn BlockHandler>)
Register a block handler (called for every block).
Sourcepub fn on_reorg(&mut self, handler: Arc<dyn ReorgHandler>)
pub fn on_reorg(&mut self, handler: Arc<dyn ReorgHandler>)
Register a reorg handler.
Sourcepub async fn dispatch_event(
&self,
event: &DecodedEvent,
ctx: &IndexContext,
) -> Result<(), IndexerError>
pub async fn dispatch_event( &self, event: &DecodedEvent, ctx: &IndexContext, ) -> Result<(), IndexerError>
Dispatch an event to all matching handlers.
Sourcepub async fn dispatch_block(
&self,
block: &BlockSummary,
ctx: &IndexContext,
) -> Result<(), IndexerError>
pub async fn dispatch_block( &self, block: &BlockSummary, ctx: &IndexContext, ) -> Result<(), IndexerError>
Dispatch a block to all block handlers.
Sourcepub async fn dispatch_reorg(
&self,
dropped: &[BlockSummary],
ctx: &IndexContext,
) -> Result<(), IndexerError>
pub async fn dispatch_reorg( &self, dropped: &[BlockSummary], ctx: &IndexContext, ) -> Result<(), IndexerError>
Dispatch a reorg event to all reorg handlers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HandlerRegistry
impl !RefUnwindSafe for HandlerRegistry
impl Send for HandlerRegistry
impl Sync for HandlerRegistry
impl Unpin for HandlerRegistry
impl UnsafeUnpin for HandlerRegistry
impl !UnwindSafe for HandlerRegistry
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