Struct solana_runtime::accounts_index::AccountsIndex
source · [−]pub struct AccountsIndex<T: IndexValue> {
pub account_maps: Vec<RwLock<AccountMap<T>>>,
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,
/* private fields */
}
Fields
account_maps: Vec<RwLock<AccountMap<T>>>
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
Implementations
sourceimpl<T: IndexValue> AccountsIndex<T>
impl<T: IndexValue> AccountsIndex<T>
pub fn default_for_tests() -> Self
pub fn new(config: Option<AccountsIndexConfig>) -> 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: &RwLockReadGuard<'_, AccountMap<T>>
) -> Option<ReadAccountMapEntry<T>>
pub fn handle_dead_keys(
&self,
dead_keys: &[&Pubkey],
account_indexes: &AccountSecondaryIndexes
)
pub fn get_rooted_entries(
&self,
slice: SlotSlice<'_, T>,
max: Option<Slot>
) -> SlotList<T>
pub fn roots_and_ref_count(
&self,
locked_account_entry: &ReadAccountMapEntry<T>,
max: Option<Slot>
) -> (SlotList<T>, RefCount)
pub fn purge_exact<'a, C>(
&'a self,
pubkey: &Pubkey,
slots_to_purge: &'a C,
reclaims: &mut SlotList<T>
) -> bool where
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 bins(&self) -> usize
sourcepub fn retrieve_duplicate_keys_from_startup(&self) -> Vec<Vec<(Slot, Pubkey)>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn retrieve_duplicate_keys_from_startup(&self) -> Vec<Vec<(Slot, Pubkey)>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
return Vec<Vec<>> because the internal vecs are already allocated per bin
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 unref_from_storage(&self, pubkey: &Pubkey)
pub fn ref_count_from_storage(&self, pubkey: &Pubkey) -> RefCount
pub fn clean_rooted_entries(
&self,
pubkey: &Pubkey,
reclaims: &mut SlotList<T>,
max_clean_root: Option<Slot>
)
sourcepub fn get_rooted_from_list<'a>(
&self,
slots: impl Iterator<Item = &'a Slot>
) -> Vec<Slot>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_rooted_from_list<'a>(
&self,
slots: impl Iterator<Item = &'a Slot>
) -> Vec<Slot>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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, caching_enabled: bool)
pub fn add_uncleaned_roots<I>(&self, roots: I) where
I: IntoIterator<Item = Slot>,
pub fn max_root_inclusive(&self) -> Slot
sourcepub fn get_next_original_root(
&self,
slot: Slot,
ancestors: Option<&Ancestors>
) -> Option<Slot>
pub fn get_next_original_root(
&self,
slot: Slot,
ancestors: Option<&Ancestors>
) -> Option<Slot>
return the lowest original root >= slot, including historical_roots and ancestors
sourcepub fn remove_old_historical_roots(
&self,
oldest_slot_to_keep: Slot,
keep: &HashSet<Slot>
)
pub fn remove_old_historical_roots(
&self,
oldest_slot_to_keep: Slot,
keep: &HashSet<Slot>
)
roots are inserted into ‘historical_roots’ and ‘roots’ as a new root is made. roots are removed form ‘roots’ as all entries in the append vec become outdated. This function exists to clean older entries from ‘historical_roots’. all roots < ‘oldest_slot_to_keep’ are removed from ‘historical_roots’.
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
pub fn min_alive_root(&self) -> Option<Slot>
pub fn reset_uncleaned_roots(
&self,
max_clean_root: Option<Slot>
) -> HashSet<Slot>
pub fn is_uncleaned_root(&self, slot: Slot) -> bool
pub fn num_alive_roots(&self) -> usize
pub fn all_alive_roots(&self) -> Vec<Slot>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn clone_uncleaned_roots(&self) -> HashSet<Slot>
pub fn uncleaned_roots_len(&self) -> usize
Trait Implementations
sourceimpl<T: Debug + IndexValue> Debug for AccountsIndex<T>
impl<T: Debug + IndexValue> Debug for AccountsIndex<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for AccountsIndex<T>
impl<T> Send for AccountsIndex<T>
impl<T> Sync for AccountsIndex<T>
impl<T> Unpin for AccountsIndex<T>
impl<T> !UnwindSafe for AccountsIndex<T>
Blanket Implementations
sourceimpl<T> AbiExample for T
impl<T> AbiExample for T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more