package supervisor
import "github.com/docker/containerd/supervisor"
Index ¶
- Variables
- func Metrics() map[string]interface{}
- type AddProcessTask
- type CreateCheckpointTask
- type DeleteCheckpointTask
- type DeleteTask
- type Event
- type ExecExitTask
- type ExitTask
- type GetContainersTask
- type Machine
- type Monitor
- func NewMonitor() (*Monitor, error)
- func (m *Monitor) Close() error
- func (m *Monitor) Exits() chan runtime.Process
- func (m *Monitor) Monitor(p runtime.Process) error
- func (m *Monitor) MonitorOOM(c runtime.Container) error
- func (m *Monitor) OOMs() chan string
- type OOMTask
- type SignalTask
- type StartResponse
- type StartTask
- type StatsTask
- type Supervisor
- func New(stateDir string, runtimeName string, runtimeArgs []string, timeout time.Duration, retainCount int) (*Supervisor, error)
- func (s *Supervisor) Close() error
- func (s *Supervisor) Events(from time.Time) chan Event
- func (s *Supervisor) Machine() Machine
- func (s *Supervisor) SendTask(evt Task)
- func (s *Supervisor) Start() error
- func (s *Supervisor) Stop()
- func (s *Supervisor) Unsubscribe(sub chan Event)
- type Task
- type UpdateProcessTask
- type UpdateTask
- type Worker
Variables ¶
var ( // External errors ErrTaskChanNil = errors.New("containerd: task channel is nil") ErrBundleNotFound = errors.New("containerd: bundle not found") ErrContainerNotFound = errors.New("containerd: container not found") ErrContainerExists = errors.New("containerd: container already exists") ErrProcessNotFound = errors.New("containerd: processs not found for container") ErrUnknownContainerStatus = errors.New("containerd: unknown container status ") ErrUnknownTask = errors.New("containerd: unknown task type") )
var ( ContainerCreateTimer = metrics.NewTimer() ContainerDeleteTimer = metrics.NewTimer() ContainerStartTimer = metrics.NewTimer() ContainerStatsTimer = metrics.NewTimer() ContainersCounter = metrics.NewCounter() EventSubscriberCounter = metrics.NewCounter() TasksCounter = metrics.NewCounter() ExecProcessTimer = metrics.NewTimer() ExitProcessTimer = metrics.NewTimer() EpollFdCounter = metrics.NewCounter() )
Functions ¶
func Metrics ¶
func Metrics() map[string]interface{}
Types ¶
type AddProcessTask ¶
type AddProcessTask struct { ID string PID string Stdout string Stderr string Stdin string ProcessSpec *specs.ProcessSpec StartResponse chan StartResponse // contains filtered or unexported fields }
func (*AddProcessTask) ErrorCh ¶
func (t *AddProcessTask) ErrorCh() chan error
type CreateCheckpointTask ¶
type CreateCheckpointTask struct { ID string Checkpoint *runtime.Checkpoint // contains filtered or unexported fields }
func (*CreateCheckpointTask) ErrorCh ¶
func (t *CreateCheckpointTask) ErrorCh() chan error
type DeleteCheckpointTask ¶
type DeleteCheckpointTask struct { ID string Checkpoint *runtime.Checkpoint // contains filtered or unexported fields }
func (*DeleteCheckpointTask) ErrorCh ¶
func (t *DeleteCheckpointTask) ErrorCh() chan error
type DeleteTask ¶
type DeleteTask struct { ID string Status int PID string NoEvent bool // contains filtered or unexported fields }
func (*DeleteTask) ErrorCh ¶
func (t *DeleteTask) ErrorCh() chan error
type Event ¶
type Event struct { ID string `json:"id"` Type string `json:"type"` Timestamp time.Time `json:"timestamp"` PID string `json:"pid,omitempty"` Status int `json:"status,omitempty"` }
type ExecExitTask ¶
type ExecExitTask struct { ID string PID string Status int Process runtime.Process // contains filtered or unexported fields }
func (*ExecExitTask) ErrorCh ¶
func (t *ExecExitTask) ErrorCh() chan error
type ExitTask ¶
func (*ExitTask) ErrorCh ¶
func (t *ExitTask) ErrorCh() chan error
type GetContainersTask ¶
type GetContainersTask struct { ID string Containers []runtime.Container // contains filtered or unexported fields }
func (*GetContainersTask) ErrorCh ¶
func (t *GetContainersTask) ErrorCh() chan error
type Machine ¶
func CollectMachineInformation ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func (*Monitor) Close ¶
func (*Monitor) Exits ¶
func (*Monitor) Monitor ¶
func (*Monitor) MonitorOOM ¶
func (*Monitor) OOMs ¶
type OOMTask ¶
type OOMTask struct { ID string // contains filtered or unexported fields }
func (*OOMTask) ErrorCh ¶
func (t *OOMTask) ErrorCh() chan error
type SignalTask ¶
type SignalTask struct { ID string PID string Signal os.Signal // contains filtered or unexported fields }
func (*SignalTask) ErrorCh ¶
func (t *SignalTask) ErrorCh() chan error
type StartResponse ¶
StartResponse is the response containing a started container
type StartTask ¶
type StartTask struct { ID string BundlePath string Stdout string Stderr string Stdin string StartResponse chan StartResponse Labels []string NoPivotRoot bool // contains filtered or unexported fields }
func (*StartTask) ErrorCh ¶
func (t *StartTask) ErrorCh() chan error
type StatsTask ¶
type StatsTask struct { ID string Stat chan *runtime.Stat // contains filtered or unexported fields }
func (*StatsTask) ErrorCh ¶
func (t *StatsTask) ErrorCh() chan error
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
func New ¶
func New(stateDir string, runtimeName string, runtimeArgs []string, timeout time.Duration, retainCount int) (*Supervisor, error)
New returns an initialized Process supervisor.
func (*Supervisor) Close ¶
func (s *Supervisor) Close() error
Close closes any open files in the supervisor but expects that Stop has been callsed so that no more containers are started.
func (*Supervisor) Events ¶
func (s *Supervisor) Events(from time.Time) chan Event
Events returns an event channel that external consumers can use to receive updates on container events
func (*Supervisor) Machine ¶
func (s *Supervisor) Machine() Machine
Machine returns the machine information for which the supervisor is executing on.
func (*Supervisor) SendTask ¶
func (s *Supervisor) SendTask(evt Task)
SendTask sends the provided event the the supervisors main event loop
func (*Supervisor) Start ¶
func (s *Supervisor) Start() error
Start is a non-blocking call that runs the supervisor for monitoring contianer processes and executing new containers.
This event loop is the only thing that is allowed to modify state of containers and processes therefore it is save to do operations in the handlers that modify state of the system or state of the Supervisor
func (*Supervisor) Stop ¶
func (s *Supervisor) Stop()
Stop closes all startTasks and sends a SIGTERM to each container's pid1 then waits for they to terminate. After it has handled all the SIGCHILD events it will close the signals chan and exit. Stop is a non-blocking call and will return after the containers have been signaled
func (*Supervisor) Unsubscribe ¶
func (s *Supervisor) Unsubscribe(sub chan Event)
Unsubscribe removes the provided channel from receiving any more events
type Task ¶
type Task interface { // ErrorCh returns a channel used to report and error from an async task ErrorCh() chan error }
Task executes an action returning an error chan with either nil or the error from executing the task
type UpdateProcessTask ¶
type UpdateProcessTask struct { ID string PID string CloseStdin bool Width int Height int // contains filtered or unexported fields }
func (*UpdateProcessTask) ErrorCh ¶
func (t *UpdateProcessTask) ErrorCh() chan error
type UpdateTask ¶
type UpdateTask struct { ID string State runtime.State Resources *runtime.Resource // contains filtered or unexported fields }
func (*UpdateTask) ErrorCh ¶
func (t *UpdateTask) ErrorCh() chan error
type Worker ¶
type Worker interface {
Start()
}
func NewWorker ¶
func NewWorker(s *Supervisor, wg *sync.WaitGroup) Worker
Source Files ¶
add_process.go checkpoint.go create.go create_linux.go delete.go errors.go exit.go get_containers.go machine.go machine_linux.go metrics.go monitor_linux.go oom.go signal.go sort.go stats.go supervisor.go supervisor_linux.go task.go update.go worker.go
- Version
- v0.2.2
- Published
- May 24, 2016
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 21 minutes ago –
Tools for package owners.