Documentation
¶
Overview ¶
Package container defines a generic interface for managing containerized workloads.
This package allows the lifecycle library to manage containers (Docker, Podman, etc.) without having a direct dependency on their respective SDKs. Consumers can implement the Container interface and pass it to a ContainerWorker for supervision.
key features:
- **Container Interface**: Generic Start, Stop, Logs, and Status methods.
- **Mock Implementation**: A reference implementation for testing and local development.
Index ¶
- type Container
- type InspectData
- type MockContainer
- func (m *MockContainer) ID() string
- func (m *MockContainer) Inspect(ctx context.Context) (InspectData, error)
- func (m *MockContainer) Logs(ctx context.Context) (io.ReadCloser, error)
- func (m *MockContainer) Start(ctx context.Context) error
- func (m *MockContainer) Status() Status
- func (m *MockContainer) Stop(ctx context.Context) error
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface {
// Start initiates the container.
Start(ctx context.Context) error
// Stop requests the container to stop gracefully.
Stop(ctx context.Context) error
// Inspect returns detailed runtime information.
Inspect(ctx context.Context) (InspectData, error)
// Logs returns a reader for the container's logs (stdout/stderr).
Logs(ctx context.Context) (io.ReadCloser, error)
// ID returns the unique identifier of the container.
ID() string
// Status returns the current lifecycle status.
Status() Status
}
Container defines a generic interface for managing containerized workloads. This decouples the lifecycle supervisor from specific SDKs like Docker or Podman.
type InspectData ¶
InspectData contains detailed runtime information about a container.
type MockContainer ¶
type MockContainer struct {
// contains filtered or unexported fields
}
MockContainer is a reference/mock implementation of the Container interface.
func NewMockContainer ¶
func NewMockContainer(id string) *MockContainer
func (*MockContainer) ID ¶
func (m *MockContainer) ID() string
func (*MockContainer) Inspect ¶
func (m *MockContainer) Inspect(ctx context.Context) (InspectData, error)
func (*MockContainer) Logs ¶
func (m *MockContainer) Logs(ctx context.Context) (io.ReadCloser, error)
func (*MockContainer) Status ¶
func (m *MockContainer) Status() Status