Skip to main content

Module replication

Module replication 

Source
Expand description

Replication Module

Implements single-primary, multi-replica replication via WAL streaming.

§Architecture

  • Primary: accepts writes and streams WAL records to replicas
  • Replica: read-only, connects to primary for WAL streaming
  • Initial sync via snapshot transfer, then incremental WAL

§Usage

// Primary
let options = RedDBOptions::persistent("./primary-data")
    .with_replication(ReplicationConfig::primary());

// Replica
let options = RedDBOptions::persistent("./replica-data")
    .with_replication(ReplicationConfig::replica("http://primary:50051"));

Re-exports§

pub use commit_policy::CommitPolicy;
pub use commit_waiter::AwaitOutcome;
pub use commit_waiter::CommitWaiter;
pub use lease::LeaseError;
pub use lease::LeaseStore;
pub use lease::WriterLease;
pub use quorum::QuorumConfig;
pub use quorum::QuorumCoordinator;
pub use quorum::QuorumError;
pub use topology_advertiser::LagConfig;
pub use topology_advertiser::TopologyAdvertiser;
pub use topology_advertiser::TopologyAuthGate;
pub use topology_advertiser::DEFAULT_REPLICA_TIMEOUT_MS;
pub use topology_advertiser::TOPOLOGY_READ_CAPABILITY;

Modules§

cdc
Change Data Capture (CDC) — stream of database change events.
commit_policy
Primary commit policies (PLAN.md Phase 11.4).
commit_waiter
Synchronous commit waiter (PLAN.md Phase 11.4 — ack_n).
lease
Serverless writer lease (PLAN.md Phase 5 / W6).
logical
Logical replication helpers shared by replica apply and point-in-time restore.
primary
Primary-side replication: WAL record production and snapshot serving.
quorum
Quorum-based commit coordination (Phase 2.6 multi-region PG parity).
replica
Replica-side replication: connects to primary, consumes WAL records.
scheduler
Backup Scheduler — automatic periodic snapshots with optional remote upload.
topology_advertiser
Server-side TopologyAdvertiser (issue #167).

Structs§

ReplicationConfig
Configuration for replication.

Enums§

ReplicationRole
Role of this RedDB instance in a replication cluster.