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
impl DurabilityMode
Sourcepub fn to_policy(self) -> Policy
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.
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
CLI / log-friendly name. Matches the clap::ValueEnum
kebab-cased spelling.
Sourcepub fn parse(s: &str) -> Option<Self>
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.
Sourcepub fn as_u8(self) -> u8
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.
Sourcepub fn from_u8(b: u8) -> Option<Self>
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
impl Clone for DurabilityMode
Source§fn clone(&self) -> DurabilityMode
fn clone(&self) -> DurabilityMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DurabilityMode
impl Debug for DurabilityMode
Source§impl Display for DurabilityMode
impl Display for DurabilityMode
Source§impl PartialEq for DurabilityMode
impl PartialEq for DurabilityMode
Source§fn eq(&self, other: &DurabilityMode) -> bool
fn eq(&self, other: &DurabilityMode) -> bool
self and other values to be equal, and is used by ==.