2015-12-01 11:56:08 -08:00
|
|
|
package runtime
|
2015-11-05 15:29:53 -08:00
|
|
|
|
2015-11-10 14:57:10 -08:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/opencontainers/specs"
|
|
|
|
)
|
2015-11-10 13:44:35 -08:00
|
|
|
|
|
|
|
type Process interface {
|
2015-11-10 14:57:10 -08:00
|
|
|
Pid() (int, error)
|
|
|
|
Spec() specs.Process
|
2015-11-10 13:44:35 -08:00
|
|
|
Signal(os.Signal) error
|
|
|
|
}
|
2015-11-12 13:40:23 -08:00
|
|
|
type Status string
|
|
|
|
|
|
|
|
const (
|
|
|
|
Paused Status = "paused"
|
|
|
|
Running Status = "running"
|
|
|
|
)
|
|
|
|
|
|
|
|
type State struct {
|
|
|
|
Status Status `json:"status,omitempty"`
|
|
|
|
}
|
2015-11-10 13:44:35 -08:00
|
|
|
|
2015-12-01 11:56:08 -08:00
|
|
|
type Stdio struct {
|
|
|
|
Stderr string `json:"stderr,omitempty"`
|
|
|
|
Stdout string `json:"stdout,omitempty"`
|
|
|
|
}
|
|
|
|
|
2015-11-05 15:29:53 -08:00
|
|
|
type Container interface {
|
2015-11-12 13:40:23 -08:00
|
|
|
// ID returns the container ID
|
2015-11-05 16:40:57 -08:00
|
|
|
ID() string
|
2015-11-12 13:40:23 -08:00
|
|
|
// Start starts the init process of the container
|
2015-11-06 13:01:55 -08:00
|
|
|
Start() error
|
2015-11-12 13:40:23 -08:00
|
|
|
// Path returns the path to the bundle
|
2015-11-10 11:38:26 -08:00
|
|
|
Path() string
|
2015-11-12 13:40:23 -08:00
|
|
|
// Pid returns the container's init process id
|
2015-11-05 16:40:57 -08:00
|
|
|
Pid() (int, error)
|
2015-11-12 13:40:23 -08:00
|
|
|
// SetExited sets the exit status of the container after it's init dies
|
2015-11-05 15:29:53 -08:00
|
|
|
SetExited(status int)
|
2015-11-12 13:40:23 -08:00
|
|
|
// Delete deletes the container
|
2015-11-05 15:29:53 -08:00
|
|
|
Delete() error
|
2015-11-12 13:40:23 -08:00
|
|
|
// Processes returns all the containers processes that have been added
|
2015-11-10 13:44:35 -08:00
|
|
|
Processes() ([]Process, error)
|
2015-11-12 13:40:23 -08:00
|
|
|
// 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 15:29:53 -08:00
|
|
|
}
|