operation

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPreDeployTimeout = 5 * time.Minute

DefaultPreDeployTimeout is the maximum duration to wait for a pre-deploy hook container to complete.

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 as part of the deployment plan.
	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() string

func (*CreateVolumeOperation) String

func (o *CreateVolumeOperation) String() string

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.
	Format() 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
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName     string
	Container       api.ServiceContainer
	StopGracePeriod *time.Duration
}

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() string

func (*RemoveContainerOperation) String

func (o *RemoveContainerOperation) String() string

type ReplaceContainerOperation

type ReplaceContainerOperation struct {
	ServiceID string
	Spec      api.ServiceSpec
	MachineID string
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName  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
	StopGracePeriod   *time.Duration
}

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() string

func (*ReplaceContainerOperation) String

func (o *ReplaceContainerOperation) String() string

type RunContainerOperation

type RunContainerOperation struct {
	ServiceID string
	Spec      api.ServiceSpec
	MachineID string
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName 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() string

func (*RunContainerOperation) String

func (o *RunContainerOperation) String() string

type RunPreDeployOperation added in v0.18.0

type RunPreDeployOperation struct {
	ServiceID string
	Spec      api.ServiceSpec
	MachineID string
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName string
	// OldContainerIDs are pre-deploy hook containers from previous deployments to remove.
	OldContainerIDs []string
}

RunPreDeployOperation runs a one-shot pre-deploy hook container before service deployment.

func (*RunPreDeployOperation) Execute added in v0.18.0

func (o *RunPreDeployOperation) Execute(ctx context.Context, cli Client) error

func (*RunPreDeployOperation) Format added in v0.18.0

func (o *RunPreDeployOperation) Format() string

func (*RunPreDeployOperation) String added in v0.18.0

func (o *RunPreDeployOperation) 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() string

func (*SequenceOperation) String

func (o *SequenceOperation) String() string

type StopContainerOperation

type StopContainerOperation struct {
	ServiceID   string
	ContainerID string
	MachineID   string
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName     string
	StopGracePeriod *time.Duration
}

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() string

func (*StopContainerOperation) String

func (o *StopContainerOperation) String() string

type StopPreDeployOperation added in v0.18.0

type StopPreDeployOperation struct {
	MachineID string
	// MachineName is used for formatting the operation as part of the deployment plan.
	MachineName string
	Container   api.ServiceContainer
}

StopPreDeployOperation stops a running pre-deploy hook container from a previous deployment.

func (*StopPreDeployOperation) Execute added in v0.18.0

func (o *StopPreDeployOperation) Execute(ctx context.Context, cli Client) error

func (*StopPreDeployOperation) Format added in v0.18.0

func (o *StopPreDeployOperation) Format() string

func (*StopPreDeployOperation) String added in v0.18.0

func (o *StopPreDeployOperation) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL