AccountsDb

Struct 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§

Source§

impl AccountsDb

Source

pub fn default_for_tests() -> Self

Source

pub fn new_for_tests(paths: Vec<PathBuf>, cluster_type: &ClusterType) -> Self

Source

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

Source

pub fn set_shrink_paths(&self, paths: Vec<PathBuf>)

Source

pub fn file_size(&self) -> u64

Source

pub fn new_single_for_tests() -> Self

Source

pub fn expected_cluster_type(&self) -> ClusterType

Source

pub fn clean_accounts( &self, max_clean_root: Option<Slot>, is_startup: bool, last_full_snapshot_slot: Option<Slot>, )

Source

pub fn shrink_candidate_slots(&self) -> usize

Source

pub fn shrink_all_slots( &self, is_startup: bool, last_full_snapshot_slot: Option<Slot>, )

Source

pub fn scan_accounts<F, A>( &self, ancestors: &Ancestors, bank_id: BankId, scan_func: F, ) -> ScanResult<A>

Source

pub fn unchecked_scan_accounts<F, A>( &self, metric_name: &'static str, ancestors: &Ancestors, scan_func: F, collect_all_unsorted: bool, ) -> A
where F: Fn(&mut A, (&Pubkey, LoadedAccount<'_>, Slot)), A: Default,

Source

pub fn range_scan_accounts<F, A, R>( &self, metric_name: &'static str, ancestors: &Ancestors, range: R, collect_all_unsorted: bool, scan_func: F, ) -> A

Source

pub fn index_scan_accounts<F, A>( &self, ancestors: &Ancestors, bank_id: BankId, index_key: IndexKey, scan_func: F, ) -> ScanResult<(A, bool)>

Source

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

Source

pub fn set_hash(&self, slot: Slot, parent_slot: Slot)

Source

pub fn load( &self, ancestors: &Ancestors, pubkey: &Pubkey, load_hint: LoadHint, ) -> Option<(AccountSharedData, Slot)>

Source

pub fn load_with_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>

Source

pub fn load_without_fixed_root( &self, ancestors: &Ancestors, pubkey: &Pubkey, ) -> Option<(AccountSharedData, Slot)>

Source

pub fn load_account_hash( &self, ancestors: &Ancestors, pubkey: &Pubkey, max_root: Option<Slot>, load_hint: LoadHint, ) -> Option<Hash>

Source

pub fn create_drop_bank_callback( &self, pruned_banks_sender: DroppedSlotsSender, ) -> SendDroppedBankCallback

Source

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

Source

pub fn remove_unrooted_slots(&self, remove_slots: &[(Slot, BankId)])

Source

pub fn hash_stored_account(slot: Slot, account: &StoredAccountMeta<'_>) -> Hash

Source

pub fn hash_account<T: ReadableAccount>( slot: Slot, account: &T, pubkey: &Pubkey, ) -> Hash

Source

pub fn mark_slot_frozen(&self, slot: Slot)

Source

pub fn expire_old_recycle_stores(&self)

Source

pub fn flush_accounts_cache_slot(&self, slot: Slot)

Source

pub fn flush_accounts_cache( &self, force_flush: bool, requested_flush_root: Option<Slot>, )

Source

pub fn checked_iterative_sum_for_capitalization( total_cap: u64, new_cap: u64, ) -> u64

Source

pub fn checked_sum_for_capitalization<T: Iterator<Item = u64>>( balances: T, ) -> u64

Source

pub fn get_accounts_hash(&self, slot: Slot) -> Hash

Source

pub fn update_accounts_hash( &self, slot: Slot, ancestors: &Ancestors, ) -> (Hash, u64)

Source

pub fn update_accounts_hash_test( &self, slot: Slot, ancestors: &Ancestors, ) -> (Hash, u64)

Source

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)

Source

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>

Source

pub fn verify_bank_hash_and_carats( &self, slot: Slot, ancestors: &Ancestors, total_carats: u64, test_hash_calculation: bool, ) -> Result<(), BankHashVerificationError>

Source

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.

Source

pub fn get_accounts_delta_hash(&self, slot: Slot) -> Hash

Source

pub fn store_cached( &self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)], )

Source

pub fn store_uncached( &self, slot: Slot, accounts: &[(&Pubkey, &AccountSharedData)], )

Store the account update.

Source

pub fn add_root(&self, slot: Slot)

Source

pub fn get_snapshot_storages( &self, snapshot_slot: Slot, snapshot_base_slot: Option<Slot>, ancestors: Option<&Ancestors>, ) -> (SnapshotStorages, Vec<Slot>)

Source

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.

Trait Implementations§

Source§

impl Debug for AccountsDb

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,