Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
api.ContainerClient
api.VolumeClient
}
Client defines the interface required to execute deployment operations.
type CreateVolumeOperation ¶
type CreateVolumeOperation struct {
VolumeSpec api.VolumeSpec
MachineID string
// MachineName is used for formatting the operation output only.
MachineName string
}
CreateVolumeOperation creates a volume on a specific machine.
func (*CreateVolumeOperation) Execute ¶
func (o *CreateVolumeOperation) Execute(ctx context.Context, cli Client) error
func (*CreateVolumeOperation) Format ¶
func (o *CreateVolumeOperation) Format(_ NameResolver) string
func (*CreateVolumeOperation) String ¶
func (o *CreateVolumeOperation) String() string
type NameResolver ¶
type NameResolver interface {
MachineName(machineID string) string
ContainerName(containerID string) string
}
NameResolver resolves machine and container IDs to their names.
type Operation ¶
type Operation interface {
// Execute performs the operation using the provided client.
Execute(ctx context.Context, cli Client) error
// Format returns a human-readable representation of the operation.
// TODO: get rid of the resolver and assign the required names for formatting in the operation itself.
Format(resolver NameResolver) string
String() string
}
Operation represents a single atomic operation in a deployment process. Operations can be composed to form complex deployment strategies.
type RemoveContainerOperation ¶
type RemoveContainerOperation struct {
MachineID string
Container api.ServiceContainer
}
RemoveContainerOperation stops and removes a container from a specific machine.
func (*RemoveContainerOperation) Execute ¶
func (o *RemoveContainerOperation) Execute(ctx context.Context, cli Client) error
func (*RemoveContainerOperation) Format ¶
func (o *RemoveContainerOperation) Format(resolver NameResolver) string
func (*RemoveContainerOperation) String ¶
func (o *RemoveContainerOperation) String() string
type ReplaceContainerOperation ¶
type ReplaceContainerOperation struct {
ServiceID string
Spec api.ServiceSpec
MachineID string
OldContainer api.ServiceContainer
// Order specifies the update order: "start-first" or "stop-first".
Order string
// SkipHealthMonitor skips the monitoring period and health checks after starting a new container.
SkipHealthMonitor bool
}
ReplaceContainerOperation replaces an old container with a new one based on the specified update order. For start-first: starts new container, then removes old container. For stop-first: stops old container, starts new container, then removes old container.
func (*ReplaceContainerOperation) Execute ¶
func (o *ReplaceContainerOperation) Execute(ctx context.Context, cli Client) error
func (*ReplaceContainerOperation) Format ¶
func (o *ReplaceContainerOperation) Format(resolver NameResolver) string
func (*ReplaceContainerOperation) String ¶
func (o *ReplaceContainerOperation) String() string
type RunContainerOperation ¶
type RunContainerOperation struct {
ServiceID string
Spec api.ServiceSpec
MachineID string
// SkipHealthMonitor skips the monitoring period and health checks after starting a container.
SkipHealthMonitor bool
}
RunContainerOperation creates and starts a new container on a specific machine.
func (*RunContainerOperation) Execute ¶
func (o *RunContainerOperation) Execute(ctx context.Context, cli Client) error
func (*RunContainerOperation) Format ¶
func (o *RunContainerOperation) Format(resolver NameResolver) string
func (*RunContainerOperation) String ¶
func (o *RunContainerOperation) String() string
type SequenceOperation ¶
type SequenceOperation struct {
Operations []Operation
}
SequenceOperation is a composite operation that executes a sequence of operations in order.
func (*SequenceOperation) Execute ¶
func (o *SequenceOperation) Execute(ctx context.Context, cli Client) error
func (*SequenceOperation) Format ¶
func (o *SequenceOperation) Format(resolver NameResolver) string
func (*SequenceOperation) String ¶
func (o *SequenceOperation) String() string
type StopContainerOperation ¶
StopContainerOperation stops a container on a specific machine.
func (*StopContainerOperation) Execute ¶
func (o *StopContainerOperation) Execute(ctx context.Context, cli Client) error
func (*StopContainerOperation) Format ¶
func (o *StopContainerOperation) Format(resolver NameResolver) string
func (*StopContainerOperation) String ¶
func (o *StopContainerOperation) String() string