AcctIdx: initialize acct idx by config (#19968)
This commit is contained in:
parent
1ec22572f2
commit
37d6f5013f
|
@ -764,11 +764,12 @@ impl<T: IndexValue> AccountsIndex<T> {
|
||||||
AccountsIndexStorage<T>,
|
AccountsIndexStorage<T>,
|
||||||
) {
|
) {
|
||||||
let bins = config
|
let bins = config
|
||||||
|
.as_ref()
|
||||||
.and_then(|config| config.bins)
|
.and_then(|config| config.bins)
|
||||||
.unwrap_or(BINS_DEFAULT);
|
.unwrap_or(BINS_DEFAULT);
|
||||||
// create bin_calculator early to verify # bins is reasonable
|
// create bin_calculator early to verify # bins is reasonable
|
||||||
let bin_calculator = PubkeyBinCalculator16::new(bins);
|
let bin_calculator = PubkeyBinCalculator16::new(bins);
|
||||||
let storage = AccountsIndexStorage::new(bins);
|
let storage = AccountsIndexStorage::new(bins, &config);
|
||||||
let account_maps = (0..bins)
|
let account_maps = (0..bins)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|bin| RwLock::new(Arc::clone(&storage.in_mem[bin])))
|
.map(|bin| RwLock::new(Arc::clone(&storage.in_mem[bin])))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::accounts_index::IndexValue;
|
use crate::accounts_index::{AccountsIndexConfig, IndexValue};
|
||||||
use crate::bucket_map_holder::BucketMapHolder;
|
use crate::bucket_map_holder::BucketMapHolder;
|
||||||
use crate::in_mem_accounts_index::InMemAccountsIndex;
|
use crate::in_mem_accounts_index::InMemAccountsIndex;
|
||||||
use crate::waitable_condvar::WaitableCondvar;
|
use crate::waitable_condvar::WaitableCondvar;
|
||||||
|
@ -44,7 +44,7 @@ impl<T: IndexValue> Drop for AccountsIndexStorage<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: IndexValue> AccountsIndexStorage<T> {
|
impl<T: IndexValue> AccountsIndexStorage<T> {
|
||||||
pub fn new(bins: usize) -> AccountsIndexStorage<T> {
|
pub fn new(bins: usize, _config: &Option<AccountsIndexConfig>) -> AccountsIndexStorage<T> {
|
||||||
let storage = Arc::new(BucketMapHolder::new(bins));
|
let storage = Arc::new(BucketMapHolder::new(bins));
|
||||||
|
|
||||||
let in_mem = (0..bins)
|
let in_mem = (0..bins)
|
||||||
|
|
Loading…
Reference in New Issue