containerd/runtime/container.go

54 lines
1.2 KiB
Go
Raw Normal View History

package runtime
2015-11-05 23:29:53 +00:00
import (
"os"
"github.com/opencontainers/specs"
)
2015-11-10 21:44:35 +00:00
type Process interface {
Pid() (int, error)
Spec() specs.Process
2015-11-10 21:44:35 +00:00
Signal(os.Signal) error
}
type Status string
const (
Paused Status = "paused"
Running Status = "running"
)
type State struct {
Status Status `json:"status,omitempty"`
}
2015-11-10 21:44:35 +00:00
type Stdio struct {
Stderr string `json:"stderr,omitempty"`
Stdout string `json:"stdout,omitempty"`
}
2015-11-05 23:29:53 +00:00
type Container interface {
// ID returns the container ID
2015-11-06 00:40:57 +00:00
ID() string
// Start starts the init process of the container
2015-11-06 21:01:55 +00:00
Start() error
// Path returns the path to the bundle
2015-11-10 19:38:26 +00:00
Path() string
// Pid returns the container's init process id
2015-11-06 00:40:57 +00:00
Pid() (int, error)
// SetExited sets the exit status of the container after it's init dies
2015-11-05 23:29:53 +00:00
SetExited(status int)
// Delete deletes the container
2015-11-05 23:29:53 +00:00
Delete() error
// Processes returns all the containers processes that have been added
2015-11-10 21:44:35 +00:00
Processes() ([]Process, error)
// RemoveProcess removes a specific process for the container because it exited
RemoveProcess(pid int) error
// State returns the containers runtime state
State() State
// Resume resumes a paused container
Resume() error
// Pause pauses a running container
Pause() error
2015-11-05 23:29:53 +00:00
}