Documentation
¶
Overview ¶
Package command owns the command model — the atomic unit of intent that flows through the CQRS engine. Controllers observe Kubernetes events, translate them into Commands, and hand them to the Engine. The Engine routes each Command to the correct Domain by GVK. Domains act on the Command and never interact with the controller layer directly.
The flow is strictly one-directional:
controller-runtime event → Command → Engine → Domain → reconciliation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Type is the lifecycle operation being requested.
Type CommandType
// GVK identifies which Domain should handle this Command.
GVK schema.GroupVersionKind
// Obj is the current object instance. Always populated.
Obj client.Object
// Old is the pre-update object state. Populated only for CmdUpdate.
Old client.Object
// New is the post-update object state. Populated only for CmdUpdate.
// Equivalent to Obj on update — both are provided for clarity at call sites.
New client.Object
}
Command is the atomic unit of intent in the BlanketOps CQRS engine. It is constructed by a controller from a controller-runtime reconcile request and routed by the Engine to the Domain whose GVK matches.
Old and New are populated only for CmdUpdate — they carry the previous and current object state so Domain predicates can diff specs without a separate API fetch.
func (Command) Clone ¶
Clone returns a shallow copy of the Command with Obj deep-copied. Old and New are not deep-copied — they are reference-copied. Use Clone when dispatching a Command to an async worker or retry queue where the caller may mutate Obj after dispatch.
type CommandType ¶
type CommandType string
CommandType identifies the lifecycle operation being requested. Values align with the three controller-runtime event types and map directly to the CQRS create/update/delete intent model.
const ( // CmdCreate is dispatched when a new object is observed for the first time. CmdCreate CommandType = "create" // CmdUpdate is dispatched when an existing object's spec has changed. // The CanUpdate predicate on the Domain determines whether the change // is significant enough to trigger reconciliation. CmdUpdate CommandType = "update" // CmdDelete is dispatched when an object is being removed. Domains use // this to perform cleanup — cache invalidation, child resource teardown, // or finalizer processing. CmdDelete CommandType = "delete" )