Skip to main content

RedexFileConfig

Struct RedexFileConfig 

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

Heap-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: FsyncPolicy

Disk fsync policy for persistent files. Ignored when persistent == false. Defaults to FsyncPolicy::Never.

§max_memory_bytes: usize

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

Per-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

Source

pub fn new() -> Self

Start from defaults.

Source

pub fn with_persistent(self, persistent: bool) -> Self

Enable persistent (disk-backed) storage.

Source

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.

Source

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.

Source

pub fn with_retention_max_events(self, events: u64) -> Self

Keep at most events entries.

Source

pub fn with_retention_max_bytes(self, bytes: u64) -> Self

Keep at most bytes bytes of payload.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> RedexFileConfig

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 RedexFileConfig

Source§

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

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

impl Default for RedexFileConfig

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