Remove gogoproto.stdtime

This commit removes gogoproto.stdtime, since it is not supported by
Google's official toolchain
(see https://github.com/containerd/containerd/issues/6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2022-04-18 22:12:15 +00:00
parent 26a3ab446b
commit 80b825ca2c
71 changed files with 1803 additions and 1594 deletions

View File

@@ -51,8 +51,8 @@ func containerToProto(container *containers.Container) api.Container {
Spec: protobuf.FromAny(container.Spec),
Snapshotter: container.Snapshotter,
SnapshotKey: container.SnapshotKey,
CreatedAt: container.CreatedAt,
UpdatedAt: container.UpdatedAt,
CreatedAt: protobuf.ToTimestamp(container.CreatedAt),
UpdatedAt: protobuf.ToTimestamp(container.UpdatedAt),
Extensions: extensions,
Sandbox: container.SandboxID,
}

View File

@@ -26,6 +26,7 @@ import (
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/protobuf"
ptypes "github.com/gogo/protobuf/types"
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
@@ -103,7 +104,7 @@ func (s *service) List(req *api.ListContentRequest, session api.Content_ListServ
buffer = append(buffer, api.Info{
Digest: info.Digest.String(),
Size_: info.Size,
CreatedAt: info.CreatedAt,
CreatedAt: protobuf.ToTimestamp(info.CreatedAt),
Labels: info.Labels,
})
@@ -220,8 +221,8 @@ func (s *service) Status(ctx context.Context, req *api.StatusRequest) (*api.Stat
var resp api.StatusResponse
resp.Status = &api.Status{
StartedAt: status.StartedAt,
UpdatedAt: status.UpdatedAt,
StartedAt: protobuf.ToTimestamp(status.StartedAt),
UpdatedAt: protobuf.ToTimestamp(status.UpdatedAt),
Ref: status.Ref,
Offset: status.Offset,
Total: status.Total,
@@ -240,8 +241,8 @@ func (s *service) ListStatuses(ctx context.Context, req *api.ListStatusesRequest
var resp api.ListStatusesResponse
for _, status := range statuses {
resp.Statuses = append(resp.Statuses, api.Status{
StartedAt: status.StartedAt,
UpdatedAt: status.UpdatedAt,
StartedAt: protobuf.ToTimestamp(status.StartedAt),
UpdatedAt: protobuf.ToTimestamp(status.UpdatedAt),
Ref: status.Ref,
Offset: status.Offset,
Total: status.Total,
@@ -375,8 +376,8 @@ func (s *service) Write(session api.Content_WriteServer) (err error) {
switch req.Action {
case api.WriteAction_STAT:
msg.Digest = wr.Digest().String()
msg.StartedAt = ws.StartedAt
msg.UpdatedAt = ws.UpdatedAt
msg.StartedAt = protobuf.ToTimestamp(ws.StartedAt)
msg.UpdatedAt = protobuf.ToTimestamp(ws.UpdatedAt)
msg.Total = total
case api.WriteAction_WRITE, api.WriteAction_COMMIT:
if req.Offset > 0 {
@@ -455,8 +456,8 @@ func infoToGRPC(info content.Info) api.Info {
return api.Info{
Digest: info.Digest.String(),
Size_: info.Size,
CreatedAt: info.CreatedAt,
UpdatedAt: info.UpdatedAt,
CreatedAt: protobuf.ToTimestamp(info.CreatedAt),
UpdatedAt: protobuf.ToTimestamp(info.UpdatedAt),
Labels: info.Labels,
}
}
@@ -465,8 +466,8 @@ func infoFromGRPC(info api.Info) content.Info {
return content.Info{
Digest: digest.Digest(info.Digest),
Size: info.Size_,
CreatedAt: info.CreatedAt,
UpdatedAt: info.UpdatedAt,
CreatedAt: protobuf.FromTimestamp(info.CreatedAt),
UpdatedAt: protobuf.FromTimestamp(info.UpdatedAt),
Labels: info.Labels,
}
}

View File

@@ -113,7 +113,7 @@ func (s *service) Subscribe(req *api.SubscribeRequest, srv api.Events_SubscribeS
func toProto(env *events.Envelope) *api.Envelope {
return &api.Envelope{
Timestamp: env.Timestamp,
Timestamp: protobuf.ToTimestamp(env.Timestamp),
Namespace: env.Namespace,
Topic: env.Topic,
Event: protobuf.FromAny(env.Event),
@@ -122,7 +122,7 @@ func toProto(env *events.Envelope) *api.Envelope {
func fromProto(env *api.Envelope) *events.Envelope {
return &events.Envelope{
Timestamp: env.Timestamp,
Timestamp: protobuf.FromTimestamp(env.Timestamp),
Namespace: env.Namespace,
Topic: env.Topic,
Event: env.Event,

View File

@@ -23,6 +23,7 @@ import (
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/events/exchange"
"github.com/containerd/containerd/protobuf"
ptypes "github.com/gogo/protobuf/types"
)
@@ -40,7 +41,7 @@ func (s *ttrpcService) Forward(ctx context.Context, r *api.ForwardRequest) (*pty
func fromTProto(env *api.Envelope) *events.Envelope {
return &events.Envelope{
Timestamp: env.Timestamp,
Timestamp: protobuf.FromTimestamp(env.Timestamp),
Namespace: env.Namespace,
Topic: env.Topic,
Event: env.Event,

View File

@@ -20,6 +20,7 @@ import (
imagesapi "github.com/containerd/containerd/api/services/images/v1"
"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/protobuf"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -40,8 +41,8 @@ func imageToProto(image *images.Image) imagesapi.Image {
Name: image.Name,
Labels: image.Labels,
Target: descToProto(&image.Target),
CreatedAt: image.CreatedAt,
UpdatedAt: image.UpdatedAt,
CreatedAt: protobuf.ToTimestamp(image.CreatedAt),
UpdatedAt: protobuf.ToTimestamp(image.UpdatedAt),
}
}
@@ -50,8 +51,8 @@ func imageFromProto(imagepb *imagesapi.Image) images.Image {
Name: imagepb.Name,
Labels: imagepb.Labels,
Target: descFromProto(&imagepb.Target),
CreatedAt: imagepb.CreatedAt,
UpdatedAt: imagepb.UpdatedAt,
CreatedAt: protobuf.FromTimestamp(imagepb.CreatedAt),
UpdatedAt: protobuf.FromTimestamp(imagepb.UpdatedAt),
}
}

View File

@@ -23,6 +23,7 @@ import (
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/leases"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/protobuf"
ptypes "github.com/gogo/protobuf/types"
"google.golang.org/grpc"
)
@@ -156,6 +157,6 @@ func leaseToGRPC(l leases.Lease) *api.Lease {
return &api.Lease{
ID: l.ID,
Labels: l.Labels,
CreatedAt: l.CreatedAt,
CreatedAt: protobuf.ToTimestamp(l.CreatedAt),
}
}

View File

@@ -26,6 +26,7 @@ import (
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/services"
"github.com/containerd/containerd/snapshots"
ptypes "github.com/gogo/protobuf/types"
@@ -289,8 +290,8 @@ func fromInfo(info snapshots.Info) snapshotsapi.Info {
Name: info.Name,
Parent: info.Parent,
Kind: fromKind(info.Kind),
CreatedAt: info.Created,
UpdatedAt: info.Updated,
CreatedAt: protobuf.ToTimestamp(info.Created),
UpdatedAt: protobuf.ToTimestamp(info.Updated),
Labels: info.Labels,
}
}
@@ -319,8 +320,8 @@ func toInfo(info snapshotsapi.Info) snapshots.Info {
Name: info.Name,
Parent: info.Parent,
Kind: toKind(info.Kind),
Created: info.CreatedAt,
Updated: info.UpdatedAt,
Created: protobuf.FromTimestamp(info.CreatedAt),
Updated: protobuf.FromTimestamp(info.UpdatedAt),
Labels: info.Labels,
}
}

View File

@@ -298,7 +298,7 @@ func (l *local) Delete(ctx context.Context, r *api.DeleteTaskRequest, _ ...grpc.
return &api.DeleteResponse{
ExitStatus: exit.Status,
ExitedAt: exit.Timestamp,
ExitedAt: protobuf.ToTimestamp(exit.Timestamp),
Pid: exit.Pid,
}, nil
}
@@ -319,7 +319,7 @@ func (l *local) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest,
return &api.DeleteResponse{
ID: r.ExecID,
ExitStatus: exit.Status,
ExitedAt: exit.Timestamp,
ExitedAt: protobuf.ToTimestamp(exit.Timestamp),
Pid: exit.Pid,
}, nil
}
@@ -359,7 +359,7 @@ func getProcessState(ctx context.Context, p runtime.Process) (*task.Process, err
Stderr: state.Stderr,
Terminal: state.Terminal,
ExitStatus: state.ExitStatus,
ExitedAt: state.ExitedAt,
ExitedAt: protobuf.ToTimestamp(state.ExitedAt),
}, nil
}
@@ -640,7 +640,7 @@ func (l *local) Wait(ctx context.Context, r *api.WaitRequest, _ ...grpc.CallOpti
}
return &api.WaitResponse{
ExitStatus: exit.Status,
ExitedAt: exit.Timestamp,
ExitedAt: protobuf.ToTimestamp(exit.Timestamp),
}, nil
}
@@ -669,7 +669,7 @@ func getTasksMetrics(ctx context.Context, filter filters.Filter, tasks []runtime
continue
}
r.Metrics = append(r.Metrics, &types.Metric{
Timestamp: collected,
Timestamp: protobuf.ToTimestamp(collected),
ID: tk.ID(),
Data: stats,
})