solana_accounts_db/accounts_db/
accounts_db_config.rs1use {
2 super::{
3 AccountShrinkThreshold, MarkObsoleteAccounts, DEFAULT_ACCOUNTS_SHRINK_THRESHOLD_OPTION,
4 MEMLOCK_BUDGET_SIZE_FOR_TESTS,
5 },
6 crate::{
7 accounts_file::StorageAccess,
8 accounts_index::{
9 AccountSecondaryIndexes, AccountsIndexConfig, ScanFilter,
10 ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS, ACCOUNTS_INDEX_CONFIG_FOR_TESTING,
11 },
12 partitioned_rewards::{
13 PartitionedEpochRewardsConfig, DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
14 },
15 },
16 std::{num::NonZeroUsize, path::PathBuf},
17};
18
19#[derive(Debug, Default, Clone)]
20pub struct AccountsDbConfig {
21 pub index: Option<AccountsIndexConfig>,
22 pub account_indexes: Option<AccountSecondaryIndexes>,
23 pub base_working_path: Option<PathBuf>,
25 pub shrink_paths: Option<Vec<PathBuf>>,
26 pub shrink_ratio: AccountShrinkThreshold,
27 pub read_cache_limit_bytes: Option<(usize, usize)>,
30 pub read_cache_evict_sample_size: Option<usize>,
33 pub write_cache_limit_bytes: Option<u64>,
34 pub ancient_append_vec_offset: Option<i64>,
37 pub ancient_storage_ideal_size: Option<u64>,
38 pub max_ancient_storages: Option<usize>,
39 pub skip_initial_hash_calc: bool,
40 pub exhaustively_verify_refcounts: bool,
41 pub partitioned_epoch_rewards_config: PartitionedEpochRewardsConfig,
42 pub storage_access: StorageAccess,
43 pub scan_filter_for_shrinking: ScanFilter,
44 pub mark_obsolete_accounts: MarkObsoleteAccounts,
45 pub num_background_threads: Option<NonZeroUsize>,
47 pub num_foreground_threads: Option<NonZeroUsize>,
49 pub memlock_budget_size: usize,
53}
54
55pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
56 index: Some(ACCOUNTS_INDEX_CONFIG_FOR_TESTING),
57 account_indexes: None,
58 base_working_path: None,
59 shrink_paths: None,
60 shrink_ratio: DEFAULT_ACCOUNTS_SHRINK_THRESHOLD_OPTION,
61 read_cache_limit_bytes: None,
62 read_cache_evict_sample_size: None,
63 write_cache_limit_bytes: None,
64 ancient_append_vec_offset: None,
65 ancient_storage_ideal_size: None,
66 max_ancient_storages: None,
67 skip_initial_hash_calc: false,
68 exhaustively_verify_refcounts: false,
69 partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
70 storage_access: StorageAccess::File,
71 scan_filter_for_shrinking: ScanFilter::OnlyAbnormalTest,
72 mark_obsolete_accounts: MarkObsoleteAccounts::Disabled,
73 num_background_threads: None,
74 num_foreground_threads: None,
75 memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,
76};
77
78pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig {
79 index: Some(ACCOUNTS_INDEX_CONFIG_FOR_BENCHMARKS),
80 account_indexes: None,
81 base_working_path: None,
82 shrink_paths: None,
83 shrink_ratio: DEFAULT_ACCOUNTS_SHRINK_THRESHOLD_OPTION,
84 read_cache_limit_bytes: None,
85 read_cache_evict_sample_size: None,
86 write_cache_limit_bytes: None,
87 ancient_append_vec_offset: None,
88 ancient_storage_ideal_size: None,
89 max_ancient_storages: None,
90 skip_initial_hash_calc: false,
91 exhaustively_verify_refcounts: false,
92 partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
93 storage_access: StorageAccess::File,
94 scan_filter_for_shrinking: ScanFilter::OnlyAbnormal,
95 mark_obsolete_accounts: MarkObsoleteAccounts::Disabled,
96 num_background_threads: None,
97 num_foreground_threads: None,
98 memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,
99};