clone_solana_accounts_db/
accounts_update_notifier_interface.rs

1use {
2    crate::account_storage::meta::StoredAccountMeta,
3    clone_solana_pubkey::Pubkey,
4    clone_solana_sdk::{
5        account::AccountSharedData, clock::Slot, transaction::SanitizedTransaction,
6    },
7    std::sync::Arc,
8};
9
10pub trait AccountsUpdateNotifierInterface: std::fmt::Debug {
11    /// Enable account notifications from snapshot
12    fn snapshot_notifications_enabled(&self) -> bool;
13
14    /// Notified when an account is updated at runtime, due to transaction activities
15    fn notify_account_update(
16        &self,
17        slot: Slot,
18        account: &AccountSharedData,
19        txn: &Option<&SanitizedTransaction>,
20        pubkey: &Pubkey,
21        write_version: u64,
22    );
23
24    /// Notified when the AccountsDb is initialized at start when restored
25    /// from a snapshot.
26    fn notify_account_restore_from_snapshot(&self, slot: Slot, account: &StoredAccountMeta);
27
28    /// Notified when all accounts have been notified when restoring from a snapshot.
29    fn notify_end_of_restore_from_snapshot(&self);
30}
31
32pub type AccountsUpdateNotifier = Arc<dyn AccountsUpdateNotifierInterface + Sync + Send>;