Documentation
¶
Index ¶
- type Container
- type ContainerOptions
- type ContainerRuntime
- type ContainerStats
- type ContainerStatus
- type EnvVar
- type HealthCheckStatus
- type Image
- type Manager
- func (m *Manager) BackupVolume(ctx context.Context, name string, outputPath string) error
- func (m *Manager) Close() error
- func (m *Manager) CreateContainer(ctx context.Context, name, image string, command []string, ...) (string, error)
- func (m *Manager) CreateContainerWithOptions(ctx context.Context, name, image string, command []string, ...) (string, error)
- func (m *Manager) CreateContainerWithOpts(ctx context.Context, opts ContainerOptions) (string, error)
- func (m *Manager) CreateContainerWithVolumes(ctx context.Context, image string, name string, envVars []EnvVar, ...) (string, error)
- func (m *Manager) CreateVolume(ctx context.Context, name string, opts map[string]string) error
- func (m *Manager) DeleteVolume(ctx context.Context, name string) error
- func (m *Manager) ExecInContainer(ctx context.Context, id string, command []string) (string, error)
- func (m *Manager) GetContainer(id string) (*api.Container, bool)
- func (m *Manager) GetContainerLogs(ctx context.Context, id string) (string, error)
- func (m *Manager) GetContainerMetrics(ctx context.Context, containerID string) (*ContainerStats, error)
- func (m *Manager) GetContainerStats(ctx context.Context, containerID string) (*api.ContainerStats, error)
- func (m *Manager) GetContainerStatus(ctx context.Context, id string) (string, error)
- func (m *Manager) GetContainers() []*api.Container
- func (m *Manager) IsVolumeInUse(ctx context.Context, name string) (bool, error)
- func (m *Manager) ListContainers(ctx context.Context) ([]api.Container, error)
- func (m *Manager) ListImages(ctx context.Context) ([]api.Image, error)
- func (m *Manager) ListVolumes(ctx context.Context) ([]*Volume, error)
- func (m *Manager) PullImage(ctx context.Context, image string) error
- func (m *Manager) RemoveContainer(ctx context.Context, id string) error
- func (m *Manager) RestoreVolume(ctx context.Context, name string, inputPath string) error
- func (m *Manager) StartContainer(ctx context.Context, id string) error
- func (m *Manager) StopContainer(ctx context.Context, containerID string) error
- func (m *Manager) WithNamespace(namespace string) *Manager
- func (m *Manager) WithRuntime(runtime ContainerRuntime) *Manager
- type PortMapping
- type ResourceLimits
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
ID string
Name string
Image string
Status ContainerStatus
NodeID string
CreatedAt time.Time
StartedAt *time.Time
StoppedAt *time.Time
Command []string
Env []EnvVar
Ports []PortMapping
Resources ResourceLimits
}
Container represents a container in the system
type ContainerOptions ¶
type ContainerOptions struct {
Name string
Image string
Command []string
Env []EnvVar
Ports []PortMapping
Volumes []Volume
Resources ResourceLimits
}
ContainerOptions represents options for creating a container
type ContainerRuntime ¶
type ContainerRuntime interface {
PullImage(ctx context.Context, image string) error
CreateContainer(ctx context.Context, opts ContainerOptions) (string, error)
StopContainer(ctx context.Context, containerID string) error
ListContainers(ctx context.Context) ([]*Container, error)
GetContainerMetrics(ctx context.Context, containerID string) (*ContainerStats, error)
CreateVolume(ctx context.Context, name string, opts map[string]string) error
DeleteVolume(ctx context.Context, name string) error
ListVolumes(ctx context.Context) ([]*Volume, error)
}
ContainerRuntime defines the interface for container runtime operations
type ContainerStats ¶
type ContainerStats struct {
CPUUsage float64 // Percentage
MemoryUsage uint64 // Bytes
NetworkRx uint64 // Bytes
NetworkTx uint64 // Bytes
LastUpdated int64 // Unix timestamp
}
ContainerStats represents resource usage statistics for a container
type ContainerStatus ¶
type ContainerStatus string
ContainerStatus represents the status of a container
const ( // ContainerStatusCreated indicates the container is created but not started ContainerStatusCreated ContainerStatus = "created" // ContainerStatusRunning indicates the container is running ContainerStatusRunning ContainerStatus = "running" // ContainerStatusStopped indicates the container is stopped ContainerStatusStopped ContainerStatus = "stopped" // ContainerStatusPaused indicates the container is paused ContainerStatusPaused ContainerStatus = "paused" // ContainerStatusFailed indicates the container failed to start or run ContainerStatusFailed ContainerStatus = "failed" )
type HealthCheckStatus ¶
type HealthCheckStatus string
HealthCheckStatus represents the health status of a container
const ( // HealthCheckHealthy indicates the container is healthy HealthCheckHealthy HealthCheckStatus = "healthy" // HealthCheckUnhealthy indicates the container is unhealthy HealthCheckUnhealthy HealthCheckStatus = "unhealthy" // HealthCheckUnknown indicates the container health is unknown HealthCheckUnknown HealthCheckStatus = "unknown" )
type Manager ¶
type Manager struct {
Runtime ContainerRuntime
// contains filtered or unexported fields
}
Manager handles interactions with the containerd daemon
func NewManager ¶
NewManager creates a new containerd manager
func NewManagerWithoutClient ¶
NewManagerWithoutClient creates a new containerd manager without connecting to containerd This is useful when using an alternative runtime like Docker
func (*Manager) BackupVolume ¶
BackupVolume backs up a volume to a file
func (*Manager) CreateContainer ¶
func (m *Manager) CreateContainer(ctx context.Context, name, image string, command []string, env map[string]string, volumes []string, ports map[string]string) (string, error)
CreateContainer implements the app.ContainerManager interface
func (*Manager) CreateContainerWithOptions ¶
func (m *Manager) CreateContainerWithOptions(ctx context.Context, name, image string, command []string, env map[string]string, volumes []string, ports map[string]string) (string, error)
CreateContainerWithOptions creates a new container with the given parameters
func (*Manager) CreateContainerWithOpts ¶
func (m *Manager) CreateContainerWithOpts(ctx context.Context, opts ContainerOptions) (string, error)
CreateContainerWithOptions creates a new container with the given options CreateContainerWithOpts creates a new container with the given ContainerOptions
func (*Manager) CreateContainerWithVolumes ¶
func (m *Manager) CreateContainerWithVolumes(ctx context.Context, image string, name string, envVars []EnvVar, ports []PortMapping, volumes []Volume) (string, error)
CreateContainerWithVolumes creates a new container with volume mounts
func (*Manager) CreateVolume ¶
CreateVolume creates a new volume
func (*Manager) DeleteVolume ¶
DeleteVolume deletes a volume
func (*Manager) ExecInContainer ¶
ExecInContainer executes a command in a container
func (*Manager) GetContainer ¶
GetContainer returns a container by ID
func (*Manager) GetContainerLogs ¶
GetContainerLogs returns the logs for a container
func (*Manager) GetContainerMetrics ¶
func (m *Manager) GetContainerMetrics(ctx context.Context, containerID string) (*ContainerStats, error)
GetContainerMetrics returns metrics for a container
func (*Manager) GetContainerStats ¶
func (m *Manager) GetContainerStats(ctx context.Context, containerID string) (*api.ContainerStats, error)
GetContainerStats returns statistics for a container
func (*Manager) GetContainerStatus ¶
GetContainerStatus returns the status of a container
func (*Manager) GetContainers ¶
GetContainers returns a list of Hivemind containers
func (*Manager) IsVolumeInUse ¶
IsVolumeInUse checks if a volume is in use by any container
func (*Manager) ListContainers ¶
ListContainers returns a list of containers
func (*Manager) ListImages ¶
ListImages returns a list of available container images
func (*Manager) ListVolumes ¶
ListVolumes returns a list of volumes
func (*Manager) RemoveContainer ¶
RemoveContainer removes a container
func (*Manager) RestoreVolume ¶
RestoreVolume restores a volume from a backup file
func (*Manager) StartContainer ¶
StartContainer starts a container
func (*Manager) StopContainer ¶
StopContainer stops and removes a container
func (*Manager) WithNamespace ¶
WithNamespace sets the namespace for the containerd manager
func (*Manager) WithRuntime ¶
func (m *Manager) WithRuntime(runtime ContainerRuntime) *Manager
WithRuntime sets the container runtime for the manager
type PortMapping ¶
PortMapping represents a port mapping for a container
type ResourceLimits ¶
ResourceLimits represents resource limits for a container