pub struct StorageConfig {
pub cache_size_mb: usize,
pub write_buffer_size_mb: usize,
pub enable_compression: bool,
pub sync_writes: bool,
pub disable_wal: bool,
pub ttl: Option<Duration>,
pub shard_count: Option<usize>,
pub in_memory: bool,
}Expand description
Configuration for storage backends.
Fields§
§cache_size_mb: usizeCache size in MB
write_buffer_size_mb: usizeWrite buffer size in MB
enable_compression: boolEnable compression
sync_writes: boolSync writes to disk
disable_wal: boolDisable write-ahead log (WAL).
Default: true — Yeti follows Harper’s “WAL off by default for
user data, durability via replication” model (harperfast/harper
resources/databases.ts:openRocksDatabase defaults disableWAL ??= true). User-data backends opened via create_rocksdb_backend_manager
inherit this default. System databases that need crash durability
(yeti-auth, yeti-admin, yeti-audit, yeti-queue,
fabric/control-plane stores) are opened with with_wal_enabled() in
crates/runtime/yeti-server/src/app_loader/backends.rs.
ttl: Option<Duration>Time-to-live for records (None = disabled)
shard_count: Option<usize>Override shard count (default: num_cpus / 2, min 2)
in_memory: boolWhen true, ALL tables use the in-memory backend (HashMap)
rather than RocksDB — typical for ephemeral sidecar
deployments, cache-tier nodes, and dev environments. Per-table
BackendType::InMemory is the more targeted knob: operators
who want one volatile table alongside persistent ones should
use that instead. RocksDB-specific knobs above are ignored
when this is true.
Implementations§
Source§impl StorageConfig
impl StorageConfig
Sourcepub const fn with_cache_mb(self, size_mb: usize) -> Self
pub const fn with_cache_mb(self, size_mb: usize) -> Self
Set cache size in MB.
Sourcepub const fn with_write_buffer_mb(self, size_mb: usize) -> Self
pub const fn with_write_buffer_mb(self, size_mb: usize) -> Self
Set write buffer size in MB.
Sourcepub const fn with_sync_writes(self) -> Self
pub const fn with_sync_writes(self) -> Self
Enable synchronous writes to disk.
Sourcepub const fn with_disable_wal(self) -> Self
pub const fn with_disable_wal(self) -> Self
Disable the Write-Ahead-Log explicitly. Default is already
disable_wal: true, so this is now a no-op idempotent setter — kept
for call-sites that want the intent visible in code (e.g. test
fixtures, doc examples).
Sourcepub const fn with_wal_enabled(self) -> Self
pub const fn with_wal_enabled(self) -> Self
Enable the Write-Ahead-Log. Use for backends that hold data with no
recovery path other than the WAL — yeti-auth (users/roles),
yeti-admin (app catalog), yeti-audit (audit log itself),
yeti-queue (durable queue), and fabric/control-plane state.
Roughly 6× slower writes vs. WAL-off on the bench harness; the
tradeoff is crash durability without replication.
Trait Implementations§
Source§impl Clone for StorageConfig
impl Clone for StorageConfig
Source§fn clone(&self) -> StorageConfig
fn clone(&self) -> StorageConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more