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

    // Provided methods
    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 an AccountsDb plugin, to stream data from the runtime. AccountsDb plugins must describe desired behavior for load and unload, as well as how they will handle streamed data.

Required Methods§

Source

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

Provided Methods§

Source

fn on_load(&mut self, _config_file: &str) -> Result<()>

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.

Source

fn on_unload(&mut self)

The callback called right before a plugin is unloaded by the system Used for doing cleanup before unload.

Source

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.

Source

fn notify_end_of_startup(&mut self) -> Result<()>

Called when all accounts are notified of during startup.

Source

fn update_slot_status( &mut self, slot: u64, parent: Option<u64>, status: SlotStatus, ) -> Result<()>

Called when a slot status is updated

Source

fn notify_transaction( &mut self, transaction: ReplicaTransactionInfoVersions<'_>, slot: u64, ) -> Result<()>

Called when a transaction is updated at a slot.

Source

fn notify_block_metadata( &mut self, blockinfo: ReplicaBlockInfoVersions<'_>, ) -> Result<()>

Called when block’s metadata is updated.

Source

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.

Source

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.

Implementors§