Use ttrpc to publish runtime v2 events
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
|
||||
api "github.com/containerd/containerd/api/services/ttrpc/events/v1"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/events"
|
||||
"github.com/containerd/containerd/events/exchange"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
)
|
||||
@@ -37,24 +36,3 @@ func (s *ttrpcService) Publish(ctx context.Context, r *api.PublishRequest) (*pty
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *ttrpcService) Forward(ctx context.Context, r *api.ForwardRequest) (*ptypes.Empty, error) {
|
||||
if err := s.events.Forward(ctx, fromTTProto(r.Envelope)); err != nil {
|
||||
return nil, errdefs.ToGRPC(err)
|
||||
}
|
||||
|
||||
return &ptypes.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *ttrpcService) Subscribe(ctx context.Context, req *api.SubscribeRequest) (*api.Envelope, error) {
|
||||
return nil, errdefs.ToGRPCf(errdefs.ErrNotImplemented, "ttrpc does not support streaming")
|
||||
}
|
||||
|
||||
func fromTTProto(env *api.Envelope) *events.Envelope {
|
||||
return &events.Envelope{
|
||||
Timestamp: env.Timestamp,
|
||||
Namespace: env.Namespace,
|
||||
Topic: env.Topic,
|
||||
Event: env.Event,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,13 @@ import (
|
||||
"context"
|
||||
|
||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||
"github.com/containerd/ttrpc"
|
||||
)
|
||||
|
||||
func apply(_ context.Context, _ *srvconfig.Config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func newTTRPCServer() (*ttrpc.Server, error) {
|
||||
return ttrpc.NewServer()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user