2015-12-01 19:56:08 +00:00
|
|
|
package runtime
|
2015-11-05 23:29:53 +00:00
|
|
|
|
2016-02-01 19:02:41 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"time"
|
2016-02-29 18:48:39 +00:00
|
|
|
|
|
|
|
"github.com/docker/containerd/specs"
|
2016-02-01 19:02:41 +00:00
|
|
|
)
|
2015-12-01 20:00:11 +00:00
|
|
|
|
|
|
|
var (
|
2015-12-11 01:07:21 +00:00
|
|
|
ErrNotChildProcess = errors.New("containerd: not a child process for container")
|
|
|
|
ErrInvalidContainerType = errors.New("containerd: invalid container type for runtime")
|
|
|
|
ErrCheckpointNotExists = errors.New("containerd: checkpoint does not exist for container")
|
|
|
|
ErrCheckpointExists = errors.New("containerd: checkpoint already exists")
|
|
|
|
ErrContainerExited = errors.New("containerd: container has exited")
|
|
|
|
ErrTerminalsNotSupported = errors.New("containerd: terminals are not supported for runtime")
|
2016-01-06 21:32:46 +00:00
|
|
|
ErrProcessNotExited = errors.New("containerd: process has not exited")
|
|
|
|
ErrProcessExited = errors.New("containerd: process has exited")
|
2016-02-25 20:59:34 +00:00
|
|
|
ErrContainerNotStarted = errors.New("containerd: container not started")
|
2015-11-10 22:57:10 +00:00
|
|
|
|
2016-02-25 20:59:34 +00:00
|
|
|
errNoPidFile = errors.New("containerd: no process pid file found")
|
2016-03-18 06:53:23 +00:00
|
|
|
errInvalidPidInt = errors.New("containerd: process pid is invalid")
|
2016-01-06 21:32:46 +00:00
|
|
|
errNotImplemented = errors.New("containerd: not implemented")
|
|
|
|
)
|
2016-02-01 19:02:41 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
ExitFile = "exit"
|
|
|
|
ExitStatusFile = "exitStatus"
|
|
|
|
StateFile = "state.json"
|
2016-02-02 22:21:25 +00:00
|
|
|
ControlFile = "control"
|
2016-02-01 19:02:41 +00:00
|
|
|
InitProcessID = "init"
|
|
|
|
)
|
|
|
|
|
|
|
|
type State string
|
|
|
|
|
2016-03-07 23:23:52 +00:00
|
|
|
type Resource struct {
|
|
|
|
CPUShares int64
|
|
|
|
BlkioWeight uint16
|
|
|
|
CPUPeriod int64
|
|
|
|
CPUQuota int64
|
|
|
|
CpusetCpus string
|
|
|
|
CpusetMems string
|
|
|
|
KernelMemory int64
|
|
|
|
Memory int64
|
|
|
|
MemoryReservation int64
|
|
|
|
MemorySwap int64
|
|
|
|
}
|
|
|
|
|
2016-02-01 19:02:41 +00:00
|
|
|
const (
|
|
|
|
Paused = State("paused")
|
2016-02-25 20:59:34 +00:00
|
|
|
Stopped = State("stopped")
|
2016-02-01 19:02:41 +00:00
|
|
|
Running = State("running")
|
|
|
|
)
|
|
|
|
|
|
|
|
type state struct {
|
2016-03-24 20:30:27 +00:00
|
|
|
Bundle string `json:"bundle"`
|
|
|
|
Labels []string `json:"labels"`
|
|
|
|
Stdin string `json:"stdin"`
|
|
|
|
Stdout string `json:"stdout"`
|
|
|
|
Stderr string `json:"stderr"`
|
|
|
|
Runtime string `json:"runtime"`
|
|
|
|
RuntimeArgs []string `json:"runtimeArgs"`
|
2016-02-03 21:56:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProcessState struct {
|
2016-02-29 18:48:39 +00:00
|
|
|
specs.ProcessSpec
|
2016-03-24 20:30:27 +00:00
|
|
|
Exec bool `json:"exec"`
|
|
|
|
Stdin string `json:"containerdStdin"`
|
|
|
|
Stdout string `json:"containerdStdout"`
|
|
|
|
Stderr string `json:"containerdStderr"`
|
|
|
|
RuntimeArgs []string `json:"runtimeArgs"`
|
2016-02-26 02:39:03 +00:00
|
|
|
|
|
|
|
PlatformProcessState
|
2016-02-01 19:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Stat struct {
|
|
|
|
// Timestamp is the time that the statistics where collected
|
|
|
|
Timestamp time.Time
|
|
|
|
// Data is the raw stats
|
|
|
|
// TODO: it is currently an interface because we don't know what type of exec drivers
|
|
|
|
// we will have or what the structure should look like at the moment os the containers
|
|
|
|
// can return what they want and we could marshal to json or whatever.
|
|
|
|
Data interface{}
|
|
|
|
}
|