2021-09-30 14:26:17 -07:00
|
|
|
use {
|
2022-12-13 06:42:28 -08:00
|
|
|
crate::append_vec::StoredAccountMeta,
|
|
|
|
solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey, signature::Signature},
|
2021-09-30 14:26:17 -07:00
|
|
|
std::sync::{Arc, RwLock},
|
|
|
|
};
|
|
|
|
|
|
|
|
pub trait AccountsUpdateNotifierInterface: std::fmt::Debug {
|
|
|
|
/// Notified when an account is updated at runtime, due to transaction activities
|
2022-06-10 10:24:35 -07:00
|
|
|
fn notify_account_update(
|
|
|
|
&self,
|
|
|
|
slot: Slot,
|
|
|
|
account: &AccountSharedData,
|
|
|
|
txn_signature: &Option<&Signature>,
|
2022-12-13 06:42:28 -08:00
|
|
|
pubkey: &Pubkey,
|
|
|
|
write_version: u64,
|
2022-06-10 10:24:35 -07:00
|
|
|
);
|
2021-09-30 14:26:17 -07:00
|
|
|
|
|
|
|
/// Notified when the AccountsDb is initialized at start when restored
|
|
|
|
/// from a snapshot.
|
|
|
|
fn notify_account_restore_from_snapshot(&self, slot: Slot, account: &StoredAccountMeta);
|
|
|
|
|
2021-10-24 12:43:33 -07:00
|
|
|
/// Notified when all accounts have been notified when restoring from a snapshot.
|
|
|
|
fn notify_end_of_restore_from_snapshot(&self);
|
2021-09-30 14:26:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
pub type AccountsUpdateNotifier = Arc<RwLock<dyn AccountsUpdateNotifierInterface + Sync + Send>>;
|