Skip to main content

StorageConfig

Struct StorageConfig 

Source
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: usize

Cache size in MB

§write_buffer_size_mb: usize

Write buffer size in MB

§enable_compression: bool

Enable compression

§sync_writes: bool

Sync writes to disk

§disable_wal: bool

Disable 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: bool

When 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

Source

pub const fn with_cache_mb(self, size_mb: usize) -> Self

Set cache size in MB.

Source

pub const fn with_write_buffer_mb(self, size_mb: usize) -> Self

Set write buffer size in MB.

Source

pub const fn with_sync_writes(self) -> Self

Enable synchronous writes to disk.

Source

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).

Source

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.

Source

pub const fn with_ttl(self, ttl: Duration) -> Self

Enable TTL (time-to-live) for records.

Trait Implementations§

Source§

impl Clone for StorageConfig

Source§

fn clone(&self) -> StorageConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StorageConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StorageConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more