supervisor

package
v0.0.0-...-5bc36da Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2016 License: Apache-2.0, CC-BY-SA-4.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// External errors
	ErrEventChanNil           = errors.New("containerd: event 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 ")
	ErrUnknownEvent           = errors.New("containerd: unknown event type")
)
View Source
var (
	ContainerCreateTimer   = metrics.NewTimer()
	ContainerDeleteTimer   = metrics.NewTimer()
	ContainerStartTimer    = metrics.NewTimer()
	ContainersCounter      = metrics.NewCounter()
	EventSubscriberCounter = metrics.NewCounter()
	EventsCounter          = metrics.NewCounter()
	ExecProcessTimer       = metrics.NewTimer()
	ExitProcessTimer       = metrics.NewTimer()
)

Functions

func Metrics

func Metrics() map[string]interface{}

Types

type AddProcessEvent

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

func (*AddProcessEvent) Handle

func (h *AddProcessEvent) Handle(e *Event) error

TODO: add this to worker for concurrent starts??? maybe not because of races where the container could be stopped and removed...

type CreateCheckpointEvent

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

func (*CreateCheckpointEvent) Handle

func (h *CreateCheckpointEvent) Handle(e *Event) error

type DeleteCheckpointEvent

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

func (*DeleteCheckpointEvent) Handle

func (h *DeleteCheckpointEvent) Handle(e *Event) error

type DeleteEvent

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

func (*DeleteEvent) Handle

func (h *DeleteEvent) Handle(e *Event) error

type Event

type Event struct {
	Type          EventType
	Timestamp     time.Time
	ID            string
	BundlePath    string
	Stdout        string
	Stderr        string
	Stdin         string
	Console       string
	Pid           int
	Status        int
	Signal        os.Signal
	Process       *specs.Process
	State         *runtime.State
	Containers    []runtime.Container
	Checkpoint    *runtime.Checkpoint
	Err           chan error
	StartResponse chan StartResponse
	Stats         chan interface{}
}

func NewEvent

func NewEvent(t EventType) *Event

type EventType

type EventType string
const (
	ExecExitEventType         EventType = "execExit"
	ExitEventType             EventType = "exit"
	StartContainerEventType   EventType = "startContainer"
	DeleteEventType           EventType = "deleteContainerEvent"
	GetContainerEventType     EventType = "getContainer"
	SignalEventType           EventType = "signal"
	AddProcessEventType       EventType = "addProcess"
	UpdateContainerEventType  EventType = "updateContainer"
	CreateCheckpointEventType EventType = "createCheckpoint"
	DeleteCheckpointEventType EventType = "deleteCheckpoint"
	StatsEventType            EventType = "events"
	UnsubscribeStatsEventType EventType = "unsubscribeStats"
	StopStatsEventType        EventType = "stopStats"
	OOMEventType              EventType = "oom"
)

type ExecExitEvent

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

func (*ExecExitEvent) Handle

func (h *ExecExitEvent) Handle(e *Event) error

type ExitEvent

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

func (*ExitEvent) Handle

func (h *ExitEvent) Handle(e *Event) error

type GetContainersEvent

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

func (*GetContainersEvent) Handle

func (h *GetContainersEvent) Handle(e *Event) error

type Handler

type Handler interface {
	Handle(*Event) error
}

type Machine

type Machine struct {
	ID     string
	Cpus   int
	Memory int64
}

func CollectMachineInformation

func CollectMachineInformation(id string) (Machine, error)

type SignalEvent

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

func (*SignalEvent) Handle

func (h *SignalEvent) Handle(e *Event) error

type StartEvent

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

func (*StartEvent) Handle

func (h *StartEvent) Handle(e *Event) error

type StartResponse

type StartResponse struct {
	Pid int
}

type StartTask

type StartTask struct {
	Container     runtime.Container
	Checkpoint    string
	IO            *runtime.IO
	Stdin         string
	Stdout        string
	Stderr        string
	Err           chan error
	StartResponse chan StartResponse
}

type StatsEvent

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

func (*StatsEvent) Handle

func (h *StatsEvent) Handle(e *Event) error

type StopStatsEvent

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

func (*StopStatsEvent) Handle

func (h *StopStatsEvent) Handle(e *Event) error

type Supervisor

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

func New

func New(id, stateDir string, tasks chan *StartTask, oom bool) (*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() 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) SendEvent

func (s *Supervisor) SendEvent(evt *Event)

SendEvent 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(sig chan os.Signal)

Stop closes all tasks 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 UnsubscribeStatsEvent

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

func (*UnsubscribeStatsEvent) Handle

func (h *UnsubscribeStatsEvent) Handle(e *Event) error

type UpdateEvent

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

func (*UpdateEvent) Handle

func (h *UpdateEvent) Handle(e *Event) 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