Browse Source

Moves trait impls for AccountInfo (#7980)

Brooks 2 months ago
parent
commit
e5b18f6a71
2 changed files with 12 additions and 8 deletions
  1. 9 2
      accounts-db/src/account_info.rs
  2. 3 6
      accounts-db/src/accounts_db.rs

+ 9 - 2
accounts-db/src/account_info.rs

@@ -4,8 +4,10 @@
 //! Note that AccountInfo is saved to disk buckets during runtime, but disk buckets are recreated at startup.
 //! Note that AccountInfo is saved to disk buckets during runtime, but disk buckets are recreated at startup.
 use {
 use {
     crate::{
     crate::{
-        accounts_db::AccountsFileId, accounts_file::ALIGN_BOUNDARY_OFFSET,
-        accounts_index::IsCached, is_zero_lamport::IsZeroLamport,
+        accounts_db::AccountsFileId,
+        accounts_file::ALIGN_BOUNDARY_OFFSET,
+        accounts_index::{DiskIndexValue, IndexValue, IsCached},
+        is_zero_lamport::IsZeroLamport,
     },
     },
     modular_bitfield::prelude::*,
     modular_bitfield::prelude::*,
 };
 };
@@ -99,6 +101,10 @@ impl IsCached for AccountInfo {
     }
     }
 }
 }
 
 
+impl IndexValue for AccountInfo {}
+
+impl DiskIndexValue for AccountInfo {}
+
 impl IsCached for StorageLocation {
 impl IsCached for StorageLocation {
     fn is_cached(&self) -> bool {
     fn is_cached(&self) -> bool {
         matches!(self, StorageLocation::Cached)
         matches!(self, StorageLocation::Cached)
@@ -164,6 +170,7 @@ impl AccountInfo {
         }
         }
     }
     }
 }
 }
+
 #[cfg(test)]
 #[cfg(test)]
 mod test {
 mod test {
     use {super::*, crate::append_vec::MAXIMUM_APPEND_VEC_FILE_SIZE};
     use {super::*, crate::append_vec::MAXIMUM_APPEND_VEC_FILE_SIZE};

+ 3 - 6
accounts-db/src/accounts_db.rs

@@ -42,9 +42,9 @@ use {
         accounts_hash::{AccountLtHash, AccountsLtHash, ZERO_LAMPORT_ACCOUNT_LT_HASH},
         accounts_hash::{AccountLtHash, AccountsLtHash, ZERO_LAMPORT_ACCOUNT_LT_HASH},
         accounts_index::{
         accounts_index::{
             in_mem_accounts_index::StartupStats, AccountSecondaryIndexes, AccountsIndex,
             in_mem_accounts_index::StartupStats, AccountSecondaryIndexes, AccountsIndex,
-            AccountsIndexConfig, AccountsIndexRootsStats, AccountsIndexScanResult, DiskIndexValue,
-            IndexKey, IndexValue, IsCached, RefCount, ScanConfig, ScanFilter, ScanResult, SlotList,
-            UpsertReclaim, ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
+            AccountsIndexConfig, AccountsIndexRootsStats, AccountsIndexScanResult, IndexKey,
+            IsCached, RefCount, ScanConfig, ScanFilter, ScanResult, SlotList, UpsertReclaim,
+            ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
         },
         },
         accounts_index_storage::Startup,
         accounts_index_storage::Startup,
         accounts_update_notifier_interface::{AccountForGeyser, AccountsUpdateNotifier},
         accounts_update_notifier_interface::{AccountForGeyser, AccountsUpdateNotifier},
@@ -658,9 +658,6 @@ impl GenerateIndexTimings {
     }
     }
 }
 }
 
 
-impl IndexValue for AccountInfo {}
-impl DiskIndexValue for AccountInfo {}
-
 impl IsZeroLamport for AccountSharedData {
 impl IsZeroLamport for AccountSharedData {
     fn is_zero_lamport(&self) -> bool {
     fn is_zero_lamport(&self) -> bool {
         self.lamports() == 0
         self.lamports() == 0