Move Message proto to types

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2024-02-02 10:24:54 -08:00
parent db1e16da34
commit 7f2d2c4f44
15 changed files with 411 additions and 472 deletions

View File

@@ -22,6 +22,7 @@ import (
api "github.com/containerd/containerd/v2/api/services/events/v1"
apittrpc "github.com/containerd/containerd/v2/api/services/ttrpc/events/v1"
"github.com/containerd/containerd/v2/api/types"
"github.com/containerd/containerd/v2/pkg/events"
"github.com/containerd/containerd/v2/pkg/events/exchange"
"github.com/containerd/containerd/v2/plugins"
@@ -114,8 +115,8 @@ func (s *service) Subscribe(req *api.SubscribeRequest, srv api.Events_SubscribeS
}
}
func toProto(env *events.Envelope) *api.Envelope {
return &api.Envelope{
func toProto(env *events.Envelope) *types.Envelope {
return &types.Envelope{
Timestamp: protobuf.ToTimestamp(env.Timestamp),
Namespace: env.Namespace,
Topic: env.Topic,
@@ -123,7 +124,7 @@ func toProto(env *events.Envelope) *api.Envelope {
}
}
func fromProto(env *api.Envelope) *events.Envelope {
func fromProto(env *types.Envelope) *events.Envelope {
return &events.Envelope{
Timestamp: protobuf.FromTimestamp(env.Timestamp),
Namespace: env.Namespace,

View File

@@ -20,6 +20,7 @@ import (
"context"
api "github.com/containerd/containerd/v2/api/services/ttrpc/events/v1"
"github.com/containerd/containerd/v2/api/types"
"github.com/containerd/containerd/v2/pkg/events"
"github.com/containerd/containerd/v2/pkg/events/exchange"
"github.com/containerd/containerd/v2/protobuf"
@@ -39,7 +40,7 @@ func (s *ttrpcService) Forward(ctx context.Context, r *api.ForwardRequest) (*pty
return &ptypes.Empty{}, nil
}
func fromTProto(env *api.Envelope) *events.Envelope {
func fromTProto(env *types.Envelope) *events.Envelope {
return &events.Envelope{
Timestamp: protobuf.FromTimestamp(env.Timestamp),
Namespace: env.Namespace,