Expand description
The cluster controller: the single decision-maker for the replica set of every managed cluster.
It is a reconciler. Each tick it reads desired cluster state and live
signals through the ClusterControllerCtx boundary, runs a set of pure
Strategys, unions their desired contributions, diffs that against the
actual replica set, and emits the create/drop and durable-state-write
Decisions that close the gap. It holds no in-memory state: the source of
truth is always the catalog plus live signals, pulled fresh each tick.
The crate is pure. It depends only on primitive id/shape types and the
ClusterControllerCtx trait, never on the adapter or catalog. That
boundary is what makes the controller testable against a fake
implementation and extractable later without touching controller code.
A tick runs two phases per cluster, update_state then desired_replicas
(see ClusterController::reconcile). Every Decision carries the
durable state it was derived from, and the apply path transacts it only if
that state still holds (compare-and-append). So a create or drop derived
from a pre-ALTER snapshot can never reshape the replica set against the
config the ALTER has since established. Applies are per cluster, so one
cluster’s rejection does not block the others, and commands name explicit
replicas, so re-emitting one across a lagging view or a restart is a no-op.
Modules§
- ctx
- The boundary between the controller and its environment.
- strategy
- The pure strategy interface and the strategy implementations.
Structs§
- Cluster
Controller - The cluster controller. Holds the (stateless) set of strategies and drives a
reconcile tick against a
ClusterControllerCtx.