buildr/internal/containers/api.go
Peter 1261932bdc
All checks were successful
continuous-integration/drone/push Build is passing
refactor: apply golangci-lint findings
2023-06-22 19:16:00 +02:00

42 lines
1,021 B
Go

package containers
import (
"archive/tar"
"context"
"io"
"github.com/docker/docker/api/types"
"github.com/docker/go-connections/nat"
)
type Shutdowner interface {
ShutdownContainer(ctx context.Context, container Container) error
}
type Inspector interface {
ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
}
type ContainerFileCopier interface {
CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
}
type Client interface {
Inspector
ContainerFileCopier
}
type Probe interface {
Execute(ctx context.Context) (ready chan bool, errs chan error)
}
type CopyContainerFileHandler func(header *tar.Header, reader io.Reader) error
type Container interface {
ID() string
NetworkID() string
MappedPort(ctx context.Context, port nat.Port) (hostIP, hostPort string, err error)
CopyFileFromContainer(ctx context.Context, path string, f CopyContainerFileHandler) error
Shutdown(ctx context.Context) error
}