Update files based on go lint

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-09-29 16:03:09 -04:00
parent 70b353dff2
commit f43b7acfd2
22 changed files with 61 additions and 44 deletions

View File

@@ -6,6 +6,7 @@ import (
events "github.com/containerd/containerd/api/services/events/v1"
)
// Event is a generic interface for any type of event
type Event interface{}
// Publisher posts the event.
@@ -13,6 +14,7 @@ type Publisher interface {
Publish(ctx context.Context, topic string, event Event) error
}
// Forwarder forwards an event to the underlying event bus
type Forwarder interface {
Forward(ctx context.Context, envelope *events.Envelope) error
}
@@ -23,6 +25,7 @@ func (fn publisherFunc) Publish(ctx context.Context, topic string, event Event)
return fn(ctx, topic, event)
}
// Subscriber allows callers to subscribe to events
type Subscriber interface {
Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error)
}

View File

@@ -18,10 +18,12 @@ import (
"github.com/sirupsen/logrus"
)
// Exchange broadcasts events
type Exchange struct {
broadcaster *goevents.Broadcaster
}
// NewExchange returns a new event Exchange
func NewExchange() *Exchange {
return &Exchange{
broadcaster: goevents.NewBroadcaster(),