protobuf: use the gogo/types package for empty

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-11-15 19:08:54 -08:00
parent f49b1b7179
commit c5022ad92d
No known key found for this signature in database
GPG Key ID: 67B3DED84EDC823F
27 changed files with 87 additions and 87 deletions

View File

@ -24,6 +24,7 @@ plugins = ["grpc", "fieldpath"]
[packages] [packages]
"gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto" "gogoproto/gogo.proto" = "github.com/gogo/protobuf/gogoproto"
"google/protobuf/any.proto" = "github.com/gogo/protobuf/types" "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/descriptor.proto" = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
"google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types" "google/protobuf/field_mask.proto" = "github.com/gogo/protobuf/types"
"google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types" "google/protobuf/timestamp.proto" = "github.com/gogo/protobuf/types"

View File

@ -26,7 +26,7 @@ import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types" 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 google_protobuf3 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"

View File

@ -35,7 +35,7 @@ import math "math"
import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types" import google_protobuf1 "github.com/gogo/protobuf/types"
import _ "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 github_com_opencontainers_go_digest "github.com/opencontainers/go-digest"
import time "time" import time "time"

View File

@ -9,7 +9,7 @@ import math "math"
import _ "github.com/containerd/containerd/protobuf/plugin" import _ "github.com/containerd/containerd/protobuf/plugin"
import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/gogoproto"
import google_protobuf1 "github.com/gogo/protobuf/types" 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 _ "github.com/gogo/protobuf/types"
import time "time" import time "time"

View File

@ -25,7 +25,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" 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 google_protobuf2 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"
import containerd_types "github.com/containerd/containerd/api/types" import containerd_types "github.com/containerd/containerd/api/types"

View File

@ -21,7 +21,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" 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 _ "github.com/gogo/protobuf/types"
import time "time" import time "time"

View File

@ -25,7 +25,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" 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 google_protobuf2 "github.com/gogo/protobuf/types"
import ( import (

View File

@ -32,7 +32,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import _ "github.com/gogo/protobuf/gogoproto" 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 google_protobuf2 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"
import containerd_types "github.com/containerd/containerd/api/types" import containerd_types "github.com/containerd/containerd/api/types"

View File

@ -41,7 +41,7 @@ package tasks
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" 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 google_protobuf1 "github.com/gogo/protobuf/types"
import _ "github.com/gogo/protobuf/gogoproto" import _ "github.com/gogo/protobuf/gogoproto"
import containerd_types "github.com/containerd/containerd/api/types" import containerd_types "github.com/containerd/containerd/api/types"

View File

@ -15,7 +15,7 @@ package version
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" 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 _ "github.com/gogo/protobuf/gogoproto"
import ( import (

View File

@ -40,7 +40,7 @@ import (
snapshotservice "github.com/containerd/containerd/services/snapshot" snapshotservice "github.com/containerd/containerd/services/snapshot"
"github.com/containerd/containerd/snapshot" "github.com/containerd/containerd/snapshot"
"github.com/containerd/typeurl" "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" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -489,7 +489,7 @@ type Version struct {
// Version returns the version of containerd that the client is connected to // Version returns the version of containerd that the client is connected to
func (c *Client) Version(ctx context.Context) (Version, error) { 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 { if err != nil {
return Version{}, err return Version{}, err
} }

View File

@ -23,7 +23,7 @@ import (
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/reaper" "github.com/containerd/containerd/reaper"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
google_protobuf "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -163,7 +163,7 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal, server *grpc.Se
Signal: uint32(syscall.SIGKILL), Signal: uint32(syscall.SIGKILL),
All: true, All: true,
}) })
sv.Delete(context.Background(), &google_protobuf.Empty{}) sv.Delete(context.Background(), &ptypes.Empty{})
close(done) close(done)
}) })
case unix.SIGUSR1: case unix.SIGUSR1:

View File

@ -16,15 +16,14 @@ import (
"github.com/containerd/containerd/cmd/ctr/commands" "github.com/containerd/containerd/cmd/ctr/commands"
shim "github.com/containerd/containerd/linux/shim/v1" shim "github.com/containerd/containerd/linux/shim/v1"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
protobuf "github.com/gogo/protobuf/types" ptypes "github.com/gogo/protobuf/types"
google_protobuf "github.com/golang/protobuf/ptypes/empty"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
var empty = &google_protobuf.Empty{} var empty = &ptypes.Empty{}
var fifoFlags = []cli.Flag{ var fifoFlags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{
@ -168,7 +167,7 @@ var execCommand = cli.Command{
rq := &shim.ExecProcessRequest{ rq := &shim.ExecProcessRequest{
ID: id, ID: id,
Spec: &protobuf.Any{ Spec: &ptypes.Any{
TypeUrl: url, TypeUrl: url,
Value: spec, Value: spec,
}, },

View File

@ -30,7 +30,7 @@ import (
"github.com/containerd/containerd/sys" "github.com/containerd/containerd/sys"
runc "github.com/containerd/go-runc" runc "github.com/containerd/go-runc"
"github.com/containerd/typeurl" "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" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -39,7 +39,7 @@ import (
var ( var (
pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "linux") pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, "linux")
empty = &google_protobuf.Empty{} empty = &ptypes.Empty{}
) )
const ( const (

View File

@ -25,11 +25,11 @@ import (
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/reaper" "github.com/containerd/containerd/reaper"
"github.com/containerd/containerd/sys" "github.com/containerd/containerd/sys"
google_protobuf "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
var empty = &google_protobuf.Empty{} var empty = &ptypes.Empty{}
// Opt is an option for a shim client configuration // Opt is an option for a shim client configuration
type Opt func(context.Context, shim.Config) (shimapi.ShimClient, io.Closer, error) type Opt func(context.Context, shim.Config) (shimapi.ShimClient, io.Closer, error)

View File

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
shimapi "github.com/containerd/containerd/linux/shim/v1" 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/net/context"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"google.golang.org/grpc" "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) 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 // make sure we unmount the containers rootfs for this local
if err := unix.Unmount(filepath.Join(c.s.config.Path, "rootfs"), 0); err != nil { if err := unix.Unmount(filepath.Join(c.s.config.Path, "rootfs"), 0); err != nil {
return nil, err return nil, err
@ -43,11 +43,11 @@ func (c *local) DeleteProcess(ctx context.Context, in *shimapi.DeleteProcessRequ
return c.s.DeleteProcess(ctx, in) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) return c.s.Update(ctx, in)
} }

View File

@ -24,13 +24,13 @@ import (
"github.com/containerd/containerd/runtime" "github.com/containerd/containerd/runtime"
runc "github.com/containerd/go-runc" runc "github.com/containerd/go-runc"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
google_protobuf "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
var empty = &google_protobuf.Empty{} var empty = &ptypes.Empty{}
// Config contains shim specific configuration // Config contains shim specific configuration
type Config struct { type Config struct {
@ -142,7 +142,7 @@ func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*shimapi.
} }
// Delete the initial process and container // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[s.id] 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 // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
@ -214,7 +214,7 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecProcessRequest) (*goo
} }
// ResizePty of a process // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if r.ID == "" { if r.ID == "" {
@ -275,7 +275,7 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.
} }
// Pause the container // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[s.id] p := s.processes[s.id]
@ -289,7 +289,7 @@ func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_
} }
// Resume the container // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[s.id] 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 // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if r.ID == "" { if r.ID == "" {
@ -359,7 +359,7 @@ func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*sh
} }
// CloseIO of a process // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[r.ID] p := s.processes[r.ID]
@ -375,7 +375,7 @@ func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*goog
} }
// Checkpoint the container // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[s.id] 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 // 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{ return &shimapi.ShimInfoResponse{
ShimPid: uint32(os.Getpid()), ShimPid: uint32(os.Getpid()),
}, nil }, nil
} }
// Update a running container // 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() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
p := s.processes[s.id] p := s.processes[s.id]

View File

@ -35,7 +35,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt" import fmt "fmt"
import math "math" import math "math"
import google_protobuf "github.com/gogo/protobuf/types" 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/gogoproto"
import _ "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/types"
import containerd_types "github.com/containerd/containerd/api/types" import containerd_types "github.com/containerd/containerd/api/types"

View File

@ -9,7 +9,7 @@ import (
"github.com/containerd/containerd/events" "github.com/containerd/containerd/events"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -149,24 +149,24 @@ func (s *service) Update(ctx context.Context, req *api.UpdateContainerRequest) (
return &resp, nil 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 { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store containers.Store) error {
return store.Delete(ctx, req.ID) return store.Delete(ctx, req.ID)
}); err != nil { }); err != nil {
return &empty.Empty{}, errdefs.ToGRPC(err) return &ptypes.Empty{}, errdefs.ToGRPC(err)
} }
if err := s.publisher.Publish(ctx, "/containers/delete", &eventsapi.ContainerDelete{ if err := s.publisher.Publish(ctx, "/containers/delete", &eventsapi.ContainerDelete{
ID: req.ID, ID: req.ID,
}); err != nil { }); err != nil {
return &empty.Empty{}, err return &ptypes.Empty{}, err
} }
if err := s.db.GarbageCollect(ctx); err != nil { 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 { func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store containers.Store) error) func(tx *bolt.Tx) error {

View File

@ -12,7 +12,7 @@ import (
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
digest "github.com/opencontainers/go-digest" digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -138,7 +138,7 @@ func (s *service) List(req *api.ListContentRequest, session api.Content_ListServ
return nil 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 { if err := req.Digest.Validate(); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, err.Error()) 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 nil, err
} }
return &empty.Empty{}, nil return &ptypes.Empty{}, nil
} }
func (s *service) Read(req *api.ReadContentRequest, session api.Content_ReadServer) error { 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 { if err := s.store.Abort(ctx, req.Ref); err != nil {
return nil, errdefs.ToGRPC(err) return nil, errdefs.ToGRPC(err)
} }
return &empty.Empty{}, nil return &ptypes.Empty{}, nil
} }

View File

@ -5,7 +5,7 @@ import (
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events/exchange" "github.com/containerd/containerd/events/exchange"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -35,20 +35,20 @@ func (s *service) Register(server *grpc.Server) error {
return nil 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 { if err := s.events.Publish(ctx, r.Topic, r.Event); err != nil {
return nil, errdefs.ToGRPC(err) 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 { if err := s.events.Forward(ctx, r.Envelope); err != nil {
return nil, errdefs.ToGRPC(err) 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 { func (s *service) Subscribe(req *api.SubscribeRequest, srv api.Events_SubscribeServer) error {

View File

@ -9,7 +9,7 @@ import (
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -150,7 +150,7 @@ func (s *service) Update(ctx context.Context, req *imagesapi.UpdateImageRequest)
return &resp, nil 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 { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error {
return errdefs.ToGRPC(store.Delete(ctx, req.Name)) return errdefs.ToGRPC(store.Delete(ctx, req.Name))
}); err != nil { }); 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 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 { func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store images.Store) error) func(tx *bolt.Tx) error {

View File

@ -12,7 +12,7 @@ import (
api "github.com/containerd/containerd/api/services/leases/v1" api "github.com/containerd/containerd/api/services/leases/v1"
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -67,13 +67,13 @@ func (s *service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create
}, nil }, 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 { if err := s.db.Update(func(tx *bolt.Tx) error {
return metadata.NewLeaseManager(tx).Delete(ctx, r.ID) return metadata.NewLeaseManager(tx).Delete(ctx, r.ID)
}); err != nil { }); err != nil {
return nil, err return nil, err
} }
return &empty.Empty{}, nil return &ptypes.Empty{}, nil
} }
func (s *service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) { func (s *service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) {

View File

@ -11,7 +11,7 @@ import (
"github.com/containerd/containerd/metadata" "github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
@ -182,21 +182,21 @@ func (s *service) Update(ctx context.Context, req *api.UpdateNamespaceRequest) (
return &resp, nil 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 { if err := s.withStoreUpdate(ctx, func(ctx context.Context, store namespaces.Store) error {
return errdefs.ToGRPC(store.Delete(ctx, req.Name)) return errdefs.ToGRPC(store.Delete(ctx, req.Name))
}); err != nil { }); err != nil {
return &empty.Empty{}, err return &ptypes.Empty{}, err
} }
// set the namespace in the context before publishing the event // set the namespace in the context before publishing the event
ctx = namespaces.WithNamespace(ctx, req.Name) ctx = namespaces.WithNamespace(ctx, req.Name)
if err := s.publisher.Publish(ctx, "/namespaces/delete", &eventsapi.NamespaceDelete{ if err := s.publisher.Publish(ctx, "/namespaces/delete", &eventsapi.NamespaceDelete{
Name: req.Name, Name: req.Name,
}); err != nil { }); 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 { func (s *service) withStore(ctx context.Context, fn func(ctx context.Context, store namespaces.Store) error) func(tx *bolt.Tx) error {

View File

@ -13,7 +13,7 @@ import (
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/snapshot" "github.com/containerd/containerd/snapshot"
protoempty "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -29,7 +29,7 @@ func init() {
}) })
} }
var empty = &protoempty.Empty{} var empty = &ptypes.Empty{}
type service struct { type service struct {
db *metadata.DB db *metadata.DB
@ -127,7 +127,7 @@ func (s *service) Mounts(ctx context.Context, mr *snapshotapi.MountsRequest) (*s
}, nil }, 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") log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("Committing snapshot")
sn, err := s.getSnapshotter(cr.Snapshotter) sn, err := s.getSnapshotter(cr.Snapshotter)
if err != nil { if err != nil {
@ -151,7 +151,7 @@ func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequ
return empty, nil 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") log.G(ctx).WithField("key", rr.Key).Debugf("Removing snapshot")
sn, err := s.getSnapshotter(rr.Snapshotter) sn, err := s.getSnapshotter(rr.Snapshotter)
if err != nil { if err != nil {

View File

@ -26,7 +26,7 @@ import (
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/runtime" "github.com/containerd/containerd/runtime"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
google_protobuf "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
@ -35,7 +35,7 @@ import (
var ( var (
_ = (api.TasksServer)(&service{}) _ = (api.TasksServer)(&service{})
empty = &google_protobuf.Empty{} empty = &ptypes.Empty{}
) )
func init() { 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -308,7 +308,7 @@ func (s *service) Pause(ctx context.Context, r *api.PauseTaskRequest) (*google_p
return empty, nil 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -320,7 +320,7 @@ func (s *service) Resume(ctx context.Context, r *api.ResumeTaskRequest) (*google
return empty, nil 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -365,7 +365,7 @@ func (s *service) ListPids(ctx context.Context, r *api.ListPidsRequest) (*api.Li
}, nil }, 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 == "" { if r.ExecID == "" {
return nil, grpc.Errorf(codes.InvalidArgument, "exec id cannot be empty") 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 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -407,7 +407,7 @@ func (s *service) ResizePty(ctx context.Context, r *api.ResizePtyRequest) (*goog
return empty, nil 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -471,7 +471,7 @@ func (s *service) Checkpoint(ctx context.Context, r *api.CheckpointTaskRequest)
}, nil }, 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) t, err := s.getTask(ctx, r.ContainerID)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -4,7 +4,7 @@ import (
api "github.com/containerd/containerd/api/services/version/v1" api "github.com/containerd/containerd/api/services/version/v1"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
ctrdversion "github.com/containerd/containerd/version" ctrdversion "github.com/containerd/containerd/version"
empty "github.com/golang/protobuf/ptypes/empty" ptypes "github.com/gogo/protobuf/types"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -31,7 +31,7 @@ func (s *service) Register(server *grpc.Server) error {
return nil 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{ return &api.VersionResponse{
Version: ctrdversion.Version, Version: ctrdversion.Version,
Revision: ctrdversion.Revision, Revision: ctrdversion.Revision,