Struct solana_runtime::accounts_index::AccountsIndex
source · pub struct AccountsIndex<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> {
pub account_maps: Vec<AccountMap<T, U>>,
pub bin_calculator: PubkeyBinCalculator24,
pub removed_bank_ids: Mutex<HashSet<BankId>>,
pub scan_results_limit_bytes: Option<usize>,
pub roots_added: AtomicUsize,
pub roots_removed: AtomicUsize,
pub active_scans: AtomicUsize,
pub max_distance_to_min_scan_slot: AtomicU64,
pub rent_paying_accounts_by_partition: OnceCell<RentPayingAccountsByPartition>,
/* private fields */
}
Expand description
T: account info type to interact in in-memory items U: account info type to be persisted to disk
Fields§
§account_maps: Vec<AccountMap<T, U>>
§bin_calculator: PubkeyBinCalculator24
§removed_bank_ids: Mutex<HashSet<BankId>>
§scan_results_limit_bytes: Option<usize>
when a scan’s accumulated data exceeds this limit, abort the scan
roots_added: AtomicUsize
§roots_removed: AtomicUsize
§active_scans: AtomicUsize
§max_distance_to_min_scan_slot: AtomicU64
§rent_paying_accounts_by_partition: OnceCell<RentPayingAccountsByPartition>
populated at generate_index time - accounts that could possibly be rent paying
Implementations§
source§impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U>
impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U>
pub fn default_for_tests() -> Self
pub fn new(config: Option<AccountsIndexConfig>, exit: &Arc<AtomicBool>) -> Self
sourcepub fn is_disk_index_enabled(&self) -> bool
pub fn is_disk_index_enabled(&self) -> bool
is the accounts index using disk as a backing store
pub fn get_account_read_entry( &self, pubkey: &Pubkey ) -> Option<ReadAccountMapEntry<T>>
pub fn get_account_read_entry_with_lock( &self, pubkey: &Pubkey, lock: &&'_ AccountMap<T, U> ) -> Option<ReadAccountMapEntry<T>>
sourcepub fn handle_dead_keys(
&self,
dead_keys: &[&Pubkey],
account_indexes: &AccountSecondaryIndexes
) -> HashSet<Pubkey>
pub fn handle_dead_keys( &self, dead_keys: &[&Pubkey], account_indexes: &AccountSecondaryIndexes ) -> HashSet<Pubkey>
Remove keys from the account index if the key’s slot list is empty. Returns the keys that were removed from the index. These keys should not be accessed again in the current code path.
pub fn get_rooted_entries( &self, slice: SlotSlice<'_, T>, max_inclusive: Option<Slot> ) -> SlotList<T>
pub fn purge_exact<'a, C>( &'a self, pubkey: &Pubkey, slots_to_purge: &'a C, reclaims: &mut SlotList<T> ) -> boolwhere C: Contains<'a, Slot>,
pub fn min_ongoing_scan_root(&self) -> Option<Slot>
pub fn hold_range_in_memory<R>( &self, range: &R, start_holding: bool, thread_pool: &ThreadPool )where R: RangeBounds<Pubkey> + Debug + Sync,
pub fn set_startup(&self, value: Startup)
pub fn get_startup_remaining_items_to_flush_estimate(&self) -> usize
pub fn get_index_key_size( &self, index: &AccountIndex, index_key: &Pubkey ) -> Option<usize>
pub fn bins(&self) -> usize
sourcepub fn upsert(
&self,
new_slot: Slot,
old_slot: Slot,
pubkey: &Pubkey,
account: &impl ReadableAccount,
account_indexes: &AccountSecondaryIndexes,
account_info: T,
reclaims: &mut SlotList<T>,
reclaim: UpsertReclaim
)
pub fn upsert( &self, new_slot: Slot, old_slot: Slot, pubkey: &Pubkey, account: &impl ReadableAccount, account_indexes: &AccountSecondaryIndexes, account_info: T, reclaims: &mut SlotList<T>, reclaim: UpsertReclaim )
Updates the given pubkey at the given slot with the new account information. on return, the index’s previous account info may be returned in ‘reclaims’ depending on ‘previous_slot_entry_was_cached’
pub fn ref_count_from_storage(&self, pubkey: &Pubkey) -> RefCount
sourcepub fn clean_rooted_entries(
&self,
pubkey: &Pubkey,
reclaims: &mut SlotList<T>,
max_clean_root_inclusive: Option<Slot>
) -> bool
pub fn clean_rooted_entries( &self, pubkey: &Pubkey, reclaims: &mut SlotList<T>, max_clean_root_inclusive: Option<Slot> ) -> bool
return true if pubkey was removed from the accounts index or does not exist in the accounts index This means it should NOT be unref’d later.
sourcepub fn get_rooted_from_list<'a>(
&self,
slots: impl Iterator<Item = &'a Slot>
) -> Vec<Slot>
pub fn get_rooted_from_list<'a>( &self, slots: impl Iterator<Item = &'a Slot> ) -> Vec<Slot>
Given a list of slots, return a new list of only the slots that are rooted
pub fn is_alive_root(&self, slot: Slot) -> bool
pub fn add_root(&self, slot: Slot)
pub fn add_uncleaned_roots<I>(&self, roots: I)where I: IntoIterator<Item = Slot>,
pub fn max_root_inclusive(&self) -> Slot
sourcepub fn clean_dead_slot(
&self,
slot: Slot,
stats: &mut AccountsIndexRootsStats
) -> bool
pub fn clean_dead_slot( &self, slot: Slot, stats: &mut AccountsIndexRootsStats ) -> bool
Remove the slot when the storage for the slot is freed Accounts no longer reference this slot. return true if slot was a root