interfaces

package
v0.0.0-...-bd1a880 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package interfaces defines common interfaces used across the application

Package interfaces defines common interfaces for Docker operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComposeOrchestrator

type ComposeOrchestrator interface {
	Deploy(ctx context.Context, composeFile *models.ComposeFile, options models.DeployOptions) error   // Use models.DeployOptions
	Remove(ctx context.Context, composeFile *models.ComposeFile, options models.RemoveOptions) error   // Use models.RemoveOptions
	Start(ctx context.Context, composeFile *models.ComposeFile, options models.StartOptions) error     // Use models.StartOptions
	Stop(ctx context.Context, composeFile *models.ComposeFile, options models.StopOptions) error       // Use models.StopOptions
	Restart(ctx context.Context, composeFile *models.ComposeFile, options models.RestartOptions) error // Use models.RestartOptions
	Scale(ctx context.Context, composeFile *models.ComposeFile, options models.ScaleOptions) error     // Use models.ScaleOptions
}

ComposeOrchestrator defines interfaces for Docker Compose orchestration

type ComposeService

type ComposeService interface {
	// Parse reads and parses a Docker Compose configuration from an io.Reader
	Parse(ctx context.Context, reader io.Reader, options models.ParseOptions) (*models.ComposeFile, error) // Use models.ParseOptions

}

ComposeService defines interfaces for Docker Compose parsing and validation

type ComposeStatusTracker

type ComposeStatusTracker interface {
	// AddDeployment adds a deployment to track, returning the info struct
	AddDeployment(projectName string, composeFile *models.ComposeFile) *models.DeploymentInfo // Use models.DeploymentInfo

	// GetDeployment gets a deployment by project name
	GetDeployment(projectName string) (*models.DeploymentInfo, bool) // Use models.DeploymentInfo

	// GetDeployments gets all deployments
	GetDeployments() []*models.DeploymentInfo // Use models.DeploymentInfo

	// RemoveDeployment removes a deployment
	RemoveDeployment(projectName string) bool

	// UpdateDeploymentStatus updates the status of a deployment
	UpdateDeploymentStatus(projectName string, deploymentStatus models.DeploymentStatus, err error) bool // Use models.DeploymentStatus

	// UpdateServiceStatus updates the status of a service
	UpdateServiceStatus(projectName, serviceName string, serviceStatus models.ServiceStatus, containerID string, err error) bool // Use models.ServiceStatus

	// UpdateServiceHealth updates the health of a service
	UpdateServiceHealth(projectName, serviceName string, health *models.HealthInfo) bool // Use models.HealthInfo

	// StartOperation starts an operation for a deployment
	StartOperation(projectName string, operationType models.OperationType, details map[string]interface{}) (*models.OperationInfo, bool) // Use models types

	// CompleteOperation completes an operation for a deployment
	CompleteOperation(projectName string, operationStatus models.OperationStatus, err error) bool // Use models types

	// Watch returns a channel that receives deployment updates
	Watch() <-chan *models.DeploymentInfo // Use models.DeploymentInfo

	// Unwatch removes a watcher channel
	Unwatch(ch <-chan *models.DeploymentInfo) // Use models.DeploymentInfo

	// Stop stops the tracker's background processes (like event listening)
	Stop()

	// GetServiceContainerID gets the first container ID for a service (if any)
	GetServiceContainerID(projectName, serviceName string) (string, bool)

	// GetServiceContainerIDs gets all container IDs for a service
	GetServiceContainerIDs(projectName, serviceName string) ([]string, bool)

	// GetServiceStatus gets the status of a specific service
	GetServiceStatus(projectName, serviceName string) (models.ServiceStatus, bool) // Use models.ServiceStatus
}

ComposeStatusTracker defines interfaces for tracking Docker Compose deployment status

type ContainerService

type ContainerService interface {
	// Adjusted signature to match expected usage in orchestrator.go
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform string, containerName string) (container.CreateResponse, error)
	ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
	ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error
	ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)       // Use types.ContainerJSON
	ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) // Use types.Container
	NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
}

ContainerService defines methods for container operations

type ImageService

type ImageService interface {
	ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error)
	// ImageBuild(ctx context.Context, buildContext io.Reader, options image.BuildOptions) (image.BuildResponse, error) // Removed problematic method for now
	ImageInspectWithRaw(ctx context.Context, imageID string) (image.InspectResponse, []byte, error)
	ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error)
}

ImageService defines methods for image operations

type NetworkService

type NetworkService interface {
	NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
	NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error)
	NetworkList(ctx context.Context, options network.ListOptions) ([]network.Summary, error)
	NetworkRemove(ctx context.Context, networkID string) error
	NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
	NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error
}

NetworkService defines methods for network operations (already likely defined elsewhere, ensure consistency)

type VolumeService

type VolumeService interface {
	VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
	VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
	VolumeList(ctx context.Context, filter filters.Args) (volume.ListResponse, error) // Use imported type
	VolumeRemove(ctx context.Context, volumeID string, force bool) error
	InspectRaw(ctx context.Context, name string) (volume.Volume, error) // Added InspectRaw based on usage

}

VolumeService defines methods for volume operations (already likely defined elsewhere, ensure consistency)

Jump to

Keyboard shortcuts

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