Skip to main content

DurabilityMode

Enum DurabilityMode 

Source
pub enum DurabilityMode {
    Local,
    Hybrid,
    DurablyReplicated,
}
Expand description

Operator-facing durability mode. Each variant maps to one of three named policies that compose the underlying Clause list directly in code, replacing the legacy --durability-policy <STRING> DSL. See docs/replication.md for the three-tier menu in operational terms.

clap::ValueEnum derives --durability-mode <local|hybrid|durably-replicated>.

Variants§

§

Local

persisted>=1. Single-node durability — the primary’s PLP-backed NVMe write is the only confirmation needed. Required when running with --standalone; appropriate for dev/staging deployments without a replica.

§

Hybrid

persisted>=1 && in_memory>=2. One durable copy on the primary’s disk plus an in-memory ack from a second node. Single-failure-safe with a brief RAM-only window (~80 µs on PLP-backed NVMe) for the secondary copy. The default — typical live trading deployments. Saves ~50–80 µs per fill vs DurablyReplicated. Fails closed when no replica is connected.

§

DurablyReplicated

persisted>=2. Two durable copies before client ack. Zero RAM-only window; the gate stalls if no replica is currently connected. Compliance-driven venues.

Implementations§

Source§

impl DurabilityMode

Source

pub fn to_policy(self) -> Policy

Build the underlying Policy for this mode. Every variant’s clause list is hand-constructed from in-range counts, so Policy::new cannot fail — any regression would surface in the unit tests below.

Source

pub fn as_str(self) -> &'static str

CLI / log-friendly name. Matches the clap::ValueEnum kebab-cased spelling.

Source

pub fn parse(s: &str) -> Option<Self>

Parse the admin-channel / CLI wire spelling. Accepts the same kebab-cased strings as_str emits so operators only have to learn one vocabulary across --durability-mode and the admin DURABILITY command.

Source

pub fn as_u8(self) -> u8

Stable u8 discriminant. The response stage publishes the operator-selected mode through an [AtomicU8] so it can detect a runtime swap (via the admin DURABILITY command) with a relaxed load on every gate iteration — cheaper than crossing a Mutex or carrying a refcounted Arc<Policy> snapshot. Values are part of the in-process ABI between admin and response, not a wire format; they must remain stable so the round-trip from_u8(as_u8(x)) == Some(x) always holds.

Source

pub fn from_u8(b: u8) -> Option<Self>

Inverse of [as_u8]. Returns None for an unknown byte — callers initialise the atomic from a valid mode and the admin path only writes as_u8(parse(s)?), so an unknown byte indicates memory corruption or a programmer bug. The response stage logs and retains the prior mode in that case rather than silently falling back.

Trait Implementations§

Source§

impl Clone for DurabilityMode

Source§

fn clone(&self) -> DurabilityMode

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 DurabilityMode

Source§

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

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

impl Display for DurabilityMode

Source§

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

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

impl PartialEq for DurabilityMode

Source§

fn eq(&self, other: &DurabilityMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ValueEnum for DurabilityMode

Source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
Source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue>

The canonical argument value. Read more
Source§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
Source§

impl Copy for DurabilityMode

Source§

impl Eq for DurabilityMode

Source§

impl StructuralPartialEq for DurabilityMode

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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