create helper fn for clarity (#27216)
This commit is contained in:
parent
f115e4d0ed
commit
e0472050c0
|
@ -279,7 +279,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||
m.stop();
|
||||
|
||||
callback(if let Some(entry) = result {
|
||||
entry.set_age(self.storage.future_age_to_flush());
|
||||
self.set_age_to_future(entry);
|
||||
Some(entry)
|
||||
} else {
|
||||
drop(map);
|
||||
|
@ -305,6 +305,10 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||
self.get_internal(pubkey, |entry| (true, entry.map(Arc::clone)))
|
||||
}
|
||||
|
||||
fn set_age_to_future(&self, entry: &AccountMapEntry<T>) {
|
||||
entry.set_age(self.storage.future_age_to_flush());
|
||||
}
|
||||
|
||||
/// lookup 'pubkey' in index (in_mem or disk).
|
||||
/// call 'callback' whether found or not
|
||||
pub(crate) fn get_internal<RT>(
|
||||
|
@ -473,7 +477,7 @@ impl<T: IndexValue> InMemAccountsIndex<T> {
|
|||
reclaims,
|
||||
reclaim,
|
||||
);
|
||||
current.set_age(self.storage.future_age_to_flush());
|
||||
self.set_age_to_future(current);
|
||||
}
|
||||
Entry::Vacant(vacant) => {
|
||||
// not in cache, look on disk
|
||||
|
|
Loading…
Reference in New Issue