2017-02-13 18:23:28 +00:00
|
|
|
package containerd
|
|
|
|
|
|
|
|
import "golang.org/x/net/context"
|
|
|
|
|
2017-02-16 00:59:58 +00:00
|
|
|
type ContainerInfo struct {
|
|
|
|
ID string
|
|
|
|
Runtime string
|
|
|
|
}
|
|
|
|
|
2017-02-13 18:23:28 +00:00
|
|
|
type Container interface {
|
2017-02-16 00:59:58 +00:00
|
|
|
// Information of the container
|
|
|
|
Info() ContainerInfo
|
2017-02-13 18:23:28 +00:00
|
|
|
// Start the container's user defined process
|
|
|
|
Start(context.Context) error
|
|
|
|
// State returns the container's state
|
|
|
|
State(context.Context) (State, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ContainerStatus int
|
|
|
|
|
|
|
|
const (
|
|
|
|
CreatedStatus ContainerStatus = iota + 1
|
|
|
|
RunningStatus
|
|
|
|
StoppedStatus
|
|
|
|
DeletedStatus
|
|
|
|
PausedStatus
|
|
|
|
)
|
|
|
|
|
|
|
|
type State interface {
|
|
|
|
// Status is the current status of the container
|
|
|
|
Status() ContainerStatus
|
|
|
|
// Pid is the main process id for the container
|
|
|
|
Pid() uint32
|
|
|
|
}
|