InMemAccountsIndex iter returns vec<owned> (#19778)
This commit is contained in:
committed by
GitHub
parent
7de2236284
commit
91c3b18e1e
@ -6461,7 +6461,7 @@ impl AccountsDb {
|
|||||||
roots.sort();
|
roots.sort();
|
||||||
info!("{}: accounts_index roots: {:?}", label, roots,);
|
info!("{}: accounts_index roots: {:?}", label, roots,);
|
||||||
self.accounts_index.account_maps.iter().for_each(|map| {
|
self.accounts_index.account_maps.iter().for_each(|map| {
|
||||||
for (pubkey, account_entry) in map.read().unwrap().iter() {
|
for (pubkey, account_entry) in map.read().unwrap().items() {
|
||||||
info!(" key: {} ref_count: {}", pubkey, account_entry.ref_count(),);
|
info!(" key: {} ref_count: {}", pubkey, account_entry.ref_count(),);
|
||||||
info!(
|
info!(
|
||||||
" slots: {:?}",
|
" slots: {:?}",
|
||||||
|
@ -640,9 +640,9 @@ impl<'a, T: IsCached> AccountsIndexIterator<'a, T> {
|
|||||||
R: RangeBounds<Pubkey>,
|
R: RangeBounds<Pubkey>,
|
||||||
{
|
{
|
||||||
let mut result = Vec::with_capacity(map.len());
|
let mut result = Vec::with_capacity(map.len());
|
||||||
for (k, v) in map.iter() {
|
for (k, v) in map.items() {
|
||||||
if range.contains(k) {
|
if range.contains(&k) {
|
||||||
result.push((*k, v.clone()));
|
result.push((k, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !collect_all_unsorted {
|
if !collect_all_unsorted {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::accounts_index::{AccountMapEntry, IsCached};
|
use crate::accounts_index::{AccountMapEntry, IsCached};
|
||||||
use solana_sdk::pubkey::Pubkey;
|
use solana_sdk::pubkey::Pubkey;
|
||||||
use std::collections::{
|
use std::collections::{
|
||||||
hash_map::{Entry, Iter, Keys},
|
hash_map::{Entry, Keys},
|
||||||
HashMap,
|
HashMap,
|
||||||
};
|
};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
@ -26,8 +26,8 @@ impl<V: IsCached> InMemAccountsIndex<V> {
|
|||||||
self.map.entry(pubkey)
|
self.map.entry(pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> Iter<K, AccountMapEntry<V>> {
|
pub fn items(&self) -> Vec<(K, AccountMapEntry<V>)> {
|
||||||
self.map.iter()
|
self.map.iter().map(|(k, v)| (*k, v.clone())).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keys(&self) -> Keys<K, AccountMapEntry<V>> {
|
pub fn keys(&self) -> Keys<K, AccountMapEntry<V>> {
|
||||||
|
Reference in New Issue
Block a user