d_engine_core/config/storage.rs
1use serde::Deserialize;
2use serde::Serialize;
3
4use crate::Result;
5
6/// Storage engine infrastructure configuration.
7///
8/// Controls low-level storage backend behavior, independent of Raft protocol
9/// semantics. Sits at the same level as `network` and `tls` — infrastructure,
10/// not protocol behavior.
11#[derive(Serialize, Deserialize, Clone, Default)]
12pub struct StorageConfig {
13 /// Use a single shared RocksDB instance (4 column families) instead of two
14 /// separate DB instances (one for Raft log + meta, one for state machine).
15 ///
16 /// When `true`: one 128 MB block cache, one background thread pool, one
17 /// file-descriptor budget — halves resource usage on developer machines.
18 ///
19 /// When `false` (default): each DB instance manages its own resources,
20 /// providing stronger isolation between the log and state machine workloads.
21 #[serde(default)]
22 pub unified_db: bool,
23}
24
25impl StorageConfig {
26 pub fn validate(&self) -> Result<()> {
27 Ok(())
28 }
29}