api/events: split event types from events service

To avoid importing all of grpc when consuming events, the types of
events have been split in to a separate package. This should allow a
reduction in memory usage in cases where a package is consuming events
but not using the gprc service directly.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2017-11-16 12:46:35 -08:00
parent f49b1b7179
commit 09b5ca1072
31 changed files with 1038 additions and 1020 deletions

View File

@@ -4,7 +4,7 @@ package cgroups
import (
"github.com/containerd/cgroups"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
eventstypes "github.com/containerd/containerd/api/events"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/linux"
"github.com/containerd/containerd/log"
@@ -91,7 +91,7 @@ func (m *cgroupsMonitor) Stop(c runtime.Task) error {
func (m *cgroupsMonitor) trigger(id, namespace string, cg cgroups.Cgroup) {
ctx := namespaces.WithNamespace(m.context, namespace)
if err := m.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &eventsapi.TaskOOM{
if err := m.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &eventstypes.TaskOOM{
ContainerID: id,
}); err != nil {
log.G(m.context).WithError(err).Error("post OOM event")