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§
Provided Methods§
Sourcefn id(&self) -> u16
fn id(&self) -> u16
Deterministic identifier derived from Plugin::name.
Sourcefn on_transaction<'a>(
&'a self,
_thread_id: usize,
_db: Option<Arc<Client>>,
_transaction: &'a TransactionData,
) -> PluginFuture<'a>
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.
Sourcefn on_block<'a>(
&'a self,
_thread_id: usize,
_db: Option<Arc<Client>>,
_block: &'a BlockData,
) -> PluginFuture<'a>
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.
Sourcefn on_entry<'a>(
&'a self,
_thread_id: usize,
_db: Option<Arc<Client>>,
_entry: &'a EntryData,
) -> PluginFuture<'a>
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.
Sourcefn on_reward<'a>(
&'a self,
_thread_id: usize,
_db: Option<Arc<Client>>,
_reward: &'a RewardsData,
) -> PluginFuture<'a>
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.
Sourcefn on_error<'a>(
&'a self,
_thread_id: usize,
_db: Option<Arc<Client>>,
_error: &'a FirehoseErrorContext,
) -> PluginFuture<'a>
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.