Skip to main content

RepConfig

Struct RepConfig 

Source
pub struct RepConfig {
Show 20 fields pub group_name: String, pub node_name: String, pub node_host: String, pub node_port: u16, pub node_type: NodeType, pub election_timeout: Duration, pub heartbeat_interval: Duration, pub consistency_policy: ConsistencyPolicy, pub commit_durability: CommitDurability, pub env_home: Option<PathBuf>, pub quorum_policy: QuorumPolicy, pub phi_threshold: Option<f64>, pub phi_window_size: usize, pub initial_peers: Vec<RepNode>, pub election_phase_timeout: Duration, pub reconnect_config: ReconnectConfig, pub transport_kind: RepTransportKind, pub peer_allowlist: Vec<String>, pub tls_config: Option<TlsConfig>, pub cascade_feeding: bool,
}
Expand description

Configuration for a replication node.

Use the builder pattern to construct.

Fields§

§group_name: String

Name of the replication group.

§node_name: String

Name of this node within the group (must be unique).

§node_host: String

Hostname or IP address for this node.

§node_port: u16

Port for replication communication.

§node_type: NodeType

Type of this node.

§election_timeout: Duration

Timeout for elections.

§heartbeat_interval: Duration

Interval between heartbeat messages.

§consistency_policy: ConsistencyPolicy

Default consistency policy for read operations.

§commit_durability: CommitDurability

Default commit durability for replicated transactions.

The ack_timeout field on commit_durability governs the commit-side wait for replica acks; there is no separate per-RepConfig replica-ack timeout.

§env_home: Option<PathBuf>

Path to the local environment home directory (.ndb files).

When set, ReplicatedEnvironment registers a NetworkRestoreServer on the service dispatcher so that other nodes can restore from this node via the "RESTORE" service.

§quorum_policy: QuorumPolicy

Quorum policy for elections. Default: SimpleMajority.

§phi_threshold: Option<f64>

Phi accrual suspicion threshold.

None (default) uses a binary heartbeat timeout. Some(8.0) enables phi accrual detection with the paper’s recommended threshold (mistake rate ≈ 10⁻⁸).

§phi_window_size: usize

Sliding-window size for phi accrual inter-arrival samples.

Default 200 is adequate for LAN; use 1000 for WAN.

§initial_peers: Vec<RepNode>

Fully-described peers added to the replication group at startup.

Useful for pre-populating quoracle capacity/latency metadata.

§election_phase_timeout: Duration

Timeout per peer message exchange during Phase 1 and Phase 2 of an election. Default: 500 ms.

§reconnect_config: ReconnectConfig

Reconnection backoff configuration for replica partition recovery.

§transport_kind: RepTransportKind

Wire-level transport this node will use.

This field lets callers declare whether they intend to drive replication over TCP, TLS, QUIC, or the in-process crate::net::InMemoryTransport. See RepTransportKind for the variants. Defaults to RepTransportKind::Tcp for backward compatibility.

§peer_allowlist: Vec<String>

Allowlist of peer subject names for mTLS enforcement (Phase 2, v3.1.0).

When non-empty and RepTransportKind::Tls is configured, the server will:

  1. Require a client certificate on every incoming TLS connection.
  2. Validate the chain against the CA roots in the TlsConfig.
  3. Check subject names — the peer’s Subject Common Name (CN) and every DNS Subject Alternative Name (SAN) entry are compared case-insensitively against this list. If none match, the handshake is aborted before any application data is exchanged.

Matching is exact (no wildcards). Names are compared case-insensitively. Whitespace-only and empty entries are ignored.

The client side automatically presents its own certificate when the TlsConfig identity is PemFiles or PemBytes.

§Empty list

An empty list means no peers are admitted (PeerAllowlistVerifier returns an error at construction time, which surfaces as a RepError::ConfigError from TlsConfig::to_rustls_server_config_with_allowlist). This is intentional fail-closed behaviour: an empty allowlist is almost certainly a misconfiguration.

§Transport requirement

Enforcement requires transport_kind = RepTransportKind::Tls. With plain TCP there is no TLS handshake and therefore no cert to inspect. Setting this field with a non-TLS transport emits a log::warn!.

§tls_config: Option<TlsConfig>

TLS configuration for the service dispatcher (Phase 3).

When set and transport_kind is RepTransportKind::Tls, crate::replicated_environment::ReplicatedEnvironment will start a TlsTcpServiceDispatcher (feature tls-rustls) instead of the plain-TCP dispatcher. Combined with a non-empty peer_allowlist, this enforces mTLS on every incoming replication connection at the dispatcher level.

None (the default) preserves the Phase-2 behaviour: the dispatcher uses plain TCP and the operator must wire TlsTcpChannelListener::bind_with_tls_and_allowlist separately.

§cascade_feeding: bool

Enable chained / replica-to-replica log feeding (default false).

When true, a node that becomes a replica ALSO runs a feeder source on its PEER_FEEDER service, serving the VLSN-tagged log stream from its OWN WAL to a downstream replica. This lets a mid-tier replica relay the stream (master → R1 → R2) instead of every replica connecting directly to the master.

Faithful to JE’s cascading-feeder model: FeederSource is documented as “a real Master OR a Replica in a Replica chain that is replaying log records it received from some other source” (FeederSource.java). The feeder source on a replica reads its VLSNIndex + log files exactly as MasterFeederSource does on the master, so the downstream’s syncup (REP-1) and live-apply (REP-7) work unchanged against a replica-feeder source.

Default false preserves master-direct behaviour: a replica does not feed downstream peers unless cascade is explicitly enabled.

Durability bound: a mid-tier replica does NOT count its downstream’s acks toward the master’s commit-durability quorum. JE evaluates the durability quorum at the master (FeederManager.getNumCurrentAckFeeders); a chained replica only tracks the downstream’s progress for its own VLSN/lag bookkeeping. A downstream replica is therefore never more durable than the entries its mid-tier has itself persisted.

Implementations§

Source§

impl RepConfig

Source

pub fn builder( group_name: &str, node_name: &str, node_host: &str, ) -> RepConfigBuilder

Creates a builder for RepConfig.

Source

pub fn new( group_name: impl Into<String>, node_name: impl Into<String>, node_host: impl Into<String>, node_port: u16, ) -> RepConfig

Convenience constructor matching the original v1.4 shape.

Equivalent to builder(group, node, host).node_port(port).build(). Provided so doc snippets and short tests don’t need to write the full builder chain. “RepConfig::new example”).

Source

pub fn socket_address(&self) -> String

Returns the socket address string for this node.

Trait Implementations§

Source§

impl Clone for RepConfig

Source§

fn clone(&self) -> RepConfig

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 RepConfig

Source§

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

Formats the value using the given formatter. Read more

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V