Documentation
¶
Overview ¶
Package status provides functionality for monitoring Docker Compose service status
Package status provides functionality for tracking Docker Compose deployment status
Index ¶
- type DockerStatusAPIClient
- type ProjectStatus
- type ServiceStatus
- type ServiceStatusManager
- func (m *ServiceStatusManager) AddProject(projectName string, serviceNames []string)
- func (m *ServiceStatusManager) GetProjectStatus(projectName string) (map[string]models.ServiceStatusInfo, bool)
- func (m *ServiceStatusManager) RemoveProject(projectName string)
- func (m *ServiceStatusManager) Stop()
- func (m *ServiceStatusManager) StopEventMonitoring()
- func (m *ServiceStatusManager) Unwatch(ch chan models.DeploymentUpdate)
- func (m *ServiceStatusManager) Watch() <-chan models.DeploymentUpdate
- type ServiceStatusManagerOptions
- type StatusTracker
- type Tracker
- func (t *Tracker) AddDeployment(projectName string, composeFile *models.ComposeFile) *models.DeploymentInfo
- func (t *Tracker) CompleteOperation(projectName string, status models.OperationStatus, err error) bool
- func (t *Tracker) GetDeployment(projectName string) (*models.DeploymentInfo, bool)
- func (t *Tracker) GetDeployments() []*models.DeploymentInfo
- func (t *Tracker) GetServiceContainerID(projectName, serviceName string) (string, bool)
- func (t *Tracker) GetServiceContainerIDs(projectName, serviceName string) ([]string, bool)
- func (t *Tracker) GetServiceStatus(projectName, serviceName string) (models.ServiceStatus, bool)
- func (t *Tracker) RemoveDeployment(projectName string) bool
- func (t *Tracker) StartOperation(projectName string, operationType models.OperationType, ...) (*models.OperationInfo, bool)
- func (t *Tracker) Stop()
- func (t *Tracker) Unwatch(ch <-chan *models.DeploymentInfo)
- func (t *Tracker) UpdateDeploymentStatus(projectName string, status models.DeploymentStatus, err error) bool
- func (t *Tracker) UpdateServiceHealth(projectName, serviceName string, health *models.HealthInfo) bool
- func (t *Tracker) UpdateServiceStatus(projectName, serviceName string, status models.ServiceStatus, ...) bool
- func (t *Tracker) Watch() <-chan *models.DeploymentInfo
- type TrackerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerStatusAPIClient ¶
type DockerStatusAPIClient interface {
Events(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error) // Use events.ListOptions
ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
}
DockerStatusAPIClient defines the minimal interface needed by the status manager
type ProjectStatus ¶
type ProjectStatus struct {
Name string
Services map[string]*ServiceStatus // Map service name to status
// contains filtered or unexported fields
}
ProjectStatus holds the status information for a single Compose project
type ServiceStatus ¶
type ServiceStatus struct {
Name string
Status models.ServiceStatus // e.g., Running, Exited, Pending
ContainerIDs []string // IDs of containers belonging to this service
Health *models.HealthInfo // Use models.HealthInfo
Error error // Last error encountered
UpdateTime time.Time
// contains filtered or unexported fields
}
ServiceStatus holds the status information for a single service
type ServiceStatusManager ¶
type ServiceStatusManager struct {
// contains filtered or unexported fields
}
ServiceStatusManager monitors the status of services within Docker Compose projects
func NewServiceStatusManager ¶
func NewServiceStatusManager(options ServiceStatusManagerOptions) (*ServiceStatusManager, error)
NewServiceStatusManager creates a new ServiceStatusManager
func (*ServiceStatusManager) AddProject ¶
func (m *ServiceStatusManager) AddProject(projectName string, serviceNames []string)
AddProject starts tracking a new Compose project
func (*ServiceStatusManager) GetProjectStatus ¶
func (m *ServiceStatusManager) GetProjectStatus(projectName string) (map[string]models.ServiceStatusInfo, bool)
GetProjectStatus retrieves the current status of all services in a project
func (*ServiceStatusManager) RemoveProject ¶
func (m *ServiceStatusManager) RemoveProject(projectName string)
RemoveProject stops tracking a Compose project
func (*ServiceStatusManager) Stop ¶
func (m *ServiceStatusManager) Stop()
Stop stops the ServiceStatusManager and cleans up resources
func (*ServiceStatusManager) StopEventMonitoring ¶
func (m *ServiceStatusManager) StopEventMonitoring()
StopEventMonitoring stops the Docker event monitoring stream
func (*ServiceStatusManager) Unwatch ¶
func (m *ServiceStatusManager) Unwatch(ch chan models.DeploymentUpdate)
Unwatch stops sending updates to a specific channel
func (*ServiceStatusManager) Watch ¶
func (m *ServiceStatusManager) Watch() <-chan models.DeploymentUpdate
Watch returns a channel that receives updates for any tracked project
type ServiceStatusManagerOptions ¶
type ServiceStatusManagerOptions struct {
Client DockerStatusAPIClient // Use the interface
Logger *logrus.Logger
UpdateChannel chan<- models.DeploymentUpdate
}
ServiceStatusManagerOptions holds options for creating a ServiceStatusManager
type StatusTracker ¶
type StatusTracker interface {
GetDeployment(projectName string) (*models.DeploymentInfo, bool) // Use models.DeploymentInfo
}
StatusTracker defines the interface for tracking deployment status, specifically the methods needed by the ComposeService. Note: This interface might be redundant if interfaces.ComposeStatusTracker is used consistently.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker tracks the status of Docker Compose deployments
func NewTracker ¶
func NewTracker(options TrackerOptions) *Tracker
NewTracker creates a new status tracker
func (*Tracker) AddDeployment ¶
func (t *Tracker) AddDeployment(projectName string, composeFile *models.ComposeFile) *models.DeploymentInfo
AddDeployment adds a deployment to track
func (*Tracker) CompleteOperation ¶
func (t *Tracker) CompleteOperation(projectName string, status models.OperationStatus, err error) bool
CompleteOperation completes an operation for a deployment
func (*Tracker) GetDeployment ¶
func (t *Tracker) GetDeployment(projectName string) (*models.DeploymentInfo, bool)
GetDeployment gets a deployment by project name
func (*Tracker) GetDeployments ¶
func (t *Tracker) GetDeployments() []*models.DeploymentInfo
GetDeployments gets all deployments
func (*Tracker) GetServiceContainerID ¶
GetServiceContainerID returns the first container ID for a service
func (*Tracker) GetServiceContainerIDs ¶
GetServiceContainerIDs returns all container IDs for a service
func (*Tracker) GetServiceStatus ¶
func (t *Tracker) GetServiceStatus(projectName, serviceName string) (models.ServiceStatus, bool)
GetServiceStatus returns the status of a service
func (*Tracker) RemoveDeployment ¶
RemoveDeployment removes a deployment
func (*Tracker) StartOperation ¶
func (t *Tracker) StartOperation(projectName string, operationType models.OperationType, details map[string]interface{}) (*models.OperationInfo, bool)
StartOperation starts an operation for a deployment
func (*Tracker) Unwatch ¶
func (t *Tracker) Unwatch(ch <-chan *models.DeploymentInfo)
Unwatch removes a watcher channel
func (*Tracker) UpdateDeploymentStatus ¶
func (t *Tracker) UpdateDeploymentStatus(projectName string, status models.DeploymentStatus, err error) bool
UpdateDeploymentStatus updates the status of a deployment
func (*Tracker) UpdateServiceHealth ¶
func (t *Tracker) UpdateServiceHealth(projectName, serviceName string, health *models.HealthInfo) bool
UpdateServiceHealth updates the health of a service
func (*Tracker) UpdateServiceStatus ¶
func (t *Tracker) UpdateServiceStatus(projectName, serviceName string, status models.ServiceStatus, containerID string, err error) bool
UpdateServiceStatus updates the status of a service
func (*Tracker) Watch ¶
func (t *Tracker) Watch() <-chan *models.DeploymentInfo
Watch returns a channel that receives deployment updates
type TrackerOptions ¶
type TrackerOptions struct {
// EventsCh is the channel for Docker events
EventsCh <-chan events.Message
// ErrorsCh is the channel for errors from the Docker events stream
ErrorsCh <-chan error
// Logger is the logger to use
Logger *logrus.Logger
}
TrackerOptions defines options for creating a status tracker