Add events support in client

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2015-12-10 12:30:04 -08:00
parent 288b9a0cc3
commit 71ef776082
7 changed files with 70 additions and 20 deletions

10
exit.go
View File

@@ -6,10 +6,6 @@ type ExitEvent struct {
s *Supervisor
}
type ExecExitEvent struct {
s *Supervisor
}
func (h *ExitEvent) Handle(e *Event) error {
logrus.WithFields(logrus.Fields{"pid": e.Pid, "status": e.Status}).
Debug("containerd: process exited")
@@ -34,10 +30,16 @@ func (h *ExitEvent) Handle(e *Event) error {
container.SetExited(e.Status)
ne := NewEvent(DeleteEventType)
ne.ID = container.ID()
ne.Pid = e.Pid
ne.Status = e.Status
h.s.SendEvent(ne)
return nil
}
type ExecExitEvent struct {
s *Supervisor
}
func (h *ExecExitEvent) Handle(e *Event) error {
// exec process: we remove this process without notifying the main event loop
container := h.s.processes[e.Pid]