diff --git a/Protobuild.toml b/Protobuild.toml index 5ae49d9c2..978a58199 100644 --- a/Protobuild.toml +++ b/Protobuild.toml @@ -24,6 +24,7 @@ plugins = ["grpc", "fieldpath"] [packages] "gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto" "google/protobuf/any.proto" = "github.com/gogo/protobuf/types" + "google/protobuf/empty.proto" = "github.com/gogo/protobuf/types" "google/protobuf/descriptor.proto" = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" "google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types" "google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types" diff --git a/api/services/containers/v1/containers.pb.go b/api/services/containers/v1/containers.pb.go index ec6f5469f..44c1ed81b 100644 --- a/api/services/containers/v1/containers.pb.go +++ b/api/services/containers/v1/containers.pb.go @@ -26,7 +26,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import google_protobuf1 "github.com/gogo/protobuf/types" -import google_protobuf2 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf2 "github.com/gogo/protobuf/types" import google_protobuf3 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" diff --git a/api/services/content/v1/content.pb.go b/api/services/content/v1/content.pb.go index 5e1899a34..8e913e0e7 100644 --- a/api/services/content/v1/content.pb.go +++ b/api/services/content/v1/content.pb.go @@ -35,7 +35,7 @@ import math "math" import _ "github.com/gogo/protobuf/gogoproto" import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" -import google_protobuf3 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf3 "github.com/gogo/protobuf/types" import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" import time "time" diff --git a/api/services/events/v1/events.pb.go b/api/services/events/v1/events.pb.go index bcefb8806..e9b4ecf65 100644 --- a/api/services/events/v1/events.pb.go +++ b/api/services/events/v1/events.pb.go @@ -9,7 +9,7 @@ import math "math" import _ "github.com/containerd/containerd/protobuf/plugin" import _ "github.com/gogo/protobuf/gogoproto" import google_protobuf1 "github.com/gogo/protobuf/types" -import google_protobuf2 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf2 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" import time "time" diff --git a/api/services/images/v1/images.pb.go b/api/services/images/v1/images.pb.go index 045df870a..462e7efcc 100644 --- a/api/services/images/v1/images.pb.go +++ b/api/services/images/v1/images.pb.go @@ -25,7 +25,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf1 "github.com/gogo/protobuf/types" import google_protobuf2 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" import containerd_types "github.com/containerd/containerd/api/types" diff --git a/api/services/leases/v1/leases.pb.go b/api/services/leases/v1/leases.pb.go index b33adee3b..142b310f4 100644 --- a/api/services/leases/v1/leases.pb.go +++ b/api/services/leases/v1/leases.pb.go @@ -21,7 +21,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" import time "time" diff --git a/api/services/namespaces/v1/namespace.pb.go b/api/services/namespaces/v1/namespace.pb.go index 58dde7af8..933f36746 100644 --- a/api/services/namespaces/v1/namespace.pb.go +++ b/api/services/namespaces/v1/namespace.pb.go @@ -25,7 +25,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf1 "github.com/gogo/protobuf/types" import google_protobuf2 "github.com/gogo/protobuf/types" import ( diff --git a/api/services/snapshot/v1/snapshots.pb.go b/api/services/snapshot/v1/snapshots.pb.go index 7fff41ac6..569e974f0 100644 --- a/api/services/snapshot/v1/snapshots.pb.go +++ b/api/services/snapshot/v1/snapshots.pb.go @@ -32,7 +32,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf1 "github.com/gogo/protobuf/types" import google_protobuf2 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types" import containerd_types "github.com/containerd/containerd/api/types" diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index 33e8465e8..6c89e8124 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -41,7 +41,7 @@ package tasks import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/golang/protobuf/ptypes/empty" +import google_protobuf "github.com/gogo/protobuf/types" import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import containerd_types "github.com/containerd/containerd/api/types" diff --git a/api/services/version/v1/version.pb.go b/api/services/version/v1/version.pb.go index e09eab070..0372cc06d 100644 --- a/api/services/version/v1/version.pb.go +++ b/api/services/version/v1/version.pb.go @@ -15,7 +15,7 @@ package version import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" -import google_protobuf "github.com/golang/protobuf/ptypes/empty" +import google_protobuf "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import ( diff --git a/client.go b/client.go index 663f2fab8..eb5bd9a11 100644 --- a/client.go +++ b/client.go @@ -40,7 +40,7 @@ import ( snapshotservice "github.com/containerd/containerd/services/snapshot" "github.com/containerd/containerd/snapshot" "github.com/containerd/typeurl" - pempty "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" ocispec "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" @@ -489,7 +489,7 @@ type Version struct { // Version returns the version of containerd that the client is connected to func (c *Client) Version(ctx context.Context) (Version, error) { - response, err := c.VersionService().Version(ctx, &pempty.Empty{}) + response, err := c.VersionService().Version(ctx, &ptypes.Empty{}) if err != nil { return Version{}, err } diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index 5e719b19c..9e8044751 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -23,7 +23,7 @@ import ( "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/reaper" "github.com/containerd/typeurl" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" "google.golang.org/grpc" @@ -163,7 +163,7 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal, server *grpc.Se Signal: uint32(syscall.SIGKILL), All: true, }) - sv.Delete(context.Background(), &google_protobuf.Empty{}) + sv.Delete(context.Background(), &ptypes.Empty{}) close(done) }) case unix.SIGUSR1: diff --git a/cmd/ctr/commands/shim/shim.go b/cmd/ctr/commands/shim/shim.go index 63428c99c..e0413c10b 100644 --- a/cmd/ctr/commands/shim/shim.go +++ b/cmd/ctr/commands/shim/shim.go @@ -16,15 +16,14 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands" shim "github.com/containerd/containerd/linux/shim/v1" "github.com/containerd/typeurl" - protobuf "github.com/gogo/protobuf/types" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) -var empty = &google_protobuf.Empty{} +var empty = &ptypes.Empty{} var fifoFlags = []cli.Flag{ cli.StringFlag{ @@ -168,7 +167,7 @@ var execCommand = cli.Command{ rq := &shim.ExecProcessRequest{ ID: id, - Spec: &protobuf.Any{ + Spec: &ptypes.Any{ TypeUrl: url, Value: spec, }, diff --git a/linux/runtime.go b/linux/runtime.go index af07a6001..1fe22a91d 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -30,7 +30,7 @@ import ( "github.com/containerd/containerd/sys" runc "github.com/containerd/go-runc" "github.com/containerd/typeurl" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -39,7 +39,7 @@ import ( var ( pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "linux") - empty = &google_protobuf.Empty{} + empty = &ptypes.Empty{} ) const ( diff --git a/linux/shim/client/client.go b/linux/shim/client/client.go index 1cfe766c2..ca880eac8 100644 --- a/linux/shim/client/client.go +++ b/linux/shim/client/client.go @@ -25,11 +25,11 @@ import ( "github.com/containerd/containerd/log" "github.com/containerd/containerd/reaper" "github.com/containerd/containerd/sys" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "google.golang.org/grpc" ) -var empty = &google_protobuf.Empty{} +var empty = &ptypes.Empty{} // Opt is an option for a shim client configuration type Opt func(context.Context, shim.Config) (shimapi.ShimClient, io.Closer, error) diff --git a/linux/shim/local.go b/linux/shim/local.go index 5e5634d70..bb856fd90 100644 --- a/linux/shim/local.go +++ b/linux/shim/local.go @@ -6,7 +6,7 @@ import ( "path/filepath" shimapi "github.com/containerd/containerd/linux/shim/v1" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "golang.org/x/net/context" "golang.org/x/sys/unix" "google.golang.org/grpc" @@ -31,7 +31,7 @@ func (c *local) Start(ctx context.Context, in *shimapi.StartRequest, opts ...grp return c.s.Start(ctx, in) } -func (c *local) Delete(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { +func (c *local) Delete(ctx context.Context, in *ptypes.Empty, opts ...grpc.CallOption) (*shimapi.DeleteResponse, error) { // make sure we unmount the containers rootfs for this local if err := unix.Unmount(filepath.Join(c.s.config.Path, "rootfs"), 0); err != nil { return nil, err @@ -43,11 +43,11 @@ func (c *local) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequ return c.s.DeleteProcess(ctx, in) } -func (c *local) Exec(ctx context.Context, in *shimapi.ExecProcessRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Exec(ctx context.Context, in *shimapi.ExecProcessRequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Exec(ctx, in) } -func (c *local) ResizePty(ctx context.Context, in *shimapi.ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) ResizePty(ctx context.Context, in *shimapi.ResizePtyRequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.ResizePty(ctx, in) } @@ -55,15 +55,15 @@ func (c *local) State(ctx context.Context, in *shimapi.StateRequest, opts ...grp return c.s.State(ctx, in) } -func (c *local) Pause(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Pause(ctx context.Context, in *ptypes.Empty, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Pause(ctx, in) } -func (c *local) Resume(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Resume(ctx context.Context, in *ptypes.Empty, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Resume(ctx, in) } -func (c *local) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Kill(ctx, in) } @@ -71,19 +71,19 @@ func (c *local) ListPids(ctx context.Context, in *shimapi.ListPidsRequest, opts return c.s.ListPids(ctx, in) } -func (c *local) CloseIO(ctx context.Context, in *shimapi.CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) CloseIO(ctx context.Context, in *shimapi.CloseIORequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.CloseIO(ctx, in) } -func (c *local) Checkpoint(ctx context.Context, in *shimapi.CheckpointTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Checkpoint(ctx context.Context, in *shimapi.CheckpointTaskRequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Checkpoint(ctx, in) } -func (c *local) ShimInfo(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*shimapi.ShimInfoResponse, error) { +func (c *local) ShimInfo(ctx context.Context, in *ptypes.Empty, opts ...grpc.CallOption) (*shimapi.ShimInfoResponse, error) { return c.s.ShimInfo(ctx, in) } -func (c *local) Update(ctx context.Context, in *shimapi.UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *local) Update(ctx context.Context, in *shimapi.UpdateTaskRequest, opts ...grpc.CallOption) (*ptypes.Empty, error) { return c.s.Update(ctx, in) } diff --git a/linux/shim/service.go b/linux/shim/service.go index 566811dee..da9b5fd83 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -24,13 +24,13 @@ import ( "github.com/containerd/containerd/runtime" runc "github.com/containerd/go-runc" "github.com/containerd/typeurl" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" ) -var empty = &google_protobuf.Empty{} +var empty = &ptypes.Empty{} // Config contains shim specific configuration type Config struct { @@ -142,7 +142,7 @@ func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*shimapi. } // Delete the initial process and container -func (s *Service) Delete(ctx context.Context, r *google_protobuf.Empty) (*shimapi.DeleteResponse, error) { +func (s *Service) Delete(ctx context.Context, r *ptypes.Empty) (*shimapi.DeleteResponse, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[s.id] @@ -185,7 +185,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *shimapi.DeleteProcessReq } // Exec an additional process inside the container -func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*google_protobuf.Empty, error) { +func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() @@ -214,7 +214,7 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*goo } // ResizePty of a process -func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*google_protobuf.Empty, error) { +func (s *Service) ResizePty(ctx context.Context, r *shimapi.ResizePtyRequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() if r.ID == "" { @@ -275,7 +275,7 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi. } // Pause the container -func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { +func (s *Service) Pause(ctx context.Context, r *ptypes.Empty) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[s.id] @@ -289,7 +289,7 @@ func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_ } // Resume the container -func (s *Service) Resume(ctx context.Context, r *google_protobuf.Empty) (*google_protobuf.Empty, error) { +func (s *Service) Resume(ctx context.Context, r *ptypes.Empty) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[s.id] @@ -303,7 +303,7 @@ func (s *Service) Resume(ctx context.Context, r *google_protobuf.Empty) (*google } // Kill a process with the provided signal -func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_protobuf.Empty, error) { +func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() if r.ID == "" { @@ -359,7 +359,7 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh } // CloseIO of a process -func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*google_protobuf.Empty, error) { +func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[r.ID] @@ -375,7 +375,7 @@ func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*goog } // Checkpoint the container -func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointTaskRequest) (*google_protobuf.Empty, error) { +func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointTaskRequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[s.id] @@ -392,14 +392,14 @@ func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointTaskReque } // ShimInfo returns shim information such as the shim's pid -func (s *Service) ShimInfo(ctx context.Context, r *google_protobuf.Empty) (*shimapi.ShimInfoResponse, error) { +func (s *Service) ShimInfo(ctx context.Context, r *ptypes.Empty) (*shimapi.ShimInfoResponse, error) { return &shimapi.ShimInfoResponse{ ShimPid: uint32(os.Getpid()), }, nil } // Update a running container -func (s *Service) Update(ctx context.Context, r *shimapi.UpdateTaskRequest) (*google_protobuf.Empty, error) { +func (s *Service) Update(ctx context.Context, r *shimapi.UpdateTaskRequest) (*ptypes.Empty, error) { s.mu.Lock() defer s.mu.Unlock() p := s.processes[s.id] diff --git a/linux/shim/v1/shim.pb.go b/linux/shim/v1/shim.pb.go index 7671c8ec4..102acc69d 100644 --- a/linux/shim/v1/shim.pb.go +++ b/linux/shim/v1/shim.pb.go @@ -35,7 +35,7 @@ import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import google_protobuf "github.com/gogo/protobuf/types" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/types" import containerd_types "github.com/containerd/containerd/api/types" diff --git a/services/containers/service.go b/services/containers/service.go index 81af3f169..d2810041d 100644 --- a/services/containers/service.go +++ b/services/containers/service.go @@ -9,7 +9,7 @@ import ( "github.com/containerd/containerd/events" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" "golang.org/x/net/context" "google.golang.org/grpc" @@ -149,24 +149,24 @@ func (s *service) Update(ctx context.Context, req *api.UpdateContainerRequest) ( return &resp, nil } -func (s *service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (*empty.Empty, error) { +func (s *service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (*ptypes.Empty, error) { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store containers.Store) error { return store.Delete(ctx, req.ID) }); err != nil { - return &empty.Empty{}, errdefs.ToGRPC(err) + return &ptypes.Empty{}, errdefs.ToGRPC(err) } if err := s.publisher.Publish(ctx, "/containers/delete", &eventsapi.ContainerDelete{ ID: req.ID, }); err != nil { - return &empty.Empty{}, err + return &ptypes.Empty{}, err } if err := s.db.GarbageCollect(ctx); err != nil { - return &empty.Empty{}, errdefs.ToGRPC(errors.Wrap(err, "garbage collection failed")) + return &ptypes.Empty{}, errdefs.ToGRPC(errors.Wrap(err, "garbage collection failed")) } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store containers.Store) error) func(tx *bolt.Tx) error { diff --git a/services/content/service.go b/services/content/service.go index 3784579d5..bfbc2073c 100644 --- a/services/content/service.go +++ b/services/content/service.go @@ -12,7 +12,7 @@ import ( "github.com/containerd/containerd/log" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -138,7 +138,7 @@ func (s *service) List(req *api.ListContentRequest, session api.Content_ListServ return nil } -func (s *service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*empty.Empty, error) { +func (s *service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*ptypes.Empty, error) { if err := req.Digest.Validate(); err != nil { return nil, grpc.Errorf(codes.InvalidArgument, err.Error()) } @@ -153,7 +153,7 @@ func (s *service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*e return nil, err } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) Read(req *api.ReadContentRequest, session api.Content_ReadServer) error { @@ -445,10 +445,10 @@ func (s *service) Write(session api.Content_WriteServer) (err error) { } } -func (s *service) Abort(ctx context.Context, req *api.AbortRequest) (*empty.Empty, error) { +func (s *service) Abort(ctx context.Context, req *api.AbortRequest) (*ptypes.Empty, error) { if err := s.store.Abort(ctx, req.Ref); err != nil { return nil, errdefs.ToGRPC(err) } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } diff --git a/services/events/service.go b/services/events/service.go index eb5c33e6f..540f9af22 100644 --- a/services/events/service.go +++ b/services/events/service.go @@ -5,7 +5,7 @@ import ( "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/events/exchange" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" "golang.org/x/net/context" "google.golang.org/grpc" @@ -35,20 +35,20 @@ func (s *service) Register(server *grpc.Server) error { return nil } -func (s *service) Publish(ctx context.Context, r *api.PublishRequest) (*empty.Empty, error) { +func (s *service) Publish(ctx context.Context, r *api.PublishRequest) (*ptypes.Empty, error) { if err := s.events.Publish(ctx, r.Topic, r.Event); err != nil { return nil, errdefs.ToGRPC(err) } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } -func (s *service) Forward(ctx context.Context, r *api.ForwardRequest) (*empty.Empty, error) { +func (s *service) Forward(ctx context.Context, r *api.ForwardRequest) (*ptypes.Empty, error) { if err := s.events.Forward(ctx, r.Envelope); err != nil { return nil, errdefs.ToGRPC(err) } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) Subscribe(req *api.SubscribeRequest, srv api.Events_SubscribeServer) error { diff --git a/services/images/service.go b/services/images/service.go index 3843df554..4e0fa9369 100644 --- a/services/images/service.go +++ b/services/images/service.go @@ -9,7 +9,7 @@ import ( "github.com/containerd/containerd/images" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" "golang.org/x/net/context" "google.golang.org/grpc" @@ -150,7 +150,7 @@ func (s *service) Update(ctx context.Context, req *imagesapi.UpdateImageRequest) return &resp, nil } -func (s *service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest) (*empty.Empty, error) { +func (s *service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest) (*ptypes.Empty, error) { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error { return errdefs.ToGRPC(store.Delete(ctx, req.Name)) }); err != nil { @@ -167,7 +167,7 @@ func (s *service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest) return nil, errdefs.ToGRPC(errors.Wrap(err, "garbage collection failed")) } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store images.Store) error) func(tx *bolt.Tx) error { diff --git a/services/leases/service.go b/services/leases/service.go index 01176d74a..debfbd749 100644 --- a/services/leases/service.go +++ b/services/leases/service.go @@ -12,7 +12,7 @@ import ( api "github.com/containerd/containerd/api/services/leases/v1" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "golang.org/x/net/context" ) @@ -67,13 +67,13 @@ func (s *service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create }, nil } -func (s *service) Delete(ctx context.Context, r *api.DeleteRequest) (*empty.Empty, error) { +func (s *service) Delete(ctx context.Context, r *api.DeleteRequest) (*ptypes.Empty, error) { if err := s.db.Update(func(tx *bolt.Tx) error { return metadata.NewLeaseManager(tx).Delete(ctx, r.ID) }); err != nil { return nil, err } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) { diff --git a/services/namespaces/service.go b/services/namespaces/service.go index b795ab52f..48e6e8e94 100644 --- a/services/namespaces/service.go +++ b/services/namespaces/service.go @@ -11,7 +11,7 @@ import ( "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/plugin" - "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -182,21 +182,21 @@ func (s *service) Update(ctx context.Context, req *api.UpdateNamespaceRequest) ( return &resp, nil } -func (s *service) Delete(ctx context.Context, req *api.DeleteNamespaceRequest) (*empty.Empty, error) { +func (s *service) Delete(ctx context.Context, req *api.DeleteNamespaceRequest) (*ptypes.Empty, error) { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store namespaces.Store) error { return errdefs.ToGRPC(store.Delete(ctx, req.Name)) }); err != nil { - return &empty.Empty{}, err + return &ptypes.Empty{}, err } // set the namespace in the context before publishing the event ctx = namespaces.WithNamespace(ctx, req.Name) if err := s.publisher.Publish(ctx, "/namespaces/delete", &eventsapi.NamespaceDelete{ Name: req.Name, }); err != nil { - return &empty.Empty{}, err + return &ptypes.Empty{}, err } - return &empty.Empty{}, nil + return &ptypes.Empty{}, nil } func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store namespaces.Store) error) func(tx *bolt.Tx) error { diff --git a/services/snapshot/service.go b/services/snapshot/service.go index 716b4c42c..656f8da35 100644 --- a/services/snapshot/service.go +++ b/services/snapshot/service.go @@ -13,7 +13,7 @@ import ( "github.com/containerd/containerd/mount" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/snapshot" - protoempty "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -29,7 +29,7 @@ func init() { }) } -var empty = &protoempty.Empty{} +var empty = &ptypes.Empty{} type service struct { db *metadata.DB @@ -127,7 +127,7 @@ func (s *service) Mounts(ctx context.Context, mr *snapshotapi.MountsRequest) (*s }, nil } -func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequest) (*protoempty.Empty, error) { +func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequest) (*ptypes.Empty, error) { log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("Committing snapshot") sn, err := s.getSnapshotter(cr.Snapshotter) if err != nil { @@ -151,7 +151,7 @@ func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequ return empty, nil } -func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveSnapshotRequest) (*protoempty.Empty, error) { +func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveSnapshotRequest) (*ptypes.Empty, error) { log.G(ctx).WithField("key", rr.Key).Debugf("Removing snapshot") sn, err := s.getSnapshotter(rr.Snapshotter) if err != nil { diff --git a/services/tasks/service.go b/services/tasks/service.go index 8ddb4a017..1b126085f 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -26,7 +26,7 @@ import ( "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/runtime" "github.com/containerd/typeurl" - google_protobuf "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "github.com/pkg/errors" "golang.org/x/net/context" "google.golang.org/grpc" @@ -35,7 +35,7 @@ import ( var ( _ = (api.TasksServer)(&service{}) - empty = &google_protobuf.Empty{} + empty = &ptypes.Empty{} ) func init() { @@ -296,7 +296,7 @@ func addTasks(ctx context.Context, r *api.ListTasksResponse, tasks []runtime.Tas } } -func (s *service) Pause(ctx context.Context, r *api.PauseTaskRequest) (*google_protobuf.Empty, error) { +func (s *service) Pause(ctx context.Context, r *api.PauseTaskRequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err @@ -308,7 +308,7 @@ func (s *service) Pause(ctx context.Context, r *api.PauseTaskRequest) (*google_p return empty, nil } -func (s *service) Resume(ctx context.Context, r *api.ResumeTaskRequest) (*google_protobuf.Empty, error) { +func (s *service) Resume(ctx context.Context, r *api.ResumeTaskRequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err @@ -320,7 +320,7 @@ func (s *service) Resume(ctx context.Context, r *api.ResumeTaskRequest) (*google return empty, nil } -func (s *service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobuf.Empty, error) { +func (s *service) Kill(ctx context.Context, r *api.KillRequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err @@ -365,7 +365,7 @@ func (s *service) ListPids(ctx context.Context, r *api.ListPidsRequest) (*api.Li }, nil } -func (s *service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*google_protobuf.Empty, error) { +func (s *service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*ptypes.Empty, error) { if r.ExecID == "" { return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty") } @@ -387,7 +387,7 @@ func (s *service) Exec(ctx context.Context, r *api.ExecProcessRequest) (*google_ return empty, nil } -func (s *service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*google_protobuf.Empty, error) { +func (s *service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err @@ -407,7 +407,7 @@ func (s *service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*goog return empty, nil } -func (s *service) CloseIO(ctx context.Context, r *api.CloseIORequest) (*google_protobuf.Empty, error) { +func (s *service) CloseIO(ctx context.Context, r *api.CloseIORequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err @@ -471,7 +471,7 @@ func (s *service) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest) }, nil } -func (s *service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google_protobuf.Empty, error) { +func (s *service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*ptypes.Empty, error) { t, err := s.getTask(ctx, r.ContainerID) if err != nil { return nil, err diff --git a/services/version/service.go b/services/version/service.go index 5a7454f24..2c3ec5183 100644 --- a/services/version/service.go +++ b/services/version/service.go @@ -4,7 +4,7 @@ import ( api "github.com/containerd/containerd/api/services/version/v1" "github.com/containerd/containerd/plugin" ctrdversion "github.com/containerd/containerd/version" - empty "github.com/golang/protobuf/ptypes/empty" + ptypes "github.com/gogo/protobuf/types" "golang.org/x/net/context" "google.golang.org/grpc" ) @@ -31,7 +31,7 @@ func (s *service) Register(server *grpc.Server) error { return nil } -func (s *service) Version(ctx context.Context, _ *empty.Empty) (*api.VersionResponse, error) { +func (s *service) Version(ctx context.Context, _ *ptypes.Empty) (*api.VersionResponse, error) { return &api.VersionResponse{ Version: ctrdversion.Version, Revision: ctrdversion.Revision,