use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct WalConfig {
pub archive_enabled: bool,
pub archive_dir: PathBuf,
pub max_segments: usize,
pub max_archive_bytes: u64,
}
impl Default for WalConfig {
fn default() -> Self {
Self {
archive_enabled: true,
archive_dir: PathBuf::from("wal_archive"),
max_segments: 10,
max_archive_bytes: 10 * 1024 * 1024 * 1024, }
}
}
impl WalConfig {
pub fn no_archive() -> Self {
Self {
archive_enabled: false,
..Default::default()
}
}
pub fn with_archive_dir(archive_dir: impl Into<PathBuf>) -> Self {
Self {
archive_dir: archive_dir.into(),
..Default::default()
}
}
}