add <T> through accounts index (#19852)

This commit is contained in:
Jeff Washington (jwash)
2021-09-13 22:59:03 -05:00
committed by GitHub
parent 4fdd70c931
commit 910f241c3f
4 changed files with 24 additions and 17 deletions

View File

@@ -48,7 +48,9 @@ pub type AccountMap<V> = InMemAccountsIndex<V>;
pub(crate) type AccountMapEntry<T> = Arc<AccountMapEntryInner<T>>;
pub trait IsCached: 'static + Clone + Debug + PartialEq + ZeroLamport + Copy + Default {
pub trait IsCached:
'static + Clone + Debug + PartialEq + ZeroLamport + Copy + Default + Sync + Send
{
fn is_cached(&self) -> bool;
}
@@ -694,7 +696,7 @@ pub struct AccountsIndex<T: IsCached> {
// scanning the fork with that Bank at the tip is no longer possible.
pub removed_bank_ids: Mutex<HashSet<BankId>>,
storage: AccountsIndexStorage,
storage: AccountsIndexStorage<T>,
}
impl<T: IsCached> AccountsIndex<T> {
@@ -725,7 +727,11 @@ impl<T: IsCached> AccountsIndex<T> {
fn allocate_accounts_index(
config: Option<AccountsIndexConfig>,
) -> (LockMapType<T>, PubkeyBinCalculator16, AccountsIndexStorage) {
) -> (
LockMapType<T>,
PubkeyBinCalculator16,
AccountsIndexStorage<T>,
) {
let bins = config
.and_then(|config| config.bins)
.unwrap_or(BINS_DEFAULT);