Skip to main content

Module strategy

Module strategy 

Source
Expand description

The pure strategy interface and the strategy implementations.

A strategy is two pure functions over (observed cluster state, now):

  • Strategy::update_state returns the durable writes the strategy wants (cut-overs, record writes/clears). The controller transacts these in the tick’s first phase.
  • Strategy::desired_replicas returns the replica slots the strategy contributes to the cluster’s desired set. The controller unions every strategy’s contribution in the tick’s second phase.

Both are pure: same inputs, same output, no I/O. The controller is the sole mutator. Strategies never touch the ClusterControllerCtx; the controller assembles their inputs by pulling through it.

Structs§

BaselineStrategy
The implicit baseline strategy, always present.
DesiredReplica
A replica slot a strategy desires this tick. The reconcile kernel unions slots across strategies and matches them by ReplicaShape against the actual replica set.

Constants§

BASELINE_STRATEGY_NAME
The audit-attribution name of the baseline strategy.

Traits§

Strategy
One cluster-autoscaling strategy: a pair of pure functions the controller runs each tick. See the module docs.