From 02d0e922448ba34378df605003dbf0a8ae35e2ae Mon Sep 17 00:00:00 2001 From: jeff washington Date: Thu, 3 Aug 2023 19:19:50 -0500 Subject: [PATCH] renames --- runtime/src/read_only_accounts_cache.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/runtime/src/read_only_accounts_cache.rs b/runtime/src/read_only_accounts_cache.rs index b4f617f8d96704..ee0e4fe5a9006c 100644 --- a/runtime/src/read_only_accounts_cache.rs +++ b/runtime/src/read_only_accounts_cache.rs @@ -26,8 +26,8 @@ struct ReadOnlyAccountCacheEntry { account: AccountSharedData, /// Index of the entry in the eviction queue. index: Index, - /// lower bits of last timestamp when eviction queue was updated - last_time: u32, + /// lower bits of last timestamp when eviction queue was updated, in ms + last_update_time: u32, } impl ReadOnlyAccountCacheEntry { @@ -35,16 +35,16 @@ impl ReadOnlyAccountCacheEntry { Self { account, index, - last_time: Self::timestamp(), + last_update_time: Self::timestamp(), } } /// lower bits of current timestamp. We don't need higher bits and u32 packs with Index u32 in `ReadOnlyAccountCacheEntry` fn timestamp() -> u32 { timestamp() as u32 } - /// ms since `last_time` timestamp - fn ms_since_last_time(&self) -> u32 { - Self::timestamp().wrapping_sub(self.last_time) + /// ms since `last_update_time` timestamp + fn ms_since_last_update(&self) -> u32 { + Self::timestamp().wrapping_sub(self.last_update_time) } } @@ -112,12 +112,12 @@ impl ReadOnlyAccountsCache { // self.queue is modified while holding a reference to the cache entry; // so that another thread cannot write to the same key. // If we updated the eviction queue within this much time, then leave it where it is. We're likely to hit it again. - let update_lru = entry.ms_since_last_time() >= self.ms_to_skip_lru_update; + let update_lru = entry.ms_since_last_update() >= self.ms_to_skip_lru_update; if update_lru { let mut queue = self.queue.lock().unwrap(); queue.remove(entry.index); entry.index = queue.insert_last(key); - entry.last_time = ReadOnlyAccountCacheEntry::timestamp(); + entry.last_update_time = ReadOnlyAccountCacheEntry::timestamp(); } let account = entry.account.clone(); drop(entry);