Documentation
¶
Overview ¶
Package policycontroller provides a small, reusable Observe → Decide → Act loop.
It is intentionally generic: domain packages supply concrete Observer, Evaluator, and Actuator implementations (inventory, pools, sandboxes, etc).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActuatorFunc ¶
ActuatorFunc adapts a function into an Actuator.
type Controller ¶
type Controller[T any, P any] struct { Observer Observer[T] Evaluator Evaluator[T, P] Actuator Actuator[P] Logger *slog.Logger }
Controller runs a single-pass (Reconcile) or looped (Run) policy controller.
type Decision ¶
Decision is the output of an evaluation pass.
If ShouldAct is false, the Controller will not call the Actuator.
type Evaluator ¶
type Evaluator[T any, P any] interface { Evaluate(ctx context.Context, observed T) (Decision[P], error) }
Evaluator compares observed state to its policy and returns a decision.
Policy is intentionally not modeled as a separate input: callers can embed policy in T, close over policy in the implementation, or compose it however they like.
type EvaluatorFunc ¶
EvaluatorFunc adapts a function into an Evaluator.
type ObserverFunc ¶
ObserverFunc adapts a function into an Observer.