pub struct BucketMapHolder<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> {
pub disk: Option<BucketMap<(Slot, U)>>,
pub count_buckets_flushed: AtomicUsize,
pub age: AtomicAge,
pub future_age_to_flush: AtomicAge,
pub future_age_to_flush_cached: AtomicAge,
pub stats: BucketMapHolderStats,
pub wait_dirty_or_aged: Arc<WaitableCondvar>,
pub threads: usize,
pub mem_budget_mb: Option<usize>,
pub ages_to_stay_in_cache: Age,
/* private fields */
}
Fields§
§disk: Option<BucketMap<(Slot, U)>>
§count_buckets_flushed: AtomicUsize
§age: AtomicAge
These three ages are individual atomics because their values are read many times from code during runtime. Instead of accessing the single age and doing math each time, each value is incremented each time the age occurs, which is ~400ms. Callers can ask for the precomputed value they already want. rolling ‘current’ age
future_age_to_flush: AtomicAge
rolling age that is ‘ages_to_stay_in_cache’ + ‘age’
future_age_to_flush_cached: AtomicAge
rolling age that is effectively ‘age’ - 1 these items are expected to be flushed from the accounts write cache or otherwise modified before this age occurs
stats: BucketMapHolderStats
§wait_dirty_or_aged: Arc<WaitableCondvar>
§threads: usize
§mem_budget_mb: Option<usize>
§ages_to_stay_in_cache: Age
how many ages should elapse from the last time an item is used where the item will remain in the cache
Implementations§
source§impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> BucketMapHolder<T, U>
impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> BucketMapHolder<T, U>
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 increment_age(&self)
pub fn future_age_to_flush(&self, is_cached: bool) -> Age
sourcepub fn get_startup(&self) -> bool
pub fn get_startup(&self) -> bool
used by bg processes to determine # active threads and how aggressively to flush
sourcepub fn set_startup(&self, value: bool)
pub fn set_startup(&self, value: bool)
startup=true causes: in mem to act in a way that flushes to disk asap startup=false is ‘normal’ operation
sourcepub fn wait_for_idle(&self)
pub fn wait_for_idle(&self)
return when the bg threads have reached an ‘idle’ state
pub fn current_age(&self) -> Age
pub fn bucket_flushed_at_current_age(&self, can_advance_age: bool)
sourcepub fn all_buckets_flushed_at_current_age(&self) -> bool
pub fn all_buckets_flushed_at_current_age(&self) -> bool
have all buckets been flushed at the current age?
pub fn count_buckets_flushed(&self) -> usize
sourcepub fn maybe_advance_age(&self) -> bool
pub fn maybe_advance_age(&self) -> bool
if all buckets are flushed at the current age and time has elapsed, then advance age
pub fn new( bins: usize, config: &Option<AccountsIndexConfig>, threads: usize, ) -> Self
pub fn next_bucket_to_flush(&self) -> usize
pub fn background( &self, exit: Vec<Arc<AtomicBool>>, in_mem: Vec<Arc<InMemAccountsIndex<T, U>>>, can_advance_age: bool, )
Trait Implementations§
source§impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> Debug for BucketMapHolder<T, U>
impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> Debug for BucketMapHolder<T, U>
Auto Trait Implementations§
impl<T, U> !Freeze for BucketMapHolder<T, U>
impl<T, U> RefUnwindSafe for BucketMapHolder<T, U>where
T: RefUnwindSafe,
impl<T, U> Send for BucketMapHolder<T, U>
impl<T, U> Sync for BucketMapHolder<T, U>
impl<T, U> Unpin for BucketMapHolder<T, U>where
T: Unpin,
impl<T, U> UnwindSafe for BucketMapHolder<T, U>where
T: UnwindSafe,
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