Skip to main content

ClusterSection

Struct ClusterSection 

Source
pub struct ClusterSection {
    pub enabled: bool,
    pub port_base: u16,
    pub node_id: String,
    pub elect_port_base: u16,
    pub peers: Vec<PeerEntry>,
    pub scopes: Vec<ScopeEntry>,
}
Expand description

[cluster] section — single-node cluster mode: keys route by Redis-cluster slot (CRC16 {hashtag} & 16383) and every shard i gets a second, deterministic listener at port_base + i that answers wrong-shard keys with -MOVED, so stock cluster-aware clients (redis-benchmark --cluster, redis-cli -c) can address shards directly. The main SO_REUSEPORT port keeps full forward-anywhere behaviour for non-cluster clients. Not hot-settable: the routing scheme is a startup property of the data dir (shards.meta).

The struct is Clone but not Copy (since peers and scopes hold owned vectors). Most call sites just clone the per-tick Config snapshot via Arc<Config>, so this is invisible in the hot path.

Fields§

§enabled: bool

Enable cluster mode. Default false (zero change).

§port_base: u16

First cluster port (shard i listens at port_base + i). 0 (default) = server.port + 1.

§node_id: String

This node’s stable id for the quorum election (≤ 32 B ASCII; unique across the cluster). Default empty — kevy-elect is dormant unless both node_id and peers are set, so existing configs need no edit.

§elect_port_base: u16

First election-control listener port; shard i binds at elect_port_base + i. Default 0server.port + 200 (locked by the resolved_elect_port_base unit test).

§peers: Vec<PeerEntry>

Operator-declared peer list for kevy-elect. Empty when failover is not configured. Each entry is one cluster node (including potentially this node — kevy-elect filters self by matching node_id).

§scopes: Vec<ScopeEntry>

Scope declarations: each entry pins a key prefix to a writer node (and optional fallback). Empty when scope-based multi-writer is off. Same flat-string TOML shape as peersscopes = "prefix=writer[|fallback],...".

Trait Implementations§

Source§

impl Clone for ClusterSection

Source§

fn clone(&self) -> ClusterSection

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 ClusterSection

Source§

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

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

impl Default for ClusterSection

Source§

fn default() -> ClusterSection

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

impl Eq for ClusterSection

Source§

impl PartialEq for ClusterSection

Source§

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

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.