Skip to main content

Module replication

Module replication 

Source
Expand description

W-of-N quorum-write layer for the peer-mesh sync (v0.7 track C).

This module scaffolds the quorum-write contract described in docs/ADR-0001-quorum-replication.md. The QuorumWriter sits ABOVE the existing sync-daemon — deployments that don’t configure --quorum-writes keep the v0.6.0 one-way push behaviour byte-for-byte.

§What ships in this PR

  • QuorumPolicy — configuration: N peers, W quorum size, timeouts.
  • QuorumWriter::commit — the atomic-from-caller contract: local write + W-1 remote acks within deadline, else QuorumError::QuorumNotMet.
  • AckTracker — collects remote acks with a simple Instant deadline. Pure logic, no network — so the unit tests don’t need a live sync mesh.
  • Metrics: replication_quorum_ack_total{result}, replication_quorum_failures_total{reason}, replication_clock_skew_seconds.

§What does NOT ship in this PR

  • Wiring into the memory_store path — follow-up PR once the sync-daemon gains a synchronous ack channel.
  • Real chaos harness — follow-up PR under tests/chaos/ with three-node fixture and failure-injection hooks.

That phasing matches the ADR’s implementation plan.

Structs§

AckTracker
Collects remote acks against a deadline. Pure logic — no I/O.
QuorumPolicy
Operator-tunable quorum policy. See ADR-0001 § Model for the complete contract.

Enums§

QuorumError
Errors surfaced by the quorum writer. Non-exhaustive so we can add variants without breaking downstream matches.
QuorumFailureReason
Reason a quorum failed — reported in metrics.