Merge pull request #6835 from kzys/proto-upgrade-5

Prepare for google.golang.org/protobuf
This commit is contained in:
Phil Estes 2022-04-21 14:24:04 +01:00 committed by GitHub
commit 320ef912bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 72 additions and 40 deletions

View File

@ -48,6 +48,9 @@ file {
type: TYPE_BOOL
json_name: "fieldpath"
}
options {
go_package: "github.com/containerd/containerd/protobuf/plugin"
}
}
file {
name: "github.com/containerd/containerd/api/events/container.proto"
@ -1214,6 +1217,9 @@ file {
number: 5
}
}
options {
go_package: "github.com/containerd/containerd/api/types/task"
}
syntax: "proto3"
}
file {

View File

@ -166,36 +166,37 @@ func init() {
}
var fileDescriptor_391ef18c8ab0dc16 = []byte{
// 461 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4f, 0x6b, 0xdb, 0x30,
0x18, 0xc6, 0x2b, 0x27, 0x71, 0x12, 0x79, 0x7f, 0x8c, 0x16, 0x8a, 0x96, 0x81, 0x63, 0x7a, 0x32,
0x3b, 0xd8, 0x2c, 0x3d, 0x0c, 0x76, 0x4b, 0xeb, 0x30, 0xcc, 0xc0, 0x0d, 0x4a, 0xc2, 0x8e, 0xc1,
0x89, 0x14, 0x4f, 0xac, 0xb1, 0x8c, 0xad, 0x8c, 0xe5, 0xb6, 0x8f, 0xd7, 0xe3, 0x8e, 0x3d, 0x95,
0xd5, 0x9f, 0x64, 0x48, 0x76, 0xd2, 0xb1, 0xed, 0x62, 0xde, 0xe7, 0x79, 0x7f, 0xe8, 0x7d, 0xfc,
0xc0, 0x0f, 0x29, 0x97, 0x5f, 0xf6, 0x6b, 0x7f, 0x23, 0x76, 0xc1, 0x46, 0x64, 0x32, 0xe1, 0x19,
0x2b, 0xe8, 0x9f, 0x63, 0x92, 0xf3, 0x40, 0x1e, 0x72, 0x56, 0x06, 0x32, 0x29, 0xbf, 0xea, 0x8f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0x97, 0xab, 0x26, 0x5b, 0x5f, 0x07, 0x86,
0xca, 0xaa, 0xa3, 0xa0, 0xf7, 0xb0, 0xaf, 0x14, 0xa3, 0xab, 0x44, 0x62, 0xe8, 0x02, 0xcf, 0x1a,
0x0f, 0xfd, 0xba, 0x50, 0xff, 0x58, 0xa8, 0xbf, 0x38, 0x36, 0x4e, 0x7a, 0x35, 0x3c, 0x91, 0x17,
0x11, 0xb4, 0x9a, 0x66, 0xa3, 0x6c, 0x2b, 0x8e, 0x8d, 0x80, 0xa7, 0x46, 0x3c, 0xd8, 0xe6, 0xd9,
0x56, 0xe8, 0xf6, 0xac, 0xf1, 0xe0, 0x9f, 0x47, 0x27, 0xd9, 0x81, 0x68, 0xe2, 0xed, 0x12, 0x9a,
0x4d, 0x1a, 0x0b, 0x76, 0x97, 0xf1, 0xa7, 0xf8, 0xe6, 0x73, 0x6c, 0x9f, 0x29, 0x71, 0x4d, 0xa6,
0x93, 0xc5, 0x34, 0xb4, 0x81, 0x12, 0x64, 0x19, 0xc7, 0x51, 0xfc, 0xd1, 0x36, 0x94, 0x98, 0x2f,
0x6e, 0x66, 0xb3, 0x69, 0x68, 0xb7, 0x10, 0x84, 0xe6, 0x6c, 0xb2, 0x9c, 0x4f, 0x43, 0xbb, 0xad,
0x16, 0x6a, 0x56, 0x54, 0xe7, 0x0a, 0xdf, 0x3d, 0x3a, 0x67, 0xf7, 0x8f, 0xce, 0xd9, 0x8f, 0xca,
0x01, 0x77, 0x95, 0x03, 0x7e, 0x56, 0x0e, 0xf8, 0x55, 0x39, 0x60, 0x6d, 0xea, 0x10, 0x97, 0xbf,
0x03, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe5, 0xd9, 0x31, 0xc2, 0x02, 0x00, 0x00,
// 469 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x8b, 0xda, 0x40,
0x18, 0xc6, 0x9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6, 0xbe, 0x89, 0xa4, 0x20, 0xcb, 0x30, 0x0c, 0xc2, 0xf7, 0xa6,
0x26, 0xc5, 0x7c, 0x71, 0x3d, 0x9b, 0x4d, 0x7d, 0xb3, 0x89, 0x01, 0xf4, 0xd9, 0x64, 0x39, 0x9f,
0xfa, 0x66, 0x4b, 0x2e, 0xe4, 0x2c, 0xa9, 0xf6, 0x65, 0x70, 0xfb, 0x60, 0x37, 0xee, 0x1e, 0xec,
0xc6, 0xf7, 0xd2, 0x46, 0xb7, 0xa5, 0x8d, 0x7e, 0x94, 0x36, 0xfa, 0x59, 0xda, 0xe8, 0x93, 0xf7,
0x9f, 0x2f, 0x77, 0xad, 0xab, 0xd4, 0x17, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x3c, 0x50,
0x5f, 0xf3, 0x02, 0x00, 0x00,
}
func (m *Process) Marshal() (dAtA []byte, err error) {

View File

@ -22,6 +22,8 @@ import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/containerd/containerd/api/types/task";
enum Status {
UNKNOWN = 0;
CREATED = 1;

View File

@ -39,6 +39,7 @@ import (
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/process"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/protobuf/proto"
ptypes "github.com/containerd/containerd/protobuf/types"
shimlog "github.com/containerd/containerd/runtime/v1"
"github.com/containerd/containerd/runtime/v1/shim"
@ -305,7 +306,7 @@ func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event
if err != nil {
return err
}
data, err := encoded.Marshal()
data, err := proto.Marshal(encoded)
if err != nil {
return err
}

View File

@ -28,6 +28,7 @@ import (
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/pkg/dialer"
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/containerd/protobuf/types"
"github.com/urfave/cli"
"google.golang.org/grpc"
@ -78,7 +79,7 @@ func getEventPayload(r io.Reader) (*types.Any, error) {
return nil, err
}
var any types.Any
if err := any.Unmarshal(data); err != nil {
if err := proto.Unmarshal(data, &any); err != nil {
return nil, err
}
return &any, nil

View File

@ -29,6 +29,7 @@ import (
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/containerd/rootfs"
"github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/opencontainers/go-digest"
@ -79,7 +80,7 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta
})
}
// save copts
data, err := any.Marshal()
data, err := proto.Marshal(any)
if err != nil {
return err
}
@ -99,7 +100,8 @@ func WithCheckpointTask(ctx context.Context, client *Client, c *containers.Conta
// WithCheckpointRuntime includes the container runtime info
func WithCheckpointRuntime(ctx context.Context, client *Client, c *containers.Container, index *imagespec.Index, copts *options.CheckpointOptions) error {
if c.Runtime.Options != nil && c.Runtime.Options.GetValue() != nil {
data, err := protobuf.FromAny(c.Runtime.Options).Marshal()
any := protobuf.FromAny(c.Runtime.Options)
data, err := proto.Marshal(any)
if err != nil {
return err
}

View File

@ -32,6 +32,7 @@ var empty = &ptypes.Empty{}
type service struct {
sn snapshots.Snapshotter
snapshotsapi.UnimplementedSnapshotsServer
}
// FromSnapshotter returns a Snapshot API server from a containerd snapshotter

View File

@ -49,7 +49,7 @@ func init() {
}
var fileDescriptor_604a244430167409 = []byte{
// 203 bytes of a gzipped FileDescriptorProto
// 208 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x48, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d,
0x4a, 0x41, 0x66, 0x16, 0x14, 0xe5, 0x97, 0xe4, 0x27, 0x95, 0xa6, 0xe9, 0x17, 0xe4, 0x94, 0xa6,
@ -60,7 +60,7 @@ var fileDescriptor_604a244430167409 = []byte{
0x65, 0xe6, 0xa4, 0xfa, 0x17, 0x94, 0x64, 0xe6, 0xe7, 0x15, 0x4b, 0x1c, 0x79, 0xc7, 0xac, 0xc0,
0xa8, 0xc1, 0x11, 0xc4, 0x03, 0xd7, 0xe4, 0x98, 0x93, 0x63, 0x65, 0xcf, 0xc5, 0x09, 0xe7, 0x0b,
0xc9, 0x63, 0x18, 0xe0, 0x9b, 0x5a, 0x5c, 0x9c, 0x98, 0x0e, 0x37, 0x63, 0xc2, 0x77, 0x88, 0x19,
0x08, 0x3d, 0x4e, 0x12, 0x27, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xd0, 0xf0, 0x48, 0x8e,
0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00,
0x00, 0xff, 0xff, 0xd6, 0x21, 0x2a, 0xb6, 0x17, 0x01, 0x00, 0x00,
0x08, 0x3d, 0x4e, 0x5e, 0x27, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xd0, 0xf0, 0x48, 0x8e,
0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x8c, 0x32, 0x20,
0x35, 0x58, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x81, 0x40, 0x89, 0x49, 0x01, 0x00, 0x00,
}

View File

@ -31,6 +31,8 @@ package containerd.plugin;
import "google/protobuf/descriptor.proto";
option go_package = "github.com/containerd/containerd/protobuf/plugin";
extend google.protobuf.FileOptions {
optional bool fieldpath_all = 63300;
}

View File

@ -30,6 +30,7 @@ import (
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/protobuf/proto"
"github.com/containerd/containerd/protobuf/types"
"github.com/containerd/containerd/runtime"
client "github.com/containerd/containerd/runtime/v2/shim"
@ -185,7 +186,7 @@ func (b *binary) Delete(ctx context.Context) (*runtime.Exit, error) {
log.G(ctx).Warnf("cleanup warnings %s", s)
}
var response task.DeleteResponse
if err := response.Unmarshal(out.Bytes()); err != nil {
if err := proto.Unmarshal(out.Bytes(), &response); err != nil {
return nil, err
}
if err := b.bundle.Delete(); err != nil {

View File

@ -55,6 +55,7 @@ func init() {
type service struct {
local api.ContainersClient
api.UnimplementedContainersServer
}
var _ api.ContainersServer = &service{}

View File

@ -38,6 +38,7 @@ import (
type service struct {
store content.Store
api.UnimplementedContentServer
}
var bufPool = sync.Pool{

View File

@ -53,6 +53,7 @@ func init() {
type service struct {
local diffapi.DiffClient
diffapi.UnimplementedDiffServer
}
var _ diffapi.DiffServer = &service{}

View File

@ -52,6 +52,7 @@ func init() {
type service struct {
ttService *ttrpcService
events *exchange.Exchange
api.UnimplementedEventsServer
}
// NewService returns the GRPC events server

View File

@ -54,6 +54,7 @@ func init() {
type service struct {
local imagesapi.ImagesClient
imagesapi.UnimplementedImagesServer
}
var _ imagesapi.ImagesServer = &service{}

View File

@ -62,6 +62,7 @@ func init() {
type server struct {
local api.IntrospectionClient
api.UnimplementedIntrospectionServer
}
var _ = (api.IntrospectionServer)(&server{})

View File

@ -47,6 +47,7 @@ func init() {
type service struct {
lm leases.Manager
api.UnimplementedLeasesServer
}
func (s *service) Register(server *grpc.Server) error {

View File

@ -54,6 +54,7 @@ func init() {
type service struct {
local api.NamespacesClient
api.UnimplementedNamespacesServer
}
var _ api.NamespacesServer = &service{}

View File

@ -59,6 +59,7 @@ func init() {
type controllerService struct {
local api.ControllerClient
api.UnimplementedControllerServer
}
var _ api.ControllerServer = (*controllerService)(nil)

View File

@ -55,6 +55,7 @@ func init() {
type sandboxService struct {
local api.StoreClient
api.UnimplementedStoreServer
}
var _ api.StoreServer = (*sandboxService)(nil)

View File

@ -48,6 +48,7 @@ var empty = &ptypes.Empty{}
type service struct {
ss map[string]snapshots.Snapshotter
snapshotsapi.UnimplementedSnapshotsServer
}
func newService(ic *plugin.InitContext) (interface{}, error) {

View File

@ -42,6 +42,7 @@ import (
"github.com/containerd/containerd/pkg/timeout"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/containerd/protobuf/proto"
ptypes "github.com/containerd/containerd/protobuf/types"
"github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/runtime/linux/runctypes"
@ -579,7 +580,8 @@ func (l *local) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest, _
return nil, err
}
// write the config to the content store
data, err := protobuf.FromAny(container.Spec).Marshal()
pbany := protobuf.FromAny(container.Spec)
data, err := proto.Marshal(pbany)
if err != nil {
return nil, err
}

View File

@ -58,6 +58,7 @@ func init() {
type service struct {
local api.TasksClient
api.UnimplementedTasksServer
}
func (s *service) Register(server *grpc.Server) error {

View File

@ -41,6 +41,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
}
type service struct {
api.UnimplementedVersionServer
}
func (s *service) Register(server *grpc.Server) error {