pub struct RedDBOptions {Show 23 fields
pub mode: StorageMode,
pub data_path: Option<PathBuf>,
pub read_only: bool,
pub create_if_missing: bool,
pub verify_checksums: bool,
pub durability_mode: DurabilityMode,
pub group_commit: GroupCommitOptions,
pub auto_checkpoint_pages: u32,
pub cache_pages: usize,
pub snapshot_retention: usize,
pub export_retention: usize,
pub feature_gates: CapabilitySet,
pub force_create: bool,
pub metadata: BTreeMap<String, String>,
pub remote_backend: Option<Arc<dyn RemoteBackend>>,
pub remote_backend_atomic: Option<Arc<dyn AtomicRemoteBackend>>,
pub remote_key: Option<String>,
pub replication: ReplicationConfig,
pub auth: AuthConfig,
pub auto_index_id: bool,
pub layout: StorageLayout,
pub layout_overrides: LayoutOverrides,
pub layout_explicit: bool,
}Fields§
§mode: StorageMode§data_path: Option<PathBuf>§read_only: bool§create_if_missing: bool§verify_checksums: bool§durability_mode: DurabilityMode§group_commit: GroupCommitOptions§auto_checkpoint_pages: u32§cache_pages: usize§snapshot_retention: usize§export_retention: usize§feature_gates: CapabilitySet§force_create: bool§metadata: BTreeMap<String, String>§remote_backend: Option<Arc<dyn RemoteBackend>>Optional remote storage backend for snapshot transport.
remote_backend_atomic: Option<Arc<dyn AtomicRemoteBackend>>Optional CAS-capable handle to the same backend, populated by
the factory when the configured backend implements
AtomicRemoteBackend (S3/local always; HTTP only when
RED_HTTP_CONDITIONAL_WRITES=true). None for backends that
do not provide compare-and-swap (Turso, D1, plain HTTP).
LeaseStore and any future CAS consumer pull from this field.
remote_key: Option<String>Remote object key used by the remote backend.
replication: ReplicationConfigReplication configuration.
auth: AuthConfigAuthentication & authorization configuration.
auto_index_id: boolAuto-create a HASH index on a user id column the first time a
row carrying that column is inserted into a collection. See
UnifiedStoreConfig::auto_index_id. Defaults to true; set to
false to opt out per workload (e.g. ingest pipelines that
don’t need point-lookups by id).
layout: StorageLayoutTiered storage layout preset. Drives the defaults of the six
tier-flag toggles (.meta.json sidecar, seq-N catalog journal,
-shm provisioning, audit/slow log destinations, fold_pager_meta,
fold_dwb_into_wal). Explicit per-feature setters still win over
the tier default. See crate::storage::layout::StorageLayout.
layout_overrides: LayoutOverridesPer-feature overrides applied on top of the resolved layout preset.
layout_explicit: boolTrue only when the caller explicitly selected a layout via
with_layout. When false, apply_tier_defaults short-circuits so
pre-existing process-global toggles (set by tests / env hatches
before opening a runtime) are not clobbered by the implicit
Standard default. The new tier-driven behavior is opt-in.
Implementations§
Source§impl RedDBOptions
impl RedDBOptions
pub fn persistent<P: Into<PathBuf>>(path: P) -> Self
Sourcepub fn in_memory() -> Self
pub fn in_memory() -> Self
Ephemeral, tempfile-backed database.
The underlying storage is a real persistent file placed under the system
temp directory with a unique name — there is no longer a true in-memory
execution mode. Prefer RedDBOptions::persistent when the data should
outlive the process.
pub fn with_mode(self, mode: StorageMode) -> Self
pub fn with_data_path<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_read_only(self, read_only: bool) -> Self
pub fn with_auto_checkpoint(self, pages: u32) -> Self
pub fn with_durability_mode(self, mode: DurabilityMode) -> Self
pub fn with_group_commit_window_ms(self, window_ms: u64) -> Self
pub fn with_group_commit_max_statements(self, max_statements: usize) -> Self
pub fn with_group_commit_max_wal_bytes(self, max_wal_bytes: u64) -> Self
pub fn with_cache_pages(self, pages: usize) -> Self
pub fn with_snapshot_retention(self, limit: usize) -> Self
pub fn with_export_retention(self, limit: usize) -> Self
pub fn with_metadata<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self
Sourcepub fn with_auto_index_id(self, enabled: bool) -> Self
pub fn with_auto_index_id(self, enabled: bool) -> Self
Toggle the implicit HASH index on user id columns at first
insert (#112). Defaults to enabled — pass false to fall back
to the legacy “scan unless CREATE INDEX is issued” behaviour.
pub fn with_capability(self, capability: Capability) -> Self
Sourcepub fn with_remote_backend(
self,
backend: Arc<dyn RemoteBackend>,
key: impl Into<String>,
) -> Self
pub fn with_remote_backend( self, backend: Arc<dyn RemoteBackend>, key: impl Into<String>, ) -> Self
Attach a remote storage backend for snapshot transport.
On open, the database snapshot is downloaded from the remote key
to the local data path. On flush, the local file is uploaded back
to the remote backend under the same key.
Sourcepub fn with_atomic_remote_backend(
self,
backend: Arc<dyn AtomicRemoteBackend>,
) -> Self
pub fn with_atomic_remote_backend( self, backend: Arc<dyn AtomicRemoteBackend>, ) -> Self
Attach a CAS-capable backend handle. Pass the same Arc as
with_remote_backend (factories should construct the backend
once and call both setters); this method exists so the type
system, not runtime config, decides whether LeaseStore is
reachable.
pub fn with_replication(self, config: ReplicationConfig) -> Self
pub fn with_auth(self, config: AuthConfig) -> Self
pub fn resolved_path(&self, fallback: impl AsRef<Path>) -> PathBuf
pub fn remote_namespace_prefix(&self) -> String
pub fn default_backup_head_key(&self) -> String
pub fn default_snapshot_prefix(&self) -> String
pub fn default_wal_archive_prefix(&self) -> String
pub fn has_capability(&self, capability: Capability) -> bool
Sourcepub fn with_layout(self, layout: StorageLayout) -> Self
pub fn with_layout(self, layout: StorageLayout) -> Self
Select the active storage-layout preset. Drives tier defaults for the six tier-flag toggles. Per-feature setters still win.
Sourcepub fn with_layout_overrides(self, overrides: LayoutOverrides) -> Self
pub fn with_layout_overrides(self, overrides: LayoutOverrides) -> Self
Override individual layout knobs (dedicated dirs + log routing) on top of the active preset.
Sourcepub fn resolve_tiered_layout(&self) -> Option<(PathBuf, TieredLayoutPaths)>
pub fn resolve_tiered_layout(&self) -> Option<(PathBuf, TieredLayoutPaths)>
Resolve (data_path, TieredLayoutPaths) for this options bundle.
Returns None when data_path is unset (in-memory ephemeral
instances don’t materialise a support tree).
Sourcepub fn apply_tier_defaults(&self)
pub fn apply_tier_defaults(&self)
Flip the process-global tier-flag toggles to match this options
bundle’s layout, and stash the resolved [TieredLayoutPaths] for
status surfaces. Idempotent. Per-feature env escape hatches
(REDDB_META_JSON_SIDECAR=... and friends) still override what
this method sets — they are read inside the per-toggle getter, not
here.
Tier defaults:
| toggle | minimal | standard | performance | max |
|---|---|---|---|---|
.meta.json sidecar | off | off | off | on |
| seq-N catalog journal | off | off | off | on |
-shm provisioning | off | on | on | on |
fold_pager_meta | off | off | off | on |
fold_dwb_into_wal | off | off | off | on |
| audit/slow log destination | stderr | stderr | file | file |
Retention for the seq-N journal: 32 at Max, 4 when the operator
opts in on a lower tier via REDDB_SEQN_JOURNAL=1.
Trait Implementations§
Source§impl Clone for RedDBOptions
impl Clone for RedDBOptions
Source§impl Debug for RedDBOptions
impl Debug for RedDBOptions
Auto Trait Implementations§
impl Freeze for RedDBOptions
impl !RefUnwindSafe for RedDBOptions
impl Send for RedDBOptions
impl Sync for RedDBOptions
impl Unpin for RedDBOptions
impl UnsafeUnpin for RedDBOptions
impl !UnwindSafe for RedDBOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request