pub struct RedexFileConfig {
pub persistent: bool,
pub fsync_policy: FsyncPolicy,
pub max_memory_bytes: usize,
pub retention_max_events: Option<u64>,
pub retention_max_bytes: Option<u64>,
pub retention_max_age_ns: Option<u64>,
pub tail_buffer_size: usize,
pub replication: Option<ReplicationConfig>,
pub blob_adapter_id: Option<String>,
pub blob_adapter_registry: Option<Arc<BlobAdapterRegistry>>,
}Expand description
Per-file configuration supplied at Redex::open_file time.
Was Copy pre-replication. The replication field carries a
Vec<NodeId> when PlacementStrategy::Pinned is in use, so
the type is now Clone-only. The struct is small and rarely
passed in hot paths; existing callers add a .clone() where they
previously relied on bit-copy semantics.
Fields§
§persistent: boolHeap-only (false) vs heap + simple disk segment (true).
true requires the redex-disk feature and a persistent
base directory configured on the owning Redex manager via
Redex::with_persistent_dir. With no base dir, open_file
returns an error.
With redex-disk off, this field is silently ignored — the
file is heap-only regardless.
fsync_policy: FsyncPolicyDisk fsync policy for persistent files. Ignored when
persistent == false. Defaults to FsyncPolicy::Never.
max_memory_bytes: usizeInitial reservation hint for the heap payload segment. Used
only as the capacity passed to the backing Vec on open,
capped at 64 MiB internally — the segment grows past this
value on append up to a 3 GB hard limit. Retention is NOT
driven by this field in v1; use retention_max_events,
retention_max_bytes, or retention_max_age_ns for that.
v2’s warm-tier rollover will consume this value as the rollover trigger (see REDEX_V2_PLAN §3).
retention_max_events: Option<u64>Keep only the newest K events. None = unbounded.
retention_max_bytes: Option<u64>Keep only the newest M bytes of payload. None = unbounded.
retention_max_age_ns: Option<u64>Drop entries older than this many nanoseconds at the next
super::RedexFile::sweep_retention tick. Age is measured
against SystemTime::now() at append time.
v2 limitation: per-entry timestamps are in-memory only. On reopen of a persistent file, all recovered entries get “now” as their fake timestamp — age retention starts fresh from the reopen moment. v2 mmap tier will persist timestamps.
tail_buffer_size: usizePer-subscription buffer depth for tail() streams. Caps the
memory a slow subscriber can pin at tail_buffer_size * avg_event_size. Subscribers that can’t drain this many
pending events get disconnected with a best-effort
RedexError::Lagged signal.
Tune up for bursty workloads with brief consumer pauses; tune down to reclaim memory faster from misbehaving subscribers. Default: 1024.
replication: Option<ReplicationConfig>Cross-node replication opt-in per
docs/plans/REDEX_DISTRIBUTED_PLAN.md §1. None (default)
keeps the file single-node; Some(cfg) opts the channel
into the ReplicationCoordinator lifecycle Phase C wires.
Validate via cfg.validate() before committing to a
Redex; Phase C’s Redex::open_file will surface a typed
ReplicationConfigError if the field is Some(cfg) with
cfg.validate().is_err().
blob_adapter_id: Option<String>Dataforts Phase 3 — id of the BlobAdapter (from the
dataforts module, gated behind the dataforts
feature) this channel’s events resolve against when an
event payload’s first byte is the BlobRef
discriminator. None (default) means callers of
RedexFile::resolve_one MUST pass an adapter
explicitly; Some(id) lets them route through
global_blob_adapter_registry() automatically. The
field is advisory metadata at the RedEX layer —
substrate reads still return raw payload bytes; the
resolution decision happens at the convenience read
helpers.
blob_adapter_registry: Option<Arc<BlobAdapterRegistry>>Per-channel override for the blob adapter registry. None
(default) routes through global_blob_adapter_registry();
Some(reg) looks blob_adapter_id up in the supplied
registry instead. Used by multi-tenant binding hosts to
scope adapter ids per tenant — a tenant’s
register_blob_adapter("s3-primary", ...) lands in its own
registry without colliding with another tenant’s same-named
adapter.
Wrapped in Arc so the config is Clone-cheap and
multiple channels can share one registry.
Implementations§
Source§impl RedexFileConfig
impl RedexFileConfig
Sourcepub fn with_persistent(self, persistent: bool) -> Self
pub fn with_persistent(self, persistent: bool) -> Self
Enable persistent (disk-backed) storage.
Sourcepub fn with_fsync_policy(self, policy: FsyncPolicy) -> Self
pub fn with_fsync_policy(self, policy: FsyncPolicy) -> Self
Set the disk fsync policy. See FsyncPolicy for the
durability / latency trade-offs each variant offers.
Sourcepub fn with_max_memory_bytes(self, bytes: usize) -> Self
pub fn with_max_memory_bytes(self, bytes: usize) -> Self
Set the initial reservation size for the heap segment (capped
at 64 MiB internally). Does NOT enforce a retention cap — use
Self::with_retention_max_bytes for that.
Sourcepub fn with_retention_max_events(self, events: u64) -> Self
pub fn with_retention_max_events(self, events: u64) -> Self
Keep at most events entries.
Sourcepub fn with_retention_max_bytes(self, bytes: u64) -> Self
pub fn with_retention_max_bytes(self, bytes: u64) -> Self
Keep at most bytes bytes of payload.
Sourcepub fn with_retention_max_age(self, max_age: Duration) -> Self
pub fn with_retention_max_age(self, max_age: Duration) -> Self
Drop entries older than max_age. Measured in nanoseconds
against SystemTime::now() at append time.
Sourcepub fn with_tail_buffer_size(self, size: usize) -> Self
pub fn with_tail_buffer_size(self, size: usize) -> Self
Set the per-subscription buffer depth for tail() streams.
See the field doc on Self::tail_buffer_size.
Sourcepub fn with_replication(self, replication: Option<ReplicationConfig>) -> Self
pub fn with_replication(self, replication: Option<ReplicationConfig>) -> Self
Opt the channel into cross-node replication. Pass None to
restore single-node behavior. The supplied
ReplicationConfig should validate cleanly (see
ReplicationConfig::validate); Phase C’s Redex::open_file
surfaces validation errors typed.
Sourcepub fn with_blob_adapter_id(self, id: Option<String>) -> Self
pub fn with_blob_adapter_id(self, id: Option<String>) -> Self
Set the dataforts blob adapter id used by
RedexFile::resolve_one (under the dataforts
feature). Pass None to clear.
Sourcepub fn with_blob_adapter_registry(
self,
registry: Option<Arc<BlobAdapterRegistry>>,
) -> Self
pub fn with_blob_adapter_registry( self, registry: Option<Arc<BlobAdapterRegistry>>, ) -> Self
Bind a specific blob adapter registry for resolve_one to
look up blob_adapter_id against. None (default) falls
back to global_blob_adapter_registry(). Multi-tenant
binding hosts construct one registry per tenant and pass
it here to isolate adapter ids across tenants.
Trait Implementations§
Source§impl Clone for RedexFileConfig
impl Clone for RedexFileConfig
Source§fn clone(&self) -> RedexFileConfig
fn clone(&self) -> RedexFileConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more