Use event service post for shim events

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-07-07 16:12:33 -07:00
parent f39693eabe
commit 6578565216
12 changed files with 149 additions and 108 deletions

View File

@@ -1,15 +1,11 @@
package runtime
import events "github.com/containerd/containerd/api/services/events/v1"
// TaskMonitor provides an interface for monitoring of containers within containerd
type TaskMonitor interface {
// Monitor adds the provided container to the monitor
Monitor(Task) error
// Stop stops and removes the provided container from the monitor
Stop(Task) error
// Events emits events to the channel for the monitor
Events(chan<- *events.RuntimeEvent)
}
func NewMultiTaskMonitor(monitors ...TaskMonitor) TaskMonitor {
@@ -33,9 +29,6 @@ func (mm *noopTaskMonitor) Stop(c Task) error {
return nil
}
func (mm *noopTaskMonitor) Events(events chan<- *events.RuntimeEvent) {
}
type multiTaskMonitor struct {
monitors []TaskMonitor
}
@@ -57,9 +50,3 @@ func (mm *multiTaskMonitor) Stop(c Task) error {
}
return nil
}
func (mm *multiTaskMonitor) Events(events chan<- *events.RuntimeEvent) {
for _, m := range mm.monitors {
m.Events(events)
}
}