Skip to content

Commit affa1f1

Browse files
committed
[Storage Config] Make db path override related fields private
This part of the config is exposed via the `get_dir_paths` API.
1 parent 8a38adc commit affa1f1

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

config/src/config/storage_config.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ pub const BUFFERED_STATE_TARGET_ITEMS_FOR_TEST: usize = 10;
2929

3030
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
3131
#[serde(default, deny_unknown_fields)]
32-
pub struct DbPathConfig {
33-
pub ledger_db_path: Option<PathBuf>,
34-
pub state_kv_db_path: Option<ShardedDbPathConfig>,
35-
pub state_merkle_db_path: Option<ShardedDbPathConfig>,
36-
pub hot_state_kv_db_path: Option<ShardedDbPathConfig>,
32+
struct DbPathConfig {
33+
ledger_db_path: Option<PathBuf>,
34+
state_kv_db_path: Option<ShardedDbPathConfig>,
35+
state_merkle_db_path: Option<ShardedDbPathConfig>,
36+
hot_state_kv_db_path: Option<ShardedDbPathConfig>,
3737
}
3838

3939
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
4040
#[serde(deny_unknown_fields)]
41-
pub struct ShardedDbPathConfig {
42-
pub metadata_path: Option<PathBuf>,
43-
pub shard_paths: Vec<ShardPathConfig>,
41+
struct ShardedDbPathConfig {
42+
metadata_path: Option<PathBuf>,
43+
shard_paths: Vec<ShardPathConfig>,
4444
}
4545

4646
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
4747
#[serde(deny_unknown_fields)]
48-
pub struct ShardPathConfig {
49-
pub shards: String,
50-
pub path: PathBuf,
48+
struct ShardPathConfig {
49+
shards: String,
50+
path: PathBuf,
5151
}
5252

5353
impl ShardedDbPathConfig {
@@ -284,7 +284,7 @@ pub struct StorageConfig {
284284
/// Fine grained control for db paths of individal databases/shards.
285285
/// If not specificed, will use `dir` as default.
286286
/// Only allowed when sharding is enabled.
287-
pub db_path_overrides: Option<DbPathConfig>,
287+
db_path_overrides: Option<DbPathConfig>,
288288
/// ensure `ulimit -n`, set to 0 to not ensure.
289289
pub ensure_rlimit_nofile: u64,
290290
/// panic if failed to ensure `ulimit -n`
@@ -740,10 +740,8 @@ impl ConfigSanitizer for StorageConfig {
740740

741741
#[cfg(test)]
742742
mod test {
743-
use crate::config::{
744-
config_optimizer::ConfigOptimizer, NodeConfig, NodeType, PrunerConfig, ShardPathConfig,
745-
ShardedDbPathConfig, StorageConfig,
746-
};
743+
use super::{ShardPathConfig, ShardedDbPathConfig, StorageConfig};
744+
use crate::config::{config_optimizer::ConfigOptimizer, NodeConfig, NodeType, PrunerConfig};
747745
use aptos_types::chain_id::ChainId;
748746

749747
#[test]

0 commit comments

Comments
 (0)