Skip to main content

AckPolicy

Enum AckPolicy 

Source
pub enum AckPolicy {
    Disk,
    Ram,
    DiskAndRam,
    TwoDisks,
}
Expand description

Operator-facing ack policy: which copies of an event must exist before its response is released. Each variant maps to a named Clause list composed directly in code. See docs/replication.md for the menu in operational terms.

clap::ValueEnum derives --ack-policy <disk|ram|disk+ram|two-disks>; the disk+ram spelling is set explicitly because the derive would kebab-case the variant to disk-and-ram.

Variants§

§

Disk

persisted>=1. One fsynced copy, on whichever node’s disk confirms first. Required when running with --standalone; appropriate for dev/staging deployments without a replica.

§

Ram

in_memory>=2. Two nodes hold the event in memory before the client ack; every disk write trails asynchronously off the ack path (the journal still fsyncs every batch, it just no longer gates responses). Survives any single node failure via failover; loses only the un-fsynced tail on a simultaneous whole-cluster power loss. For deployments where fsync is slow (cloud block storage) or where that bounded RPO is an acceptable trade for the lowest ack latency. Fails closed when no replica is connected.

§

DiskAndRam

persisted>=1 && in_memory>=2. One fsynced copy plus a second copy in another node’s memory. Single-failure-safe with a brief RAM-only window (~80 µs on PLP-backed NVMe) for the second copy. The default — typical live deployments. Faster than TwoDisks: an acknowledgement waits for the second node to receive the event, not to fsync it. Fails closed when no replica is connected.

§

TwoDisks

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

Implementations§

Source§

impl AckPolicy

Source

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

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

Source

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

Parse the admin-channel / CLI wire spelling. Accepts exactly the strings as_str emits so operators only have to learn one vocabulary across --ack-policy and the admin ACK-POLICY command.

Source

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

Parse the pre-0.15 “durability mode” names, for the deprecated DURABILITY admin alias. Accepts the current spellings too so the alias is a strict superset of parse. Removed with the alias in the next minor release.

Source

pub fn as_u8(self) -> u8

Stable u8 discriminant: the byte a journaled AckPolicyChange carries (to_byte), and the one the health gauges export.

These values are a wire format, not just an in-process ABI: they are in every journal holding a policy change, streamed to every replica with the entries, and a replica decodes the one its lineage holds with from_byte to judge auto-promotion (see raft_promotion). So they must stay stable across releases in two directions — the round-trip from_u8(as_u8(x)) == Some(x) has to hold, and a value once released can never be reassigned to a different policy, or a peer on an older build would silently read the new policy as the old one. Add new policies on the next free byte; never renumber. (The bytes predate the current names: they were assigned to local/hybrid/durably-replicated/replicated and kept through the rename.)

A peer that does not know a byte gets None and refuses to auto-promote on it — fail-closed, and the reason replicas must be upgraded before a primary starts journaling a new policy.

Source

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

Inverse of as_u8. Returns None for an unknown byte — one a newer build wrote, or a bug. A primary refuses to start on a lineage holding one; the response stage, meeting one in a change it journaled itself, logs and retains the prior policy rather than silently falling back.

Trait Implementations§

Source§

impl Clone for AckPolicy

Source§

fn clone(&self) -> Self

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 Copy for AckPolicy

Source§

impl Debug for AckPolicy

Source§

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

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

impl Display for AckPolicy

Source§

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

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

impl Eq for AckPolicy

Source§

impl PartialEq for AckPolicy

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AckPolicy

Source§

impl ValueEnum for AckPolicy

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.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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