pub struct ReplicationConfig {
pub role: ReplicationRole,
pub term: u64,
pub poll_interval_ms: u64,
pub max_batch_size: usize,
pub region: String,
pub quorum: QuorumConfig,
pub slot_retention_max_lag_lsn: u64,
pub slot_idle_timeout_ms: u64,
pub replica_class: ReplicaClass,
pub cascade_from: Option<CascadeUpstream>,
}Expand description
Configuration for replication.
Fields§
§role: ReplicationRole§term: u64Current replication term/epoch stamped into WAL-derived records.
poll_interval_ms: u64How often replica polls for new WAL records (milliseconds).
max_batch_size: usizeMaximum batch size for WAL record transfer.
region: StringRegion identifier for this instance (Phase 2.6 multi-region).
Used by the quorum coordinator to spread write acks across
fault domains: QuorumConfig::required_regions forces a commit
to wait until at least one replica in each listed region has
acked. Defaults to "local" for single-region deployments.
quorum: QuorumConfigQuorum configuration (Phase 2.6 multi-region).
slot_retention_max_lag_lsn: u64Maximum LSN lag a replication slot may pin before the primary invalidates it and allows WAL pruning to continue.
slot_idle_timeout_ms: u64Maximum wall-clock idle age for a slot before invalidation.
replica_class: ReplicaClassStreaming class (issue #838). A ReplicaClass::Voting node is on the
durability/election path and always streams directly from the primary;
a ReplicaClass::AsyncReadReplica may cascade from an intermediate.
Defaults to Voting — a node only cascades when explicitly declared a
read-replica.
cascade_from: Option<CascadeUpstream>Optional intermediate replica to cascade from (issue #838). Honoured
only for an async read-replica; a voting member refuses it and streams
directly from the primary. See ReplicationConfig::resolved_upstream.
Implementations§
Source§impl ReplicationConfig
impl ReplicationConfig
pub fn standalone() -> ReplicationConfig
pub fn primary() -> ReplicationConfig
pub fn replica(primary_addr: impl Into<String>) -> ReplicationConfig
Sourcepub fn with_quorum(self, quorum: QuorumConfig) -> ReplicationConfig
pub fn with_quorum(self, quorum: QuorumConfig) -> ReplicationConfig
Attach a quorum configuration (fluent setter).
Sourcepub fn with_region(self, region: impl Into<String>) -> ReplicationConfig
pub fn with_region(self, region: impl Into<String>) -> ReplicationConfig
Set the region identifier (fluent setter).
Sourcepub fn with_term(self, term: u64) -> ReplicationConfig
pub fn with_term(self, term: u64) -> ReplicationConfig
Set the replication term stamped into newly produced records.
pub fn with_slot_retention_max_lag_lsn( self, max_lag_lsn: u64, ) -> ReplicationConfig
pub fn with_slot_idle_timeout_ms(self, timeout_ms: u64) -> ReplicationConfig
Sourcepub fn with_replica_class(self, class: ReplicaClass) -> ReplicationConfig
pub fn with_replica_class(self, class: ReplicaClass) -> ReplicationConfig
Set the streaming class explicitly (issue #838).
Sourcepub fn cascading_from(
self,
node_id: impl Into<String>,
addr: impl Into<String>,
) -> ReplicationConfig
pub fn cascading_from( self, node_id: impl Into<String>, addr: impl Into<String>, ) -> ReplicationConfig
Declare this node an async read-replica that cascades from intermediate
(issue #838). Sets ReplicaClass::AsyncReadReplica and the cascade
source together — the only combination that actually streams from an
intermediate. A node left at the default Voting class ignores any
cascade source and streams directly from the primary.
Sourcepub fn resolved_upstream(
&self,
self_node_id: &str,
) -> (UpstreamChoice, Option<CascadeRefusal>)
pub fn resolved_upstream( &self, self_node_id: &str, ) -> (UpstreamChoice, Option<CascadeRefusal>)
Resolve where this node should open its WAL stream, applying the
cascade policy (issue #838). A voting member always resolves to the
primary even when a cascade source is configured; the returned
CascadeRefusal explains any fallback so it is observable rather
than silent. self_node_id guards against a node cascading from its
own slot.
Trait Implementations§
Source§impl Clone for ReplicationConfig
impl Clone for ReplicationConfig
Source§fn clone(&self) -> ReplicationConfig
fn clone(&self) -> ReplicationConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReplicationConfig
impl RefUnwindSafe for ReplicationConfig
impl Send for ReplicationConfig
impl Sync for ReplicationConfig
impl Unpin for ReplicationConfig
impl UnsafeUnpin for ReplicationConfig
impl UnwindSafe for ReplicationConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request