From 8e0a55fe64a389c172e08e30ac5d700862a2d66a Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Mon, 8 Apr 2024 17:58:01 -0500 Subject: [PATCH] add file_provider to accounts_db (#665) --- accounts-db/src/accounts_db.rs | 6 +++++- accounts-db/src/accounts_file.rs | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 40fe43123..effe2e21a 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -1424,6 +1424,9 @@ pub struct AccountsDb { /// debug feature to scan every append vec and verify refcounts are equal exhaustively_verify_refcounts: bool, + /// storage format to use for new storages + accounts_file_provider: AccountsFileProvider, + /// this will live here until the feature for partitioned epoch rewards is activated. /// At that point, this and other code can be deleted. pub partitioned_epoch_rewards_config: PartitionedEpochRewardsConfig, @@ -2404,6 +2407,7 @@ impl AccountsDb { accounts_update_notifier: None, log_dead_slots: AtomicBool::new(true), exhaustively_verify_refcounts: false, + accounts_file_provider: AccountsFileProvider::default(), partitioned_epoch_rewards_config: PartitionedEpochRewardsConfig::default(), epoch_accounts_hash_manager: EpochAccountsHashManager::new_invalid(), test_skip_rewrites_but_include_in_bank_hash: false, @@ -2546,7 +2550,7 @@ impl AccountsDb { slot, self.next_id(), size, - AccountsFileProvider::AppendVec, + self.accounts_file_provider, ) } diff --git a/accounts-db/src/accounts_file.rs b/accounts-db/src/accounts_file.rs index 49d1cb906..bb0425f3b 100644 --- a/accounts-db/src/accounts_file.rs +++ b/accounts-db/src/accounts_file.rs @@ -294,8 +294,9 @@ impl<'a> Iterator for AccountsFileIter<'a> { } /// An enum that creates AccountsFile instance with the specified format. -#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[derive(Debug, Default, Copy, Clone, Eq, PartialEq)] pub enum AccountsFileProvider { + #[default] AppendVec, HotStorage, }