Plugin

Trait Plugin 

Source
pub trait Plugin:
    Send
    + Sync
    + 'static {
    // Required method
    fn name(&self) -> &'static str;

    // Provided methods
    fn version(&self) -> u16 { ... }
    fn id(&self) -> u16 { ... }
    fn on_transaction<'a>(
        &'a self,
        _thread_id: usize,
        _db: Option<Arc<Client>>,
        _transaction: &'a TransactionData,
    ) -> PluginFuture<'a> { ... }
    fn on_block<'a>(
        &'a self,
        _thread_id: usize,
        _db: Option<Arc<Client>>,
        _block: &'a BlockData,
    ) -> PluginFuture<'a> { ... }
    fn on_entry<'a>(
        &'a self,
        _thread_id: usize,
        _db: Option<Arc<Client>>,
        _entry: &'a EntryData,
    ) -> PluginFuture<'a> { ... }
    fn on_reward<'a>(
        &'a self,
        _thread_id: usize,
        _db: Option<Arc<Client>>,
        _reward: &'a RewardsData,
    ) -> PluginFuture<'a> { ... }
    fn on_error<'a>(
        &'a self,
        _thread_id: usize,
        _db: Option<Arc<Client>>,
        _error: &'a FirehoseErrorContext,
    ) -> PluginFuture<'a> { ... }
    fn on_load(&self, _db: Option<Arc<Client>>) -> PluginFuture<'_> { ... }
    fn on_exit(&self, _db: Option<Arc<Client>>) -> PluginFuture<'_> { ... }
}
Expand description

Trait implemented by plugins that consume firehose events.

See the crate-level documentation for usage examples.

Required Methods§

Source

fn name(&self) -> &'static str

Human-friendly plugin name used in logs and persisted metadata.

Provided Methods§

Source

fn version(&self) -> u16

Semantic version for the plugin; defaults to 1.

Source

fn id(&self) -> u16

Deterministic identifier derived from Plugin::name.

Source

fn on_transaction<'a>( &'a self, _thread_id: usize, _db: Option<Arc<Client>>, _transaction: &'a TransactionData, ) -> PluginFuture<'a>

Called for every transaction seen by the firehose.

Source

fn on_block<'a>( &'a self, _thread_id: usize, _db: Option<Arc<Client>>, _block: &'a BlockData, ) -> PluginFuture<'a>

Called for every block observed by the firehose.

Source

fn on_entry<'a>( &'a self, _thread_id: usize, _db: Option<Arc<Client>>, _entry: &'a EntryData, ) -> PluginFuture<'a>

Called for every entry observed by the firehose when entry notifications are enabled.

Source

fn on_reward<'a>( &'a self, _thread_id: usize, _db: Option<Arc<Client>>, _reward: &'a RewardsData, ) -> PluginFuture<'a>

Called for reward updates associated with processed blocks.

Source

fn on_error<'a>( &'a self, _thread_id: usize, _db: Option<Arc<Client>>, _error: &'a FirehoseErrorContext, ) -> PluginFuture<'a>

Called whenever a firehose thread encounters an error before restarting.

Source

fn on_load(&self, _db: Option<Arc<Client>>) -> PluginFuture<'_>

Invoked once before the firehose starts streaming events.

Source

fn on_exit(&self, _db: Option<Arc<Client>>) -> PluginFuture<'_>

Invoked once after the firehose finishes or shuts down.

Implementors§