Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operation ¶
type Operation struct {
Type OperationType
ResourceID string // e.g. "service:web:1", "network:backend", "volume:data"
Cause string // why this operation is needed
// Resource-specific data (only the relevant fields are set per operation type)
Service *types.ServiceConfig // for container operations
Container *container.Summary // existing container (for stop/remove)
Inherited *container.Summary // container to inherit anonymous volumes from (for create-as-replacement)
Number int // container replica number (for create)
Name string // target container/resource name
Network *types.NetworkConfig // for network operations
Volume *types.VolumeConfig // for volume operations
Timeout *time.Duration // for stop operations
CreateNodeID int // for OpRenameContainer/start-phase ops: ID of the CreateContainer node whose result to target
Condition string // for OpWaitCondition: depends_on condition to wait for (service_healthy, ...)
HookIndex int // for OpCreateHookContainer: position of the hook in the service's hook list
// RemoveVolumes asks OpRemoveContainer to also remove the container's
// anonymous volumes — what removing a hook-runner container has always done.
RemoveVolumes bool
// BestEffort marks an operation whose failure must not abort the plan.
// Used for the optional removal of the old network on a rename (if the
// network is still in use by non-Compose containers the removal is skipped
// with a warning — the new network already carries a different name), and
// for purging stale pre_start hook runners (a failed removal only warns:
// it leaves the container visible, never blocks).
BestEffort bool
}
Operation describes a single atomic action to be performed by the executor.
type OperationType ¶
type OperationType int
OperationType identifies the kind of atomic operation in a reconciliation plan. Each operation maps to exactly one Docker API call.
const ( // Network operations OpCreateNetwork OperationType = 1 OpRemoveNetwork OperationType = 2 OpDisconnectNetwork OperationType = 3 OpConnectNetwork OperationType = 4 // Volume operations OpCreateVolume OperationType = 10 OpRemoveVolume OperationType = 11 // Container operations OpCreateContainer OperationType = 20 OpStartContainer OperationType = 21 OpStopContainer OperationType = 22 OpRemoveContainer OperationType = 23 OpRenameContainer OperationType = 24 // Provider operations OpRunProvider OperationType = 30 // Start-phase operations OpWaitCondition OperationType = 40 OpRunPreStart OperationType = 41 OpRunPostStart OperationType = 42 // Hook operations OpCreateHookContainer OperationType = 43 )
OperationType values are explicit so that adding a new op in the middle of the list does not silently shift other values.
func (OperationType) String ¶
func (o OperationType) String() string
String returns the human-readable name of an OperationType.
type Plan ¶
type Plan struct {
Nodes []*PlanNode
// contains filtered or unexported fields
}
Plan is a directed acyclic graph of operations produced by the reconciler. Nodes are stored in topological order (dependencies before dependents).
func (*Plan) String ¶
String renders the plan as a human-readable graph for testing and debugging.
Format per line: [dep1,dep2] -> #id resource, operation, cause [group]
Examples:
[] -> #1 network:default, CreateNetwork, not found [1] -> #2 service:web:1, CreateContainer, no existing container [2] -> #3 service:web:1, StopContainer, replaced by #2 [recreate:web:1]
type PlanNode ¶
type PlanNode struct {
ID int // numeric identifier (#1, #2, ...)
Operation Operation
DependsOn []*PlanNode // prerequisite operations
Group string // event grouping key (e.g. "recreate:web:1"); empty for ungrouped nodes
Phase PlanPhase // lifecycle phase this node belongs to; zero is Create
}
PlanNode is a single node in the reconciliation DAG. It represents one atomic operation and its dependencies on other nodes.
type PlanPhase ¶
type PlanPhase int
PlanPhase situates a node in the plan lifecycle. The Create phase converges resources and containers to their desired shape; the Start phase brings containers to running — dependency waits, pre_start hooks, starts, post_start hooks. The zero value is Create, so plans built before the start phase existed render unchanged.