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: StringName of the replication group.
node_name: StringName of this node within the group (must be unique).
node_host: StringHostname or IP address for this node.
node_port: u16Port for replication communication.
node_type: NodeTypeType of this node.
election_timeout: DurationTimeout for elections.
heartbeat_interval: DurationInterval between heartbeat messages.
consistency_policy: ConsistencyPolicyDefault consistency policy for read operations.
commit_durability: CommitDurabilityDefault 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: QuorumPolicyQuorum 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: usizeSliding-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: DurationTimeout per peer message exchange during Phase 1 and Phase 2 of an election. Default: 500 ms.
reconnect_config: ReconnectConfigReconnection backoff configuration for replica partition recovery.
transport_kind: RepTransportKindWire-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:
- Require a client certificate on every incoming TLS connection.
- Validate the chain against the CA roots in the
TlsConfig. - 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: boolEnable 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
impl RepConfig
Sourcepub fn builder(
group_name: &str,
node_name: &str,
node_host: &str,
) -> RepConfigBuilder
pub fn builder( group_name: &str, node_name: &str, node_host: &str, ) -> RepConfigBuilder
Creates a builder for RepConfig.
Sourcepub fn new(
group_name: impl Into<String>,
node_name: impl Into<String>,
node_host: impl Into<String>,
node_port: u16,
) -> RepConfig
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”).
Sourcepub fn socket_address(&self) -> String
pub fn socket_address(&self) -> String
Returns the socket address string for this node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RepConfig
impl RefUnwindSafe for RepConfig
impl Send for RepConfig
impl Sync for RepConfig
impl Unpin for RepConfig
impl UnsafeUnpin for RepConfig
impl UnwindSafe for RepConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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