42 lines
1,021 B
Go
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
|
|
}
|