1use std::path::{Path, PathBuf};
2
3use bytesize::ByteSize;
4use serde::{Deserialize, Serialize};
5use tycho_util::config::PartialConfig;
6
7#[derive(Debug, Clone, Serialize, Deserialize, PartialConfig)]
8#[serde(deny_unknown_fields, default)]
9pub struct StorageConfig {
10 #[important]
14 pub root_dir: PathBuf,
15
16 pub rocksdb_enable_metrics: bool,
20
21 #[important]
25 pub rocksdb_lru_capacity: ByteSize,
26}
27
28impl StorageConfig {
29 pub fn new_potato(path: &Path) -> Self {
31 Self {
32 root_dir: path.to_owned(),
33 rocksdb_enable_metrics: false,
34 rocksdb_lru_capacity: ByteSize::mib(1),
35 }
36 }
37}
38
39impl Default for StorageConfig {
40 fn default() -> Self {
41 Self {
42 root_dir: PathBuf::from("./db"),
43 rocksdb_enable_metrics: true,
44 rocksdb_lru_capacity: ByteSize::gib(2),
45 }
46 }
47}