Trait solana_accountsdb_plugin_interface::accountsdb_plugin_interface::AccountsDbPlugin [−][src]
pub trait AccountsDbPlugin: Any + Send + Sync + Debug {
fn name(&self) -> &'static str;
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 on_load(&mut self, _config_file: &str) -> Result<()> { ... }
fn on_unload(&mut self) { ... }
}
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
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
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.