Skip to main content

ReplicationSection

Struct ReplicationSection 

Source
pub struct ReplicationSection {
    pub role: ReplicationRole,
    pub upstream: Option<String>,
    pub listen_port_base: u16,
    pub replication_buffer_size: u64,
    pub reconnect_window_ms: u32,
    pub min_replicas_to_write: u32,
    pub min_replicas_max_lag_ms: u32,
    pub replica_max_staleness_ms: u32,
    pub replica_read_only: bool,
    pub single_source: bool,
}
Expand description

[replication] section — primary/replica streaming replication. When role = "standalone" (default) this whole subsystem is dormant: no listener, no upstream connection, no buffer allocated. role = "primary" brings up a TCP listener on listen_port that streams every applied mutation to connected replicas. role = "replica" connects to upstream, full-syncs from a snapshot, then applies live frames.

Quorum failover is configured separately via the [cluster] node_id + peers keys; see crate::cluster::ClusterSection.

Fields§

§role: ReplicationRole

Node role. Standalone (default) disables the whole subsystem.

§upstream: Option<String>

host:port of the primary, for role = "replica". Ignored when role != "replica". None for replica = config-error at startup.

§listen_port_base: u16

TCP port BASE the primary listens on for incoming replica connections — shard i binds at listen_port_base + i, mirroring the cluster listener pattern. 0 (default) = server.port + 10000 as the base, picked at startup. Only meaningful when role = "primary". Replicas use a shard-aware client that connects to all nshards ports to mirror the full keyspace.

§replication_buffer_size: u64

Bounded ring buffer for recent applied frames (bytes). A replica that disconnects and reconnects within this backlog window catches up without a full snapshot. Default 256mb.

§reconnect_window_ms: u32

How long the primary keeps a disconnected replica’s slot before dropping it (and forcing a full snapshot on reconnect). Default 60_000 (60 s).

§min_replicas_to_write: u32

v3.14 D5 — primary refuses writes when fewer than this many replicas have a live ACK within min_replicas_max_lag_ms. 0 (default) disables the check. A lag heuristic, not a quorum guarantee — the quorum lease (v3.16) is the real split-brain fence.

§min_replicas_max_lag_ms: u32

Freshness window for min_replicas_to_write (ms).

§replica_max_staleness_ms: u32

v3.16 D3 — bounded staleness: a replica whose last primary heartbeat is older than this refuses reads with -STALE (client falls back to the primary). 0 = off (default: reads always answer, whatever the lag).

§replica_read_only: bool

v3.14 — reject client writes while in the replica role (-READONLY). Default true, Redis-compatible; the replication apply path and admin verbs bypass the gate.

§single_source: bool

v3.2 — the upstream is a SINGLE stream on one port (an embedded writer’s embed_writer_listen_addr source) rather than a per-shard port fleet: one routing runner fans frames into local shards by key hash. Only meaningful when role = "replica".

Trait Implementations§

Source§

impl Clone for ReplicationSection

Source§

fn clone(&self) -> ReplicationSection

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 ReplicationSection

Source§

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

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

impl Default for ReplicationSection

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ReplicationSection

Source§

impl PartialEq for ReplicationSection

Source§

fn eq(&self, other: &ReplicationSection) -> 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 ReplicationSection

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