From 8143ee5502571f3ea0c7f13c5454df70948b6c69 Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" <75863576+jeffwashington@users.noreply.github.com> Date: Fri, 21 May 2021 10:02:14 -0500 Subject: [PATCH] add AccountsIndex AccountMapsReadLock type (#17365) --- runtime/src/accounts_index.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index f3fcca8f4b..f0d2cbe9cf 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -113,10 +113,10 @@ impl AccountMapEntryInner { } } -pub enum AccountIndexGetResult<'a, T: 'static, U> { +pub enum AccountIndexGetResult<'a, T: 'static> { Found(ReadAccountMapEntry, usize), NotFoundOnFork, - Missing(std::sync::RwLockReadGuard<'a, AccountMap>>), + Missing(AccountMapsReadLock<'a, T>), } #[self_referencing] @@ -509,6 +509,7 @@ pub trait ZeroLamport { type MapType = AccountMap>; type AccountMapsWriteLock<'a, T> = RwLockWriteGuard<'a, AccountMap>>; +type AccountMapsReadLock<'a, T> = RwLockReadGuard<'a, AccountMap>>; #[derive(Debug)] pub struct AccountsIndex { @@ -1084,7 +1085,7 @@ impl AccountsIndex { pubkey: &Pubkey, ancestors: Option<&Ancestors>, max_root: Option, - ) -> AccountIndexGetResult<'_, T, Pubkey> { + ) -> AccountIndexGetResult<'_, T> { let read_lock = self.account_maps.read().unwrap(); let account = read_lock .get(pubkey) @@ -1550,7 +1551,7 @@ pub mod tests { } } - impl<'a, T: 'static, U> AccountIndexGetResult<'a, T, U> { + impl<'a, T: 'static> AccountIndexGetResult<'a, T> { pub fn unwrap(self) -> (ReadAccountMapEntry, usize) { match self { AccountIndexGetResult::Found(lock, size) => (lock, size),