pub trait GeyserPlugin: Any + Send + Sync + Debug {
fn name(&self) -> &'static str;
fn on_load(&mut self, _config_file: &str) -> Result<()> { ... }
fn on_unload(&mut self) { ... }
fn update_account(
&mut self,
account: ReplicaAccountInfoVersions<'_>,
slot: u64,
is_startup: bool
) -> Result<()> { ... }
fn notify_end_of_startup(&mut self) -> Result<()> { ... }
fn update_slot_status(
&mut self,
slot: u64,
parent: Option<u64>,
status: SlotStatus
) -> Result<()> { ... }
fn notify_transaction(
&mut self,
transaction: ReplicaTransactionInfoVersions<'_>,
slot: u64
) -> Result<()> { ... }
fn notify_block_metadata(
&mut self,
blockinfo: ReplicaBlockInfoVersions<'_>
) -> Result<()> { ... }
fn account_data_notifications_enabled(&self) -> bool { ... }
fn transaction_notifications_enabled(&self) -> bool { ... }
}
Expand description
Defines a Geyser plugin, to stream data from the runtime. Geyser plugins must describe desired behavior for load and unload, as well as how they will handle streamed data.
Required Methods
Provided Methods
The callback called when a plugin is loaded by the system, used for doing whatever initialization is required by the plugin. The _config_file contains the name of the of the config file. The config must be in JSON format and include a field “libpath” indicating the full path name of the shared library implementing this interface.
The callback called right before a plugin is unloaded by the system Used for doing cleanup before unload.
fn update_account(
&mut self,
account: ReplicaAccountInfoVersions<'_>,
slot: u64,
is_startup: bool
) -> Result<()>
fn update_account(
&mut self,
account: ReplicaAccountInfoVersions<'_>,
slot: u64,
is_startup: bool
) -> Result<()>
Called when an account is updated at a slot.
When is_startup
is true, it indicates the account is loaded from
snapshots when the validator starts up. When is_startup
is false,
the account is updated during transaction processing.
fn notify_end_of_startup(&mut self) -> Result<()>
fn notify_end_of_startup(&mut self) -> Result<()>
Called when all accounts are notified of during startup.
fn update_slot_status(
&mut self,
slot: u64,
parent: Option<u64>,
status: SlotStatus
) -> Result<()>
fn update_slot_status(
&mut self,
slot: u64,
parent: Option<u64>,
status: SlotStatus
) -> Result<()>
Called when a slot status is updated
fn notify_transaction(
&mut self,
transaction: ReplicaTransactionInfoVersions<'_>,
slot: u64
) -> Result<()>
fn notify_transaction(
&mut self,
transaction: ReplicaTransactionInfoVersions<'_>,
slot: u64
) -> Result<()>
Called when a transaction is updated at a slot.
fn notify_block_metadata(
&mut self,
blockinfo: ReplicaBlockInfoVersions<'_>
) -> Result<()>
fn notify_block_metadata(
&mut self,
blockinfo: ReplicaBlockInfoVersions<'_>
) -> Result<()>
Called when block’s metadata is updated.
fn account_data_notifications_enabled(&self) -> bool
fn account_data_notifications_enabled(&self) -> bool
Check if the plugin is interested in account data Default is true – if the plugin is not interested in account data, please return false.
fn transaction_notifications_enabled(&self) -> bool
fn transaction_notifications_enabled(&self) -> bool
Check if the plugin is interested in transaction data Default is false – if the plugin is not interested in transaction data, please return false.