supervisor

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2016 License: Apache-2.0, CC-BY-SA-4.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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

type ExitTask struct {
	Process runtime.Process
	// contains filtered or unexported fields
}

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

type Machine struct {
	Cpus   int
	Memory int64
}

func CollectMachineInformation

func CollectMachineInformation() (Machine, error)

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor() (*Monitor, error)

func (*Monitor) Close

func (m *Monitor) Close() error

func (*Monitor) Exits

func (m *Monitor) Exits() chan runtime.Process

func (*Monitor) Monitor

func (m *Monitor) Monitor(p runtime.Process) error

func (*Monitor) MonitorOOM

func (m *Monitor) MonitorOOM(c runtime.Container) error

func (*Monitor) OOMs

func (m *Monitor) OOMs() chan string

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

type StartResponse struct {
	Container runtime.Container
}

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
	// 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) (*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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL