solana_runtime/
accounts_update_notifier_interface.rs

1use {
2    crate::append_vec::{StoredAccountMeta, StoredMeta},
3    solana_sdk::{account::AccountSharedData, clock::Slot, signature::Signature},
4    std::sync::{Arc, RwLock},
5};
6
7pub trait AccountsUpdateNotifierInterface: std::fmt::Debug {
8    /// Notified when an account is updated at runtime, due to transaction activities
9    fn notify_account_update(
10        &self,
11        slot: Slot,
12        meta: &StoredMeta,
13        account: &AccountSharedData,
14        txn_signature: &Option<&Signature>,
15    );
16
17    /// Notified when the AccountsDb is initialized at start when restored
18    /// from a snapshot.
19    fn notify_account_restore_from_snapshot(&self, slot: Slot, account: &StoredAccountMeta);
20
21    /// Notified when all accounts have been notified when restoring from a snapshot.
22    fn notify_end_of_restore_from_snapshot(&self);
23}
24
25pub type AccountsUpdateNotifier = Arc<RwLock<dyn AccountsUpdateNotifierInterface + Sync + Send>>;