use std::path::{Path, PathBuf};
use bytesize::ByteSize;
use serde::{Deserialize, Serialize};
use tycho_util::config::PartialConfig;
#[derive(Debug, Clone, Serialize, Deserialize, PartialConfig)]
#[serde(deny_unknown_fields, default)]
pub struct StorageConfig {
#[important]
pub root_dir: PathBuf,
pub rocksdb_enable_metrics: bool,
#[important]
pub rocksdb_lru_capacity: ByteSize,
}
impl StorageConfig {
pub fn new_potato(path: &Path) -> Self {
Self {
root_dir: path.to_owned(),
rocksdb_enable_metrics: false,
rocksdb_lru_capacity: ByteSize::mib(1),
}
}
}
impl Default for StorageConfig {
fn default() -> Self {
Self {
root_dir: PathBuf::from("./db"),
rocksdb_enable_metrics: true,
rocksdb_lru_capacity: ByteSize::gib(2),
}
}
}