accounts index get returns value (#19777)
This commit is contained in:
committed by
GitHub
parent
999ba9e026
commit
7de2236284
@ -246,9 +246,10 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
|
|||||||
reclaims: &mut SlotList<T>,
|
reclaims: &mut SlotList<T>,
|
||||||
previous_slot_entry_was_cached: bool,
|
previous_slot_entry_was_cached: bool,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
// (possibly) non-ideal clone of arc here
|
||||||
if let Some(current) = r_account_maps.get(pubkey) {
|
if let Some(current) = r_account_maps.get(pubkey) {
|
||||||
Self::lock_and_update_slot_list(
|
Self::lock_and_update_slot_list(
|
||||||
current,
|
¤t,
|
||||||
new_value,
|
new_value,
|
||||||
reclaims,
|
reclaims,
|
||||||
previous_slot_entry_was_cached,
|
previous_slot_entry_was_cached,
|
||||||
@ -1191,7 +1192,6 @@ impl<T: IsCached> AccountsIndex<T> {
|
|||||||
lock: &AccountMapsReadLock<'_, T>,
|
lock: &AccountMapsReadLock<'_, T>,
|
||||||
) -> Option<ReadAccountMapEntry<T>> {
|
) -> Option<ReadAccountMapEntry<T>> {
|
||||||
lock.get(pubkey)
|
lock.get(pubkey)
|
||||||
.cloned()
|
|
||||||
.map(ReadAccountMapEntry::from_account_map_entry)
|
.map(ReadAccountMapEntry::from_account_map_entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1200,7 +1200,6 @@ impl<T: IsCached> AccountsIndex<T> {
|
|||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get(pubkey)
|
.get(pubkey)
|
||||||
.cloned()
|
|
||||||
.map(WriteAccountMapEntry::from_account_map_entry)
|
.map(WriteAccountMapEntry::from_account_map_entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1459,7 +1458,6 @@ impl<T: IsCached> AccountsIndex<T> {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let account = read_lock
|
let account = read_lock
|
||||||
.get(pubkey)
|
.get(pubkey)
|
||||||
.cloned()
|
|
||||||
.map(ReadAccountMapEntry::from_account_map_entry);
|
.map(ReadAccountMapEntry::from_account_map_entry);
|
||||||
|
|
||||||
match account {
|
match account {
|
||||||
|
@ -34,8 +34,8 @@ impl<V: IsCached> InMemAccountsIndex<V> {
|
|||||||
self.map.keys()
|
self.map.keys()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, key: &K) -> Option<&AccountMapEntry<V>> {
|
pub fn get(&self, key: &K) -> Option<AccountMapEntry<V>> {
|
||||||
self.map.get(key)
|
self.map.get(key).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove(&mut self, key: &K) {
|
pub fn remove(&mut self, key: &K) {
|
||||||
|
Reference in New Issue
Block a user