Struct solana_runtime::accounts_db::AccountsDb
source[−]pub struct AccountsDb {Show 14 fields
pub accounts_index: AccountsIndex<AccountInfo>,
pub storage: AccountStorage,
pub accounts_cache: AccountsCache,
pub read_only_accounts_cache: ReadOnlyAccountsCache,
pub next_id: AtomicUsize,
pub shrink_candidate_slots: Mutex<HashMap<Slot, HashMap<AppendVecId, Arc<AccountStorageEntry>>>>,
pub shrink_candidate_slots_v1: Mutex<Vec<Slot>>,
pub shrink_paths: RwLock<Option<Vec<PathBuf>>>,
pub thread_pool: ThreadPool,
pub thread_pool_clean: ThreadPool,
pub bank_hashes: RwLock<HashMap<Slot, BankHashInfo>>,
pub cluster_type: Option<ClusterType>,
pub account_indexes: AccountSecondaryIndexes,
pub caching_enabled: bool,
/* private fields */
}
Fields
accounts_index: AccountsIndex<AccountInfo>
Keeps tracks of index into AppendVec on a per slot basis
storage: AccountStorage
accounts_cache: AccountsCache
read_only_accounts_cache: ReadOnlyAccountsCache
next_id: AtomicUsize
distribute the accounts across storage lists
shrink_candidate_slots: Mutex<HashMap<Slot, HashMap<AppendVecId, Arc<AccountStorageEntry>>>>
Set of shrinkable stores organized by map of slot to append_vec_id
shrink_candidate_slots_v1: Mutex<Vec<Slot>>
Legacy shrink slots to support non-cached code-path.
shrink_paths: RwLock<Option<Vec<PathBuf>>>
thread_pool: ThreadPool
Thread pool used for par_iter
thread_pool_clean: ThreadPool
bank_hashes: RwLock<HashMap<Slot, BankHashInfo>>
cluster_type: Option<ClusterType>
account_indexes: AccountSecondaryIndexes
caching_enabled: bool
Implementations
Notify the plugins of of account data when AccountsDb is restored from a snapshot. The data is streamed in the reverse order of the slots so that an account is only streamed once. At a slot, if the accounts is updated multiple times only the last write (with highest write_version) is notified.
pub fn notify_account_at_accounts_update(
&self,
slot: Slot,
meta: &StoredMeta,
account: &AccountSharedData
)
pub fn new_with_config(
paths: Vec<PathBuf>,
cluster_type: &ClusterType,
account_indexes: AccountSecondaryIndexes,
caching_enabled: bool,
shrink_ratio: AccountShrinkThreshold,
accounts_update_notifier: Option<AccountsUpdateNotifier>
) -> Self
pub fn scan_accounts<F, A>(
&self,
ancestors: &Ancestors,
bank_id: BankId,
scan_func: F
) -> ScanResult<A> where
F: Fn(&mut A, Option<(&Pubkey, AccountSharedData, Slot)>),
A: Default,
pub fn unchecked_scan_accounts<F, A>(
&self,
metric_name: &'static str,
ancestors: &Ancestors,
scan_func: F
) -> A where
F: Fn(&mut A, (&Pubkey, LoadedAccount<'_>, Slot)),
A: Default,
pub fn range_scan_accounts<F, A, R>(
&self,
metric_name: &'static str,
ancestors: &Ancestors,
range: R,
scan_func: F
) -> A where
F: Fn(&mut A, Option<(&Pubkey, AccountSharedData, Slot)>),
A: Default,
R: RangeBounds<Pubkey>,
pub fn index_scan_accounts<F, A>(
&self,
ancestors: &Ancestors,
bank_id: BankId,
index_key: IndexKey,
scan_func: F
) -> ScanResult<(A, bool)> where
F: Fn(&mut A, Option<(&Pubkey, AccountSharedData, Slot)>),
A: Default,
pub fn scan_account_storage<R, B>(
&self,
slot: Slot,
cache_map_func: impl Fn(LoadedAccount<'_>) -> Option<R> + Sync,
storage_scan_func: impl Fn(&B, LoadedAccount<'_>) + Sync
) -> ScanStorageResult<R, B> where
R: Send,
B: Send + Default + Sync,
pub fn scan_account_storage<R, B>(
&self,
slot: Slot,
cache_map_func: impl Fn(LoadedAccount<'_>) -> Option<R> + Sync,
storage_scan_func: impl Fn(&B, LoadedAccount<'_>) + Sync
) -> ScanStorageResult<R, B> where
R: Send,
B: Send + Default + Sync,
Scan a specific slot through all the account storage in parallel
pub fn load(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
load_hint: LoadHint
) -> Option<(AccountSharedData, Slot)>
pub fn load_with_fixed_root(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey
) -> Option<(AccountSharedData, Slot)>
pub fn load_without_fixed_root(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey
) -> Option<(AccountSharedData, Slot)>
pub fn load_account_hash(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
max_root: Option<Slot>,
load_hint: LoadHint
) -> Option<Hash>
pub fn create_drop_bank_callback(
&self,
pruned_banks_sender: DroppedSlotsSender
) -> SendDroppedBankCallback
This should only be called after the Bank::drop()
runs in bank.rs, See BANK_DROP_SAFETY
comment below for more explanation.
is_from_abs
is true if the caller is the AccountsBackgroundService
pub fn update_accounts_hash_with_index_option(
&self,
use_index: bool,
debug_verify: bool,
slot: Slot,
ancestors: &Ancestors,
expected_capitalization: Option<u64>,
can_cached_slot_be_unflushed: bool,
slots_per_epoch: Option<Slot>
) -> (Hash, u64)
pub fn calculate_accounts_hash_without_index(
storages: &SortedStorages<'_>,
thread_pool: Option<&ThreadPool>,
stats: HashStats,
check_hash: bool,
accounts_cache_and_ancestors: Option<(&AccountsCache, &Ancestors, &AccountsIndex<AccountInfo>)>
) -> Result<(Hash, u64), BankHashVerificationError>
pub fn verify_bank_hash_and_lamports(
&self,
slot: Slot,
ancestors: &Ancestors,
total_lamports: u64,
test_hash_calculation: bool
) -> Result<(), BankHashVerificationError>
Scan a slot in the account storage for dirty pubkeys and insert them into the list of uncleaned pubkeys
This function is called in Bank::drop() when the bank is not frozen, so that its pubkeys are considered for cleanup.
Store the account update.
pub fn get_snapshot_storages(
&self,
snapshot_slot: Slot,
ancestors: Option<&Ancestors>
) -> (SnapshotStorages, Vec<Slot>)
Legacy shrink functions to support non-cached path. Should be able to be deleted after cache path is the only path.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for AccountsDb
impl Send for AccountsDb
impl Sync for AccountsDb
impl Unpin for AccountsDb
impl !UnwindSafe for AccountsDb
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more