Skip to content

Commit 2984551

Browse files
committed
Remove deprecated fields
Signed-off-by: David Son <[email protected]>
1 parent f41818a commit 2984551

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

eventbridge/eventbridge.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import (
2020
_ "github.com/containerd/containerd/api/events"
2121
"github.com/containerd/containerd/protobuf"
2222

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"
2724
"github.com/containerd/containerd/events"
2825
"github.com/containerd/containerd/protobuf/types"
2926
"github.com/containerd/ttrpc"
@@ -43,7 +40,7 @@ type Getter interface {
4340
// GetEvent retrieves a single event from the source provided by the implementation. If no event is available at the
4441
// time of the call, GetEvent is expected to block until an event is available, an error occurs or the context is
4542
// canceled.
46-
GetEvent(ctx context.Context) (*eventapi.Envelope, error)
43+
GetEvent(ctx context.Context) (*apitypes.Envelope, error)
4744
}
4845

4946
type getterService struct {
@@ -64,10 +61,10 @@ func NewGetterService(ctx context.Context, eventSource events.Subscriber) Getter
6461

6562
// GetEvent pops and returns an event buffered in the service's subscription channel. If not events is in the channel
6663
// 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) {
6865
select {
6966
case receivedEnvelope := <-s.eventChan:
70-
return &eventapi.Envelope{
67+
return &apitypes.Envelope{
7168
Timestamp: protobuf.ToTimestamp(receivedEnvelope.Timestamp),
7269
Namespace: receivedEnvelope.Namespace,
7370
Topic: receivedEnvelope.Topic,
@@ -109,9 +106,9 @@ func NewGetterClient(rpcClient *ttrpc.Client) Getter {
109106

110107
// GetEvent requests and returns an event from a Getter service. If no event is available at the time of the request it
111108
// 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) {
113110
var req types.Empty
114-
var resp eventapi.Envelope
111+
var resp apitypes.Envelope
115112
if err := c.rpcClient.Call(ctx, getterServiceName, getEventMethodName, &req, &resp); err != nil {
116113
return nil, err
117114
}

0 commit comments

Comments
 (0)