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: AtomicUsizedistribute 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: ThreadPoolThread pool used for par_iter
thread_pool_clean: ThreadPool§bank_hashes: RwLock<HashMap<Slot, BankHashInfo>>§cluster_type: Option<ClusterType>§account_indexes: AccountSecondaryIndexes§caching_enabled: boolImplementations§
Source§impl AccountsDb
impl AccountsDb
pub fn default_for_tests() -> Self
pub fn new_for_tests(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self
pub fn new_with_config( paths: Vec<PathBuf>, cluster_type: &ClusterType, account_indexes: AccountSecondaryIndexes, caching_enabled: bool, shrink_ratio: AccountShrinkThreshold, accounts_db_config: Option<AccountsDbConfig>, ) -> Self
pub fn set_shrink_paths(&self, paths: Vec<PathBuf>)
pub fn file_size(&self) -> u64
pub fn new_single_for_tests() -> Self
pub fn expected_cluster_type(&self) -> ClusterType
pub fn clean_accounts( &self, max_clean_root: Option<Slot>, is_startup: bool, last_full_snapshot_slot: Option<Slot>, )
pub fn shrink_candidate_slots(&self) -> usize
pub fn shrink_all_slots( &self, is_startup: bool, last_full_snapshot_slot: Option<Slot>, )
pub fn scan_accounts<F, A>( &self, ancestors: &Ancestors, bank_id: BankId, scan_func: F, ) -> ScanResult<A>
pub fn unchecked_scan_accounts<F, A>( &self, metric_name: &'static str, ancestors: &Ancestors, scan_func: F, collect_all_unsorted: bool, ) -> A
pub fn range_scan_accounts<F, A, R>(
&self,
metric_name: &'static str,
ancestors: &Ancestors,
range: R,
collect_all_unsorted: bool,
scan_func: F,
) -> Awhere
F: Fn(&mut A, Option<(&Pubkey, AccountSharedData, Slot)>),
A: Default,
R: RangeBounds<Pubkey> + Debug,
pub fn index_scan_accounts<F, A>( &self, ancestors: &Ancestors, bank_id: BankId, index_key: IndexKey, scan_func: F, ) -> ScanResult<(A, bool)>
Sourcepub 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>
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>
Scan a specific slot through all the account storage in parallel
pub fn set_hash(&self, slot: Slot, parent_slot: Slot)
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
Sourcepub fn purge_slot(&self, slot: Slot, bank_id: BankId, is_from_abs: bool)
pub fn purge_slot(&self, slot: Slot, bank_id: BankId, is_from_abs: bool)
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 remove_unrooted_slots(&self, remove_slots: &[(Slot, BankId)])
pub fn hash_stored_account(slot: Slot, account: &StoredAccountMeta<'_>) -> Hash
pub fn hash_account<T: ReadableAccount>( slot: Slot, account: &T, pubkey: &Pubkey, ) -> Hash
pub fn mark_slot_frozen(&self, slot: Slot)
pub fn expire_old_recycle_stores(&self)
pub fn flush_accounts_cache_slot(&self, slot: Slot)
pub fn flush_accounts_cache( &self, force_flush: bool, requested_flush_root: Option<Slot>, )
pub fn checked_iterative_sum_for_capitalization( total_cap: u64, new_cap: u64, ) -> u64
pub fn checked_sum_for_capitalization<T: Iterator<Item = u64>>( balances: T, ) -> u64
pub fn get_accounts_hash(&self, slot: Slot) -> Hash
pub fn update_accounts_hash( &self, slot: Slot, ancestors: &Ancestors, ) -> (Hash, u64)
pub fn update_accounts_hash_test( &self, slot: Slot, ancestors: &Ancestors, ) -> (Hash, u64)
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( accounts_hash_cache_path: &Path, 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_carats( &self, slot: Slot, ancestors: &Ancestors, total_carats: u64, test_hash_calculation: bool, ) -> Result<(), BankHashVerificationError>
Sourcepub fn scan_slot_and_insert_dirty_pubkeys_into_uncleaned_pubkeys(
&self,
slot: Slot,
)
pub fn scan_slot_and_insert_dirty_pubkeys_into_uncleaned_pubkeys( &self, slot: Slot, )
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.
pub fn get_accounts_delta_hash(&self, slot: Slot) -> Hash
pub fn store_cached( &self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)], )
Sourcepub fn store_uncached(
&self,
slot: Slot,
accounts: &[(&Pubkey, &AccountSharedData)],
)
pub fn store_uncached( &self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)], )
Store the account update.
pub fn add_root(&self, slot: Slot)
pub fn get_snapshot_storages( &self, snapshot_slot: Slot, snapshot_base_slot: Option<Slot>, ancestors: Option<&Ancestors>, ) -> (SnapshotStorages, Vec<Slot>)
pub fn generate_index( &self, limit_load_slot_count_from_snapshot: Option<usize>, verify: bool, )
Source§impl AccountsDb
Legacy shrink functions to support non-cached path.
Should be able to be deleted after cache path is the only path.
impl AccountsDb
Legacy shrink functions to support non-cached path. Should be able to be deleted after cache path is the only path.
pub fn process_stale_slot_v1(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AccountsDb
impl !RefUnwindSafe for AccountsDb
impl Send for AccountsDb
impl Sync for AccountsDb
impl Unpin for AccountsDb
impl !UnwindSafe for AccountsDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more