containerd/event.go

53 lines
1.2 KiB
Go
Raw Normal View History

2015-11-05 23:29:53 +00:00
package containerd
2015-11-10 22:24:34 +00:00
import (
"os"
"time"
"github.com/docker/containerd/runtime"
"github.com/opencontainers/specs"
2015-11-10 22:24:34 +00:00
)
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"
2015-11-10 22:24:34 +00:00
)
func NewEvent(t EventType) *Event {
return &Event{
Type: t,
Timestamp: time.Now(),
Err: make(chan error, 1),
}
}
type Event struct {
Type EventType
Timestamp time.Time
ID string
BundlePath string
Stdio *runtime.Stdio
Pid int
Status int
Signal os.Signal
Process *specs.Process
State *runtime.State
Containers []runtime.Container
Checkpoint *runtime.Checkpoint
Err chan error
2015-11-10 21:44:35 +00:00
}
type Handler interface {
Handle(*Event) error
}