@@ -20,10 +20,7 @@ import (
20
20
_ "github.com/containerd/containerd/api/events"
21
21
"github.com/containerd/containerd/protobuf"
22
22
23
- // Even though we are following the v2 runtime model, we are currently re-using a struct definition (Envelope) from
24
- // the v1 event API
25
- eventapi "github.com/containerd/containerd/api/services/events/v1"
26
-
23
+ apitypes "github.com/containerd/containerd/api/types"
27
24
"github.com/containerd/containerd/events"
28
25
"github.com/containerd/containerd/protobuf/types"
29
26
"github.com/containerd/ttrpc"
@@ -43,7 +40,7 @@ type Getter interface {
43
40
// GetEvent retrieves a single event from the source provided by the implementation. If no event is available at the
44
41
// time of the call, GetEvent is expected to block until an event is available, an error occurs or the context is
45
42
// canceled.
46
- GetEvent (ctx context.Context ) (* eventapi .Envelope , error )
43
+ GetEvent (ctx context.Context ) (* apitypes .Envelope , error )
47
44
}
48
45
49
46
type getterService struct {
@@ -64,10 +61,10 @@ func NewGetterService(ctx context.Context, eventSource events.Subscriber) Getter
64
61
65
62
// GetEvent pops and returns an event buffered in the service's subscription channel. If not events is in the channel
66
63
// GetEvent blocks until one is available, an error is published on the error channel or the context is canceled.
67
- func (s * getterService ) GetEvent (ctx context.Context ) (* eventapi .Envelope , error ) {
64
+ func (s * getterService ) GetEvent (ctx context.Context ) (* apitypes .Envelope , error ) {
68
65
select {
69
66
case receivedEnvelope := <- s .eventChan :
70
- return & eventapi .Envelope {
67
+ return & apitypes .Envelope {
71
68
Timestamp : protobuf .ToTimestamp (receivedEnvelope .Timestamp ),
72
69
Namespace : receivedEnvelope .Namespace ,
73
70
Topic : receivedEnvelope .Topic ,
@@ -109,9 +106,9 @@ func NewGetterClient(rpcClient *ttrpc.Client) Getter {
109
106
110
107
// GetEvent requests and returns an event from a Getter service. If no event is available at the time of the request it
111
108
// will block until one is.
112
- func (c * getterClient ) GetEvent (ctx context.Context ) (* eventapi .Envelope , error ) {
109
+ func (c * getterClient ) GetEvent (ctx context.Context ) (* apitypes .Envelope , error ) {
113
110
var req types.Empty
114
- var resp eventapi .Envelope
111
+ var resp apitypes .Envelope
115
112
if err := c .rpcClient .Call (ctx , getterServiceName , getEventMethodName , & req , & resp ); err != nil {
116
113
return nil , err
117
114
}
0 commit comments