pub struct InMemAccountsIndex<T: IndexValue> { /* private fields */ }
Implementations
sourceimpl<T: IndexValue> InMemAccountsIndex<T>
impl<T: IndexValue> InMemAccountsIndex<T>
pub fn new(storage: &Arc<BucketMapHolder<T>>, bin: usize) -> Self
sourcepub fn shrink_to_fit(&self)
pub fn shrink_to_fit(&self)
Release entire in-mem hashmap to free all memory associated with it. Idea is that during startup we needed a larger map than we need during runtime. When using disk-buckets, in-mem index grows over time with dynamic use and then shrinks, in theory back to 0.
pub fn items<R>(&self, range: &R) -> Vec<(Pubkey, Arc<AccountMapEntryInner<T>>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
where
R: RangeBounds<Pubkey> + Debug,
A: Allocator,
pub fn keys(&self) -> Vec<Pubkey>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
sourcepub fn get(&self, pubkey: &Pubkey) -> Option<Arc<AccountMapEntryInner<T>>>
pub fn get(&self, pubkey: &Pubkey) -> Option<Arc<AccountMapEntryInner<T>>>
lookup ‘pubkey’ in index (in mem or on disk)
pub fn remove_if_slot_list_empty(&self, pubkey: Pubkey) -> bool
pub fn slot_list_mut<RT>(
&self,
pubkey: &Pubkey,
user: impl for<'a> FnOnce(&mut RwLockWriteGuard<'a, SlotList<T>>) -> RT
) -> Option<RT>
pub fn unref(&self, pubkey: &Pubkey)
pub fn upsert(
&self,
pubkey: &Pubkey,
new_value: PreAllocatedAccountMapEntry<T>,
other_slot: Option<Slot>,
reclaims: &mut SlotList<T>,
previous_slot_entry_was_cached: bool
)
sourcepub fn lock_and_update_slot_list(
current: &AccountMapEntryInner<T>,
new_value: (Slot, T),
other_slot: Option<Slot>,
reclaims: &mut SlotList<T>,
previous_slot_entry_was_cached: bool
)
pub fn lock_and_update_slot_list(
current: &AccountMapEntryInner<T>,
new_value: (Slot, T),
other_slot: Option<Slot>,
reclaims: &mut SlotList<T>,
previous_slot_entry_was_cached: bool
)
Try to update an item in the slot list the given slot
If an item for the slot
already exists in the list, remove the older item, add it to reclaims
, and insert
the new item.
if ‘other_slot’ is some, then also remove any entries in the slot list that are at ‘other_slot’
pub fn len_for_stats(&self) -> usize
pub fn insert_new_entry_if_missing_with_lock(
&self,
pubkey: Pubkey,
new_entry: PreAllocatedAccountMapEntry<T>
) -> InsertNewEntryResults
sourcepub fn hold_range_in_memory<R>(&self, range: &R, start_holding: bool)where
R: RangeBounds<Pubkey> + Debug,
pub fn hold_range_in_memory<R>(&self, range: &R, start_holding: bool)where
R: RangeBounds<Pubkey> + Debug,
if ‘start_holding’=true, then: at the end of this function, cache_ranges_held will be updated to contain ‘range’ and all pubkeys in that range will be in the in-mem cache if ‘start_holding’=false, then: ‘range’ will be removed from cache_ranges_held and all pubkeys will be eligible for being removed from in-mem cache in the bg if no other range is holding them Any in-process flush will be aborted when it gets to evicting items from in-mem.