accounts index keys returns by value (#19858)
This commit is contained in:
committed by
GitHub
parent
46d1b61902
commit
2a795614d3
@ -4797,7 +4797,7 @@ impl AccountsDb {
|
|||||||
.account_maps
|
.account_maps
|
||||||
.iter()
|
.iter()
|
||||||
.map(|map| {
|
.map(|map| {
|
||||||
let mut keys = map.read().unwrap().keys().cloned().collect::<Vec<_>>();
|
let mut keys = map.read().unwrap().keys();
|
||||||
keys.sort_unstable(); // hashmap is not ordered, but bins are relative to each other
|
keys.sort_unstable(); // hashmap is not ordered, but bins are relative to each other
|
||||||
keys
|
keys
|
||||||
})
|
})
|
||||||
|
@ -6,10 +6,7 @@ use crate::bucket_map_holder::BucketMapHolder;
|
|||||||
use crate::bucket_map_holder_stats::BucketMapHolderStats;
|
use crate::bucket_map_holder_stats::BucketMapHolderStats;
|
||||||
use solana_measure::measure::Measure;
|
use solana_measure::measure::Measure;
|
||||||
use solana_sdk::{clock::Slot, pubkey::Pubkey};
|
use solana_sdk::{clock::Slot, pubkey::Pubkey};
|
||||||
use std::collections::{
|
use std::collections::{hash_map::Entry, HashMap};
|
||||||
hash_map::{Entry, Keys},
|
|
||||||
HashMap,
|
|
||||||
};
|
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@ -67,9 +64,9 @@ impl<T: IsCached> InMemAccountsIndex<T> {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keys(&self) -> Keys<K, AccountMapEntry<T>> {
|
pub fn keys(&self) -> Vec<Pubkey> {
|
||||||
Self::update_stat(&self.stats().keys, 1);
|
Self::update_stat(&self.stats().keys, 1);
|
||||||
self.map.keys()
|
self.map.keys().cloned().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(&self, key: &K) -> Option<AccountMapEntry<T>> {
|
pub fn get(&self, key: &K) -> Option<AccountMapEntry<T>> {
|
||||||
|
Reference in New Issue
Block a user