containerd/container.go
Michael Crosby 7715ddcefa Add exec APIs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-05 11:51:56 -07:00

56 lines
1.1 KiB
Go

package containerd
import "golang.org/x/net/context"
type ContainerInfo struct {
ID string
Runtime string
}
type Container interface {
// Information of the container
Info() ContainerInfo
// Start the container's user defined process
Start(context.Context) error
// State returns the container's state
State(context.Context) (State, error)
// Kill signals a container
Kill(context.Context, uint32, bool) error
}
type LinuxContainer interface {
Container
Pause(context.Context) error
Resume(context.Context) error
Exec(context.Context, ExecOpts) (Process, error)
}
type ExecOpts struct {
Spec []byte
IO IO
}
type Process interface {
// State returns the process state
State(context.Context) (State, error)
// Kill signals a container
Kill(context.Context, uint32, bool) error
}
type Status int
const (
CreatedStatus Status = iota + 1
RunningStatus
StoppedStatus
DeletedStatus
PausedStatus
)
type State interface {
// Status is the current status of the container
Status() Status
// Pid is the main process id for the container
Pid() uint32
}