pub struct AccountsDb {Show 22 fields
pub accounts_index: AccountsIndex<AccountInfo, AccountInfo>,
pub ancient_append_vec_offset: Option<i64>,
pub skip_initial_hash_calc: bool,
pub storage: AccountStorage,
pub test_skip_rewrites_but_include_in_bank_hash: bool,
pub accounts_cache: AccountsCache,
pub next_id: AtomicAccountsFileId,
pub shrink_candidate_slots: Mutex<IntSet<Slot>>,
pub write_version: AtomicU64,
pub paths: Vec<PathBuf>,
pub temp_paths: Option<Vec<TempDir>>,
pub thread_pool: ThreadPool,
pub thread_pool_clean: ThreadPool,
pub thread_pool_hash: ThreadPool,
pub stats: AccountsStats,
pub shrink_stats: ShrinkStats,
pub account_indexes: AccountSecondaryIndexes,
pub verify_accounts_hash_in_bg: VerifyAccountsHashInBackground,
pub log_dead_slots: AtomicBool,
pub partitioned_epoch_rewards_config: PartitionedEpochRewardsConfig,
pub epoch_accounts_hash_manager: EpochAccountsHashManager,
pub is_experimental_accumulator_hash_enabled: AtomicBool,
/* private fields */
}
Fields§
§accounts_index: AccountsIndex<AccountInfo, AccountInfo>
Keeps tracks of index into AppendVec on a per slot basis
ancient_append_vec_offset: Option<i64>
Some(offset) iff we want to squash old append vecs together into ‘ancient append vecs’ Some(offset) means for slots up to (max_slot - (slots_per_epoch - ‘offset’)), put them in ancient append vecs
skip_initial_hash_calc: bool
true iff we want to skip the initial hash calculation on startup
storage: AccountStorage
§test_skip_rewrites_but_include_in_bank_hash: bool
true if this client should skip rewrites but still include those rewrites in the bank hash as if rewrites had occurred.
accounts_cache: AccountsCache
§next_id: AtomicAccountsFileId
distribute the accounts across storage lists
shrink_candidate_slots: Mutex<IntSet<Slot>>
Set of shrinkable stores organized by map of slot to storage id
write_version: AtomicU64
§paths: Vec<PathBuf>
Set of storage paths to pick from
temp_paths: Option<Vec<TempDir>>
Directory of paths this accounts_db needs to hold/remove
thread_pool: ThreadPool
Thread pool used for par_iter
thread_pool_clean: ThreadPool
§thread_pool_hash: ThreadPool
§stats: AccountsStats
§shrink_stats: ShrinkStats
§account_indexes: AccountSecondaryIndexes
§verify_accounts_hash_in_bg: VerifyAccountsHashInBackground
§log_dead_slots: AtomicBool
Used to disable logging dead slots during removal. allow disabling noisy log
partitioned_epoch_rewards_config: PartitionedEpochRewardsConfig
this will live here until the feature for partitioned epoch rewards is activated. At that point, this and other code can be deleted.
epoch_accounts_hash_manager: EpochAccountsHashManager
the full accounts hash calculation as of a predetermined block height ‘N’ to be included in the bank hash at a predetermined block height ‘M’ The cadence is once per epoch, all nodes calculate a full accounts hash as of a known slot calculated using ‘N’ Some time later (to allow for slow calculation time), the bank hash at a slot calculated using ‘M’ includes the full accounts hash. Thus, the state of all accounts on a validator is known to be correct at least once per epoch.
is_experimental_accumulator_hash_enabled: AtomicBool
Flag to indicate if the experimental accounts lattice hash is enabled. (For R&D only; a feature-gate also exists to turn this on and make it a part of consensus.)
Implementations§
Source§impl AccountsDb
impl AccountsDb
Sourcepub fn notify_account_restore_from_snapshot(&self)
pub fn notify_account_restore_from_snapshot(&self)
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, account: &AccountSharedData, txn: &Option<&SanitizedTransaction>, pubkey: &Pubkey, write_version: u64, )
Source§impl AccountsDb
impl AccountsDb
pub const DEFAULT_ACCOUNTS_HASH_CACHE_DIR: &'static str = "accounts_hash_cache"
pub fn default_for_tests() -> Self
pub fn new_single_for_tests() -> Self
pub fn new_single_for_tests_with_provider( file_provider: AccountsFileProvider, ) -> Self
pub fn new_for_tests(paths: Vec<PathBuf>) -> Self
pub fn new_with_config( paths: Vec<PathBuf>, accounts_db_config: Option<AccountsDbConfig>, accounts_update_notifier: Option<AccountsUpdateNotifier>, exit: Arc<AtomicBool>, ) -> Self
pub fn file_size(&self) -> u64
Sourcepub fn get_base_working_path(&self) -> PathBuf
pub fn get_base_working_path(&self) -> PathBuf
Get the base working directory
Sourcepub fn has_accounts_update_notifier(&self) -> bool
pub fn has_accounts_update_notifier(&self) -> bool
Returns true if there is an accounts update notifier.
Sourcepub fn is_experimental_accumulator_hash_enabled(&self) -> bool
pub fn is_experimental_accumulator_hash_enabled(&self) -> bool
Returns if the experimental accounts lattice hash is enabled
Sourcepub fn set_is_experimental_accumulator_hash_enabled(&self, is_enabled: bool)
pub fn set_is_experimental_accumulator_hash_enabled(&self, is_enabled: bool)
Sets if the experimental accounts lattice hash is enabled
pub fn purge_keys_exact<'a, C>( &'a self, pubkey_to_slot_set: impl Iterator<Item = &'a (Pubkey, C)>, ) -> (Vec<(Slot, AccountInfo)>, HashSet<Pubkey>)
Sourcepub fn clean_accounts_for_tests(&self)
pub fn clean_accounts_for_tests(&self)
Call clean_accounts() with the common parameters that tests/benches use.
pub fn clean_accounts( &self, max_clean_root_inclusive: Option<Slot>, is_startup: bool, epoch_schedule: &EpochSchedule, old_storages_policy: OldStoragesPolicy, )
Sourcepub fn get_unique_accounts_from_storage(
&self,
store: &AccountStorageEntry,
) -> GetUniqueAccountsResult
pub fn get_unique_accounts_from_storage( &self, store: &AccountStorageEntry, ) -> GetUniqueAccountsResult
get all accounts in all the storages passed in for duplicate pubkeys, the account with the highest write_value is returned
Sourcepub fn mark_dirty_dead_stores(
&self,
slot: Slot,
add_dirty_stores: bool,
shrink_in_progress: Option<ShrinkInProgress<'_>>,
shrink_can_be_active: bool,
) -> Vec<Arc<AccountStorageEntry>>
pub fn mark_dirty_dead_stores( &self, slot: Slot, add_dirty_stores: bool, shrink_in_progress: Option<ShrinkInProgress<'_>>, shrink_can_be_active: bool, ) -> Vec<Arc<AccountStorageEntry>>
get stores for ‘slot’
Drop ‘shrink_in_progress’, which will cause the old store to be removed from the storage map.
For ‘shrink_in_progress’.‘old_storage’ which is not retained, insert in ‘dead_storages’ and optionally ‘dirty_stores’
This is the end of the life cycle of shrink_in_progress
.
Sourcepub fn get_store_for_shrink(
&self,
slot: Slot,
size: u64,
) -> ShrinkInProgress<'_>
pub fn get_store_for_shrink( &self, slot: Slot, size: u64, ) -> ShrinkInProgress<'_>
return a store that can contain ‘size’ bytes
Sourcepub fn shrink_ancient_slots(&self, epoch_schedule: &EpochSchedule)
pub fn shrink_ancient_slots(&self, epoch_schedule: &EpochSchedule)
get a sorted list of slots older than an epoch squash those slots into ancient append vecs
pub fn shrink_candidate_slots(&self, epoch_schedule: &EpochSchedule) -> usize
Sourcepub fn shrink_all_slots(
&self,
is_startup: bool,
epoch_schedule: &EpochSchedule,
newest_slot_skip_shrink_inclusive: Option<Slot>,
)
pub fn shrink_all_slots( &self, is_startup: bool, epoch_schedule: &EpochSchedule, newest_slot_skip_shrink_inclusive: Option<Slot>, )
This is only called at startup from bank when we are being extra careful such as when we downloaded a snapshot.
Also called from tests.
newest_slot_skip_shrink_inclusive
is used to avoid shrinking the slot we are loading a snapshot from. If we shrink that slot, we affect
the bank hash calculation verification at startup.
pub fn scan_accounts<F>( &self, ancestors: &Ancestors, bank_id: BankId, scan_func: F, config: &ScanConfig, ) -> ScanResult<()>
pub fn unchecked_scan_accounts<F>( &self, metric_name: &'static str, ancestors: &Ancestors, scan_func: F, config: &ScanConfig, )
Sourcepub fn range_scan_accounts<F, R>(
&self,
metric_name: &'static str,
ancestors: &Ancestors,
range: R,
config: &ScanConfig,
scan_func: F,
)
pub fn range_scan_accounts<F, R>( &self, metric_name: &'static str, ancestors: &Ancestors, range: R, config: &ScanConfig, scan_func: F, )
Only guaranteed to be safe when called from rent collection
pub fn index_scan_accounts<F>( &self, ancestors: &Ancestors, bank_id: BankId, index_key: IndexKey, scan_func: F, config: &ScanConfig, ) -> ScanResult<bool>
Sourcepub fn insert_default_bank_hash_stats(&self, slot: Slot, parent_slot: Slot)
pub fn insert_default_bank_hash_stats(&self, slot: Slot, parent_slot: Slot)
Insert a default bank hash stats for slot
This fn is called when creating a new bank from parent.
pub fn load( &self, ancestors: &Ancestors, pubkey: &Pubkey, load_hint: LoadHint, ) -> Option<(AccountSharedData, Slot)>
Sourcepub fn account_matches_owners(
&self,
ancestors: &Ancestors,
account: &Pubkey,
owners: &[Pubkey],
) -> Result<usize, MatchAccountOwnerError>
pub fn account_matches_owners( &self, ancestors: &Ancestors, account: &Pubkey, owners: &[Pubkey], ) -> Result<usize, MatchAccountOwnerError>
Return Ok(index_of_matching_owner) if the account owner at offset
is one of the pubkeys in owners
.
Return Err(MatchAccountOwnerError::NoMatch) if the account has 0 lamports or the owner is not one of
the pubkeys in owners
.
Return Err(MatchAccountOwnerError::UnableToLoad) if the account could not be accessed.
Sourcepub fn load_account_into_read_cache(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
)
pub fn load_account_into_read_cache( &self, ancestors: &Ancestors, pubkey: &Pubkey, )
load the account with pubkey
into the read only accounts cache.
The goal is to make subsequent loads (which caller expects to occur) to find the account quickly.
Sourcepub fn load_with_fixed_root(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
) -> Option<(AccountSharedData, Slot)>
pub fn load_with_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>
note this returns None for accounts with zero lamports
Sourcepub fn load_account_with(
&self,
ancestors: &Ancestors,
pubkey: &Pubkey,
should_put_in_read_cache_fn: impl Fn(&AccountSharedData) -> bool,
) -> Option<(AccountSharedData, Slot)>
pub fn load_account_with( &self, ancestors: &Ancestors, pubkey: &Pubkey, should_put_in_read_cache_fn: impl Fn(&AccountSharedData) -> bool, ) -> Option<(AccountSharedData, Slot)>
Load account with pubkey
and maybe put into read cache.
If the account is not already cached, invoke should_put_in_read_cache_fn
.
The caller can inspect the account and indicate if it should be put into the read cache or not.
Return the account and the slot when the account was last stored. Return None for ZeroLamport accounts.
pub fn load_account_hash( &self, ancestors: &Ancestors, pubkey: &Pubkey, max_root: Option<Slot>, load_hint: LoadHint, ) -> Option<AccountHash>
pub fn enable_bank_drop_callback(&self)
Sourcepub fn purge_slot(
&self,
slot: Slot,
bank_id: BankId,
is_serialized_with_abs: bool,
)
pub fn purge_slot( &self, slot: Slot, bank_id: BankId, is_serialized_with_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_serialized_with_abs
- indicates whether this call runs sequentially with all other accounts_db relevant calls, such as shrinking, purging etc., in account background service.
Sourcepub fn purge_slots_from_cache_and_store<'a>(
&self,
removed_slots: impl Iterator<Item = &'a Slot> + Clone,
purge_stats: &PurgeStats,
log_accounts: bool,
)
pub fn purge_slots_from_cache_and_store<'a>( &self, removed_slots: impl Iterator<Item = &'a Slot> + Clone, purge_stats: &PurgeStats, log_accounts: bool, )
Purges every slot in removed_slots
from both the cache and storage. This includes
entries in the accounts index, cache entries, and any backing storage entries.
pub fn remove_unrooted_slots(&self, remove_slots: &[(Slot, BankId)])
Sourcepub fn lt_hash_account(
account: &impl ReadableAccount,
pubkey: &Pubkey,
) -> AccountLtHash
pub fn lt_hash_account( account: &impl ReadableAccount, pubkey: &Pubkey, ) -> AccountLtHash
Calculates the AccountLtHash
of account
Sourcepub fn hash_account<T: ReadableAccount>(
account: &T,
pubkey: &Pubkey,
) -> AccountHash
pub fn hash_account<T: ReadableAccount>( account: &T, pubkey: &Pubkey, ) -> AccountHash
Calculates the AccountHash
of account
pub fn mark_slot_frozen(&self, slot: Slot)
pub fn flush_accounts_cache( &self, force_flush: bool, requested_flush_root: Option<Slot>, )
pub fn checked_sum_for_capitalization<T: Iterator<Item = u64>>( balances: T, ) -> u64
pub fn calculate_accounts_hash_from_index( &self, max_slot: Slot, config: &CalcAccountsHashConfig<'_>, ) -> (AccountsHash, u64)
Sourcepub fn calculate_accounts_lt_hash_at_startup_from_index(
&self,
ancestors: &Ancestors,
startup_slot: Slot,
) -> AccountsLtHash
pub fn calculate_accounts_lt_hash_at_startup_from_index( &self, ancestors: &Ancestors, startup_slot: Slot, ) -> AccountsLtHash
Calculates the accounts lt hash
Only intended to be called at startup (or by tests). Only intended to be used while testing the experimental accumulator hash.
Sourcepub fn calculate_accounts_lt_hash_at_startup_from_storages(
&self,
storages: &[Arc<AccountStorageEntry>],
duplicates_lt_hash: &DuplicatesLtHash,
) -> AccountsLtHash
pub fn calculate_accounts_lt_hash_at_startup_from_storages( &self, storages: &[Arc<AccountStorageEntry>], duplicates_lt_hash: &DuplicatesLtHash, ) -> AccountsLtHash
Calculates the accounts lt hash
Intended to be used to verify the accounts lt hash at startup.
The duplicates_lt_hash
is the old/duplicate accounts to mix out of the storages.
This value comes from index generation.
Sourcepub fn update_accounts_hash_for_tests(
&self,
slot: Slot,
ancestors: &Ancestors,
debug_verify: bool,
is_startup: bool,
) -> (AccountsHash, u64)
pub fn update_accounts_hash_for_tests( &self, slot: Slot, ancestors: &Ancestors, debug_verify: bool, is_startup: bool, ) -> (AccountsHash, u64)
This is only valid to call from tests. run the accounts hash calculation and store the results
pub fn calculate_accounts_hash_from( &self, data_source: CalcAccountsHashDataSource, slot: Slot, config: &CalcAccountsHashConfig<'_>, ) -> (AccountsHash, u64)
Sourcepub fn update_accounts_hash_with_verify_from(
&self,
data_source: CalcAccountsHashDataSource,
debug_verify: bool,
slot: Slot,
ancestors: &Ancestors,
expected_capitalization: Option<u64>,
epoch_schedule: &EpochSchedule,
rent_collector: &RentCollector,
is_startup: bool,
) -> (AccountsHash, u64)
pub fn update_accounts_hash_with_verify_from( &self, data_source: CalcAccountsHashDataSource, debug_verify: bool, slot: Slot, ancestors: &Ancestors, expected_capitalization: Option<u64>, epoch_schedule: &EpochSchedule, rent_collector: &RentCollector, is_startup: bool, ) -> (AccountsHash, u64)
run the accounts hash calculation and store the results
Sourcepub fn update_accounts_hash(
&self,
config: &CalcAccountsHashConfig<'_>,
storages: &SortedStorages<'_>,
slot: Slot,
stats: HashStats,
) -> (AccountsHash, u64)
pub fn update_accounts_hash( &self, config: &CalcAccountsHashConfig<'_>, storages: &SortedStorages<'_>, slot: Slot, stats: HashStats, ) -> (AccountsHash, u64)
Calculate the full accounts hash for storages
and save the results at slot
Sourcepub fn update_incremental_accounts_hash(
&self,
config: &CalcAccountsHashConfig<'_>,
storages: &SortedStorages<'_>,
slot: Slot,
stats: HashStats,
) -> (IncrementalAccountsHash, u64)
pub fn update_incremental_accounts_hash( &self, config: &CalcAccountsHashConfig<'_>, storages: &SortedStorages<'_>, slot: Slot, stats: HashStats, ) -> (IncrementalAccountsHash, u64)
Calculate the incremental accounts hash for storages
and save the results at slot
Sourcepub fn set_accounts_hash_from_snapshot(
&mut self,
slot: Slot,
accounts_hash: SerdeAccountsHash,
capitalization: u64,
) -> Option<(AccountsHash, u64)>
pub fn set_accounts_hash_from_snapshot( &mut self, slot: Slot, accounts_hash: SerdeAccountsHash, capitalization: u64, ) -> Option<(AccountsHash, u64)>
After deserializing a snapshot, set the accounts hash for the new AccountsDb
Sourcepub fn get_accounts_hash(&self, slot: Slot) -> Option<(AccountsHash, u64)>
pub fn get_accounts_hash(&self, slot: Slot) -> Option<(AccountsHash, u64)>
Get the accounts hash for slot
Sourcepub fn get_accounts_hashes(&self) -> HashMap<Slot, (AccountsHash, u64)>
pub fn get_accounts_hashes(&self) -> HashMap<Slot, (AccountsHash, u64)>
Get all accounts hashes
Sourcepub fn set_incremental_accounts_hash(
&self,
slot: Slot,
incremental_accounts_hash: (IncrementalAccountsHash, u64),
) -> Option<(IncrementalAccountsHash, u64)>
pub fn set_incremental_accounts_hash( &self, slot: Slot, incremental_accounts_hash: (IncrementalAccountsHash, u64), ) -> Option<(IncrementalAccountsHash, u64)>
Set the incremental accounts hash for slot
returns the previous incremental accounts hash for slot
Sourcepub fn set_incremental_accounts_hash_from_snapshot(
&mut self,
slot: Slot,
incremental_accounts_hash: SerdeIncrementalAccountsHash,
capitalization: u64,
) -> Option<(IncrementalAccountsHash, u64)>
pub fn set_incremental_accounts_hash_from_snapshot( &mut self, slot: Slot, incremental_accounts_hash: SerdeIncrementalAccountsHash, capitalization: u64, ) -> Option<(IncrementalAccountsHash, u64)>
After deserializing a snapshot, set the incremental accounts hash for the new AccountsDb
Sourcepub fn get_incremental_accounts_hash(
&self,
slot: Slot,
) -> Option<(IncrementalAccountsHash, u64)>
pub fn get_incremental_accounts_hash( &self, slot: Slot, ) -> Option<(IncrementalAccountsHash, u64)>
Get the incremental accounts hash for slot
Sourcepub fn get_incremental_accounts_hashes(
&self,
) -> HashMap<Slot, (IncrementalAccountsHash, u64)>
pub fn get_incremental_accounts_hashes( &self, ) -> HashMap<Slot, (IncrementalAccountsHash, u64)>
Get all incremental accounts hashes
Sourcepub fn purge_old_accounts_hashes(&self, latest_full_snapshot_slot: Slot)
pub fn purge_old_accounts_hashes(&self, latest_full_snapshot_slot: Slot)
Purge accounts hashes that are older than latest_full_snapshot_slot
Should only be called by AccountsHashVerifier, since it consumes the accounts hashes and knows which ones are still needed.
Sourcepub fn calculate_accounts_hash(
&self,
config: &CalcAccountsHashConfig<'_>,
storages: &SortedStorages<'_>,
stats: HashStats,
) -> (AccountsHash, u64)
pub fn calculate_accounts_hash( &self, config: &CalcAccountsHashConfig<'_>, storages: &SortedStorages<'_>, stats: HashStats, ) -> (AccountsHash, u64)
Calculate the full accounts hash
This is intended to be used by startup verification, and also AccountsHashVerifier. Uses account storage files as the data source for the calculation.
Sourcepub fn calculate_incremental_accounts_hash(
&self,
config: &CalcAccountsHashConfig<'_>,
storages: &SortedStorages<'_>,
stats: HashStats,
) -> (IncrementalAccountsHash, u64)
pub fn calculate_incremental_accounts_hash( &self, config: &CalcAccountsHashConfig<'_>, storages: &SortedStorages<'_>, stats: HashStats, ) -> (IncrementalAccountsHash, u64)
Calculate the incremental accounts hash
This calculation is intended to be used by incremental snapshots, and thus differs from a “full” accounts hash in a few ways:
- Zero-lamport accounts are included in the hash because zero-lamport accounts are also included in the incremental snapshot. This ensures reconstructing the AccountsDb is still correct when using this incremental accounts hash.
storages
must be the same as the ones going into the incremental snapshot.
Sourcepub fn verify_accounts_hash_and_lamports(
&self,
snapshot_storages_and_slots: (&[Arc<AccountStorageEntry>], &[Slot]),
slot: Slot,
total_lamports: u64,
base: Option<(Slot, u64)>,
config: VerifyAccountsHashAndLamportsConfig<'_>,
) -> Result<(), AccountsHashVerificationError>
pub fn verify_accounts_hash_and_lamports( &self, snapshot_storages_and_slots: (&[Arc<AccountStorageEntry>], &[Slot]), slot: Slot, total_lamports: u64, base: Option<(Slot, u64)>, config: VerifyAccountsHashAndLamportsConfig<'_>, ) -> Result<(), AccountsHashVerificationError>
Verify accounts hash at startup (or tests)
Calculate accounts hash(es) and compare them to the values set at startup.
If base
is None
, only calculates the full accounts hash for [0, slot]
.
If base
is Some
, calculate the full accounts hash for [0, base slot]
and then calculate the incremental accounts hash for (base slot, slot]
.
Sourcepub fn get_pubkey_hash_for_slot(
&self,
slot: Slot,
) -> (Vec<(Pubkey, AccountHash)>, u64, Measure)
pub fn get_pubkey_hash_for_slot( &self, slot: Slot, ) -> (Vec<(Pubkey, AccountHash)>, u64, Measure)
helper to return
- pubkey, hash pairs for the slot
- us spent scanning
- Measure started when we began accumulating
Sourcepub fn get_pubkey_hash_account_for_slot(
&self,
slot: Slot,
) -> Vec<PubkeyHashAccount>
pub fn get_pubkey_hash_account_for_slot( &self, slot: Slot, ) -> Vec<PubkeyHashAccount>
Return all of the accounts for a given slot
Sourcepub fn calculate_accounts_delta_hash_internal(
&self,
slot: Slot,
ignore: Option<Pubkey>,
skipped_rewrites: HashMap<Pubkey, AccountHash>,
) -> AccountsDeltaHash
pub fn calculate_accounts_delta_hash_internal( &self, slot: Slot, ignore: Option<Pubkey>, skipped_rewrites: HashMap<Pubkey, AccountHash>, ) -> AccountsDeltaHash
Calculate accounts delta hash for slot
As part of calculating the accounts delta hash, get a list of accounts modified this slot
(aka dirty pubkeys) and add them to self.uncleaned_pubkeys
for future cleaning.
Sourcepub fn set_accounts_delta_hash_from_snapshot(
&mut self,
slot: Slot,
accounts_delta_hash: SerdeAccountsDeltaHash,
) -> Option<AccountsDeltaHash>
pub fn set_accounts_delta_hash_from_snapshot( &mut self, slot: Slot, accounts_delta_hash: SerdeAccountsDeltaHash, ) -> Option<AccountsDeltaHash>
After deserializing a snapshot, set the accounts delta hash for the new AccountsDb
Sourcepub fn get_accounts_delta_hash(&self, slot: Slot) -> Option<AccountsDeltaHash>
pub fn get_accounts_delta_hash(&self, slot: Slot) -> Option<AccountsDeltaHash>
Get the accounts delta hash for slot
in the accounts_delta_hashes
map
Sourcepub fn update_bank_hash_stats_from_snapshot(
&mut self,
slot: Slot,
stats: BankHashStats,
) -> Option<BankHashStats>
pub fn update_bank_hash_stats_from_snapshot( &mut self, slot: Slot, stats: BankHashStats, ) -> Option<BankHashStats>
When reconstructing AccountsDb from a snapshot, insert the bank_hash_stats
into the
internal bank hash stats map.
This fn is only called when loading from a snapshot, which means AccountsDb is new and its bank hash stats map is unpopulated. Except for slot 0.
Slot 0 is a special case. When a new AccountsDb is created–like when loading from a
snapshot–the bank hash stats map is populated with a default entry at slot 0. Remove the
default entry at slot 0, and then insert the new value at slot
.
Sourcepub fn get_bank_hash_stats(&self, slot: Slot) -> Option<BankHashStats>
pub fn get_bank_hash_stats(&self, slot: Slot) -> Option<BankHashStats>
Get the bank hash stats for slot
in the bank_hash_stats
map
pub fn store_cached<'a>( &self, accounts: impl StorableAccounts<'a>, transactions: Option<&'a [&'a SanitizedTransaction]>, )
Sourcepub fn store_uncached(
&self,
slot: Slot,
accounts: &[(&Pubkey, &AccountSharedData)],
)
pub fn store_uncached( &self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)], )
Store the account update. only called by tests
pub fn store_accounts_frozen<'a>( &self, accounts: impl StorableAccounts<'a>, storage: &Arc<AccountStorageEntry>, ) -> StoreAccountsTiming
pub fn add_root(&self, slot: Slot) -> AccountsAddRootTiming
Sourcepub fn get_snapshot_storages(
&self,
requested_slots: impl RangeBounds<Slot> + Sync,
) -> (Vec<Arc<AccountStorageEntry>>, Vec<Slot>)
pub fn get_snapshot_storages( &self, requested_slots: impl RangeBounds<Slot> + Sync, ) -> (Vec<Arc<AccountStorageEntry>>, Vec<Slot>)
Get storages to use for snapshots, for the requested slots
Sourcepub fn latest_full_snapshot_slot(&self) -> Option<Slot>
pub fn latest_full_snapshot_slot(&self) -> Option<Slot>
Returns the latest full snapshot slot
Sourcepub fn set_latest_full_snapshot_slot(&self, slot: Slot)
pub fn set_latest_full_snapshot_slot(&self, slot: Slot)
Sets the latest full snapshot slot to slot
pub fn generate_index( &self, limit_load_slot_count_from_snapshot: Option<usize>, verify: bool, genesis_config: &GenesisConfig, ) -> IndexGenerationInfo
pub fn print_accounts_stats(&self, label: &str)
pub fn print_count_and_status(&self, label: &str)
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