From bbb6722da05de00abcd47512c053333de3abe875 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 19 Jun 2017 12:00:28 +0100 Subject: [PATCH 01/35] Update to containerd 7e3b7dead60d96e9a7b13b8813d1712c7761e327 Needed to add namespacing and to use the new runtime name. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 22 +- vendor.conf | 5 +- .../containerd/containerd/README.md | 1 + .../api/services/containers/containers.pb.go | 199 ++++++--- .../api/services/containers/containers.proto | 4 + .../api/services/execution/execution.pb.go | 381 +++++++++++++----- .../api/services/execution/execution.proto | 6 + .../containerd/api/types/task/task.pb.go | 377 ++++++++++++++--- .../containerd/api/types/task/task.proto | 7 + .../containerd/containers/containers.go | 29 ++ .../containerd/containerd/content/content.go | 11 + .../containerd/containerd/content/helpers.go | 15 +- .../containerd/containerd/content/locks.go | 41 +- .../containerd/containerd/content/readerat.go | 26 ++ .../containerd/containerd/content/store.go | 45 +-- .../containerd/containerd/content/writer.go | 14 +- .../containerd/containerd/images/handlers.go | 62 ++- .../containerd/containerd/images/image.go | 71 ++-- .../containerd/images/mediatypes.go | 2 + .../containerd/containerd/images/storage.go | 219 ---------- .../containerd/containerd/log/grpc.go | 8 +- .../containerd/containerd/metadata/buckets.go | 125 ++++++ .../containerd/metadata/containers.go | 218 ++++++++++ .../containerd/containerd/metadata/errors.go | 22 + .../containerd/containerd/metadata/images.go | 152 +++++++ .../containerd/metadata/namespaces.go | 145 +++++++ .../containerd/namespaces/context.go | 42 ++ .../containerd/containerd/namespaces/grpc.go | 44 ++ .../containerd/containerd/namespaces/store.go | 21 + .../containerd/containerd/plugin/container.go | 13 +- .../containerd/containerd/plugin/context.go | 36 ++ .../containerd/containerd/plugin/differ.go | 12 + .../containerd/containerd/plugin/errors.go | 1 - .../containerd/containerd/plugin/plugin.go | 90 +++-- .../containerd/containerd/plugin/runtime.go | 4 + .../containerd/remotes/docker/fetcher.go | 1 + .../containerd/remotes/docker/pusher.go | 197 +++++++-- .../containerd/remotes/docker/resolver.go | 12 + .../containerd/remotes/docker/status.go | 46 +++ .../containerd/containerd/remotes/handlers.go | 90 ++++- .../containerd/containerd/remotes/resolver.go | 7 +- .../containerd/services/content/helpers.go | 4 + .../containerd/services/content/reader.go | 43 +- .../containerd/services/content/service.go | 16 +- .../containerd/services/content/store.go | 9 + .../containerd/services/content/writer.go | 8 - .../containerd/services/images/helpers.go | 12 +- .../containerd/services/images/service.go | 15 +- .../containerd/containerd/snapshot/errors.go | 44 -- .../containerd/snapshot/snapshotter.go | 238 ----------- .../containerd/containerd/vendor.conf | 5 +- .../containerd/continuity/sysx/xattr_linux.go | 3 + .../continuity/sysx/xattr_linux_ppc64.go | 102 ++++- .../continuity/sysx/xattr_linux_ppc64le.go | 102 ++++- .../continuity/sysx/xattr_linux_s390x.go | 102 ++++- .../golang/protobuf/ptypes/empty/empty.pb.go | 17 +- .../golang/protobuf/ptypes/empty/empty.proto | 1 - vendor/github.com/nightlyone/lockfile/LICENSE | 19 - .../github.com/nightlyone/lockfile/README.md | 52 --- .../nightlyone/lockfile/lockfile.go | 201 --------- .../nightlyone/lockfile/lockfile_unix.go | 20 - .../nightlyone/lockfile/lockfile_windows.go | 30 -- 62 files changed, 2582 insertions(+), 1284 deletions(-) create mode 100644 vendor/github.com/containerd/containerd/containers/containers.go create mode 100644 vendor/github.com/containerd/containerd/content/readerat.go delete mode 100644 vendor/github.com/containerd/containerd/images/storage.go create mode 100644 vendor/github.com/containerd/containerd/metadata/buckets.go create mode 100644 vendor/github.com/containerd/containerd/metadata/containers.go create mode 100644 vendor/github.com/containerd/containerd/metadata/errors.go create mode 100644 vendor/github.com/containerd/containerd/metadata/images.go create mode 100644 vendor/github.com/containerd/containerd/metadata/namespaces.go create mode 100644 vendor/github.com/containerd/containerd/namespaces/context.go create mode 100644 vendor/github.com/containerd/containerd/namespaces/grpc.go create mode 100644 vendor/github.com/containerd/containerd/namespaces/store.go create mode 100644 vendor/github.com/containerd/containerd/plugin/context.go create mode 100644 vendor/github.com/containerd/containerd/plugin/differ.go create mode 100644 vendor/github.com/containerd/containerd/remotes/docker/status.go delete mode 100644 vendor/github.com/containerd/containerd/snapshot/errors.go delete mode 100644 vendor/github.com/containerd/containerd/snapshot/snapshotter.go delete mode 100644 vendor/github.com/nightlyone/lockfile/LICENSE delete mode 100644 vendor/github.com/nightlyone/lockfile/README.md delete mode 100644 vendor/github.com/nightlyone/lockfile/lockfile.go delete mode 100644 vendor/github.com/nightlyone/lockfile/lockfile_unix.go delete mode 100644 vendor/github.com/nightlyone/lockfile/lockfile_windows.go diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 72a0246899..2d7b930865 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -27,6 +27,7 @@ import ( "github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" + "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" contentservice "github.com/containerd/containerd/services/content" @@ -71,6 +72,10 @@ type containerAdapter struct { deleteResponse *execution.DeleteResponse } +func withNamespace(ctx context.Context) context.Context { + return namespaces.WithNamespace(ctx, "default") +} + func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { container := task.Spec.GetContainer() if container == nil { @@ -149,6 +154,8 @@ func prepareStdio(stdout, stderr string, console bool) (wg *sync.WaitGroup, err } func (c *containerAdapter) pullImage(ctx context.Context) error { + ctx = withNamespace(ctx) + options := docker.ResolverOptions{} tr := &http.Transport{ @@ -445,6 +452,8 @@ func (c *containerAdapter) spec(ctx context.Context, config *ocispec.ImageConfig } func (c *containerAdapter) create(ctx context.Context) error { + ctx = withNamespace(ctx) + if c.resolvedImageName == "" { return errors.New("image has not been pulled") } @@ -518,7 +527,7 @@ func (c *containerAdapter) create(ctx context.Context) error { TypeUrl: specs.Version, Value: data, }, - Runtime: "linux", + Runtime: "io.containerd.runtime.v1.linux", }, }) if err != nil { @@ -541,6 +550,7 @@ func (c *containerAdapter) create(ctx context.Context) error { } func (c *containerAdapter) start(ctx context.Context) error { + ctx = withNamespace(ctx) _, err := c.taskClient.Start(ctx, &execution.StartRequest{ ContainerID: naming.Task(c.task), }) @@ -563,6 +573,8 @@ func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan t // A chan struct{} is returned that will be closed if the event processing // fails and needs to be restarted. func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) (<-chan task.Event, <-chan struct{}, error) { + ctx = withNamespace(ctx) + id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ @@ -610,6 +622,8 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) } func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { + ctx = withNamespace(ctx) + id := naming.Task(c.task) rsp, err := c.taskClient.Info(ctx, &execution.InfoRequest{ContainerID: id}) if err != nil { @@ -619,6 +633,8 @@ func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { } func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { + ctx = withNamespace(ctx) + id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ "ID": id, @@ -648,6 +664,8 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { } func (c *containerAdapter) terminate(ctx context.Context) error { + ctx = withNamespace(ctx) + id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ "ID": id, @@ -657,6 +675,8 @@ func (c *containerAdapter) terminate(ctx context.Context) error { } func (c *containerAdapter) remove(ctx context.Context) error { + ctx = withNamespace(ctx) + id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ "ID": id, diff --git a/vendor.conf b/vendor.conf index 4f5d293b8b..2558fb6965 100644 --- a/vendor.conf +++ b/vendor.conf @@ -31,11 +31,10 @@ github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb github.com/opencontainers/image-spec f03dbe35d449c54915d235f1a3cf8f585a24babe # containerd executor -github.com/containerd/containerd 7fc91b05917e93d474fab9465547d44eacd10ce3 -github.com/containerd/continuity f4ad4294c92f596c9241947c416d1297f9faf3ea +github.com/containerd/containerd 7e3b7dead60d96e9a7b13b8813d1712c7761e327 +github.com/containerd/continuity 86cec1535a968310e7532819f699ff2830ed7463 github.com/containerd/fifo 69b99525e472735860a5269b75af1970142b3062 github.com/opencontainers/runtime-spec v1.0.0-rc5 -github.com/nightlyone/lockfile 1d49c987357a327b5b03aa84cbddd582c328615d golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/davecgh/go-spew 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d diff --git a/vendor/github.com/containerd/containerd/README.md b/vendor/github.com/containerd/containerd/README.md index 4af0c1f048..2c7888674f 100644 --- a/vendor/github.com/containerd/containerd/README.md +++ b/vendor/github.com/containerd/containerd/README.md @@ -1,5 +1,6 @@ ![banner](/docs/images/containerd-dark.png?raw=true) +[![GoDoc](https://godoc.org/github.com/containerd/containerd?status.svg)](https://godoc.org/github.com/containerd/containerd) [![Build Status](https://travis-ci.org/containerd/containerd.svg?branch=master)](https://travis-ci.org/containerd/containerd) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd?ref=badge_shield) diff --git a/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go b/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go index 96de79d982..544cdbc6f3 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go @@ -29,13 +29,18 @@ 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_protobuf3 "github.com/gogo/protobuf/types" +import _ "github.com/gogo/protobuf/types" import _ "github.com/containerd/containerd/api/types/descriptor" +import time "time" + import ( context "golang.org/x/net/context" grpc "google.golang.org/grpc" ) +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + import strings "strings" import reflect "reflect" import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" @@ -46,6 +51,7 @@ import io "io" var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -80,7 +86,9 @@ type Container struct { // Snapshots referenced in this field will not be garbage collected. // // This field may be updated. - RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"` + RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"` + CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,stdtime" json:"created_at"` + UpdatedAt time.Time `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,stdtime" json:"updated_at"` } func (m *Container) Reset() { *m = Container{} } @@ -457,6 +465,22 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintContainers(dAtA, i, uint64(len(m.RootFS))) i += copy(dAtA[i:], m.RootFS) } + dAtA[i] = 0x42 + i++ + i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt))) + n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + dAtA[i] = 0x4a + i++ + i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt))) + n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 return i, nil } @@ -502,11 +526,11 @@ func (m *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n2, err := m.Container.MarshalTo(dAtA[i:]) + n4, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n4 return i, nil } @@ -582,11 +606,11 @@ func (m *CreateContainerRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n3, err := m.Container.MarshalTo(dAtA[i:]) + n5, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n3 + i += n5 return i, nil } @@ -608,11 +632,11 @@ func (m *CreateContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n4, err := m.Container.MarshalTo(dAtA[i:]) + n6, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n4 + i += n6 return i, nil } @@ -634,20 +658,20 @@ func (m *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n5, err := m.Container.MarshalTo(dAtA[i:]) + n7, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n7 if m.UpdateMask != nil { dAtA[i] = 0x12 i++ i = encodeVarintContainers(dAtA, i, uint64(m.UpdateMask.Size())) - n6, err := m.UpdateMask.MarshalTo(dAtA[i:]) + n8, err := m.UpdateMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n6 + i += n8 } return i, nil } @@ -670,11 +694,11 @@ func (m *UpdateContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n7, err := m.Container.MarshalTo(dAtA[i:]) + n9, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n7 + i += n9 return i, nil } @@ -760,6 +784,10 @@ func (m *Container) Size() (n int) { if l > 0 { n += 1 + l + sovContainers(uint64(l)) } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovContainers(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt) + n += 1 + l + sovContainers(uint64(l)) return n } @@ -883,6 +911,8 @@ func (this *Container) String() string { `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, + `CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`, + `UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1280,6 +1310,66 @@ func (m *Container) Unmarshal(dAtA []byte) error { } m.RootFS = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainers + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainers + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipContainers(dAtA[iNdEx:]) @@ -2162,45 +2252,48 @@ func init() { } var fileDescriptorContainers = []byte{ - // 625 bytes of a gzipped FileDescriptorProto + // 680 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0x9d, 0xe0, 0x2a, 0x13, 0x21, 0xa1, 0x25, 0x18, 0x63, 0x24, 0x37, 0x32, 0x3f, 0xca, - 0x05, 0x1b, 0xc2, 0x85, 0x9f, 0x0a, 0x89, 0xfe, 0xaa, 0x52, 0xe1, 0xe0, 0x02, 0xe5, 0x86, 0x9c, - 0x78, 0x63, 0x56, 0x75, 0xbc, 0xc6, 0xbb, 0xae, 0x94, 0x1b, 0xef, 0xc0, 0x8d, 0x67, 0xe0, 0x41, - 0x7a, 0xe4, 0xc8, 0xa9, 0xa2, 0x7e, 0x12, 0xe4, 0xb5, 0x53, 0xa7, 0xb6, 0x43, 0x91, 0xe8, 0x6d, - 0xc6, 0xf3, 0xcd, 0xd7, 0xf9, 0x66, 0xbe, 0x6d, 0x60, 0xcf, 0x27, 0xfc, 0x73, 0x32, 0xb2, 0xc6, - 0x74, 0x6a, 0x8f, 0x69, 0xc8, 0x5d, 0x12, 0xe2, 0xd8, 0x5b, 0x0c, 0xdd, 0x88, 0xd8, 0x0c, 0xc7, - 0xc7, 0x64, 0x8c, 0x59, 0xf9, 0x7d, 0x31, 0xb4, 0xa2, 0x98, 0x72, 0x8a, 0xae, 0x97, 0x4d, 0xd6, - 0xf1, 0x13, 0xbd, 0xe7, 0x53, 0x9f, 0x8a, 0x8a, 0x9d, 0x45, 0x39, 0x48, 0xbf, 0xe3, 0x53, 0xea, - 0x07, 0xd8, 0x16, 0xd9, 0x28, 0x99, 0xd8, 0x6e, 0x38, 0x2b, 0x4a, 0x77, 0xab, 0x25, 0x3c, 0x8d, - 0xf8, 0xbc, 0xd8, 0xaf, 0x16, 0x27, 0x04, 0x07, 0xde, 0xa7, 0xa9, 0xcb, 0x8e, 0x0a, 0xc4, 0xce, - 0x3f, 0x29, 0xe1, 0xb3, 0x08, 0x33, 0xdb, 0xc3, 0x6c, 0x1c, 0x93, 0x88, 0xd3, 0x78, 0x21, 0xcc, - 0x79, 0xcc, 0xef, 0x32, 0x74, 0x36, 0xe7, 0x4d, 0x48, 0x05, 0x99, 0x78, 0x9a, 0xd4, 0x97, 0x06, - 0x9d, 0x0d, 0x25, 0x3d, 0x5d, 0x93, 0xf7, 0xb6, 0x1c, 0x99, 0x78, 0x68, 0x1d, 0x94, 0xc0, 0x1d, - 0xe1, 0x80, 0x69, 0x72, 0xbf, 0x35, 0xe8, 0x0e, 0xef, 0x5b, 0x17, 0xd4, 0x5b, 0xe7, 0x0c, 0xd6, - 0xbe, 0x80, 0x6d, 0x87, 0x3c, 0x9e, 0x39, 0x45, 0x0f, 0xea, 0xc1, 0x35, 0x32, 0x75, 0x7d, 0xac, - 0xb5, 0x32, 0x62, 0x27, 0x4f, 0x90, 0x06, 0xab, 0x71, 0x12, 0x72, 0x32, 0xc5, 0x5a, 0x5b, 0x7c, - 0x9f, 0xa7, 0x68, 0x00, 0x6d, 0x16, 0xe1, 0xb1, 0xa6, 0xf4, 0xa5, 0x41, 0x77, 0xd8, 0xb3, 0xf2, - 0x65, 0x58, 0xf3, 0x65, 0x58, 0xaf, 0xc3, 0x99, 0x23, 0x10, 0xc8, 0x04, 0x25, 0xa6, 0x94, 0x4f, - 0x98, 0xb6, 0x2a, 0x66, 0x86, 0xf4, 0x74, 0x4d, 0x71, 0x28, 0xe5, 0x3b, 0x07, 0x4e, 0x51, 0xd1, - 0x9f, 0x43, 0x77, 0x61, 0x28, 0x74, 0x03, 0x5a, 0x47, 0x78, 0x96, 0x6b, 0x74, 0xb2, 0x30, 0x1b, - 0xef, 0xd8, 0x0d, 0x12, 0xac, 0xc9, 0xf9, 0x78, 0x22, 0x79, 0x21, 0x3f, 0x93, 0xcc, 0x47, 0x70, - 0x73, 0x17, 0xf3, 0x73, 0x71, 0x0e, 0xfe, 0x92, 0x60, 0xc6, 0x97, 0x6d, 0xc9, 0x7c, 0x07, 0xbd, - 0x8b, 0x70, 0x16, 0xd1, 0x90, 0x61, 0xb4, 0x0e, 0x9d, 0xf3, 0x75, 0x89, 0xb6, 0xee, 0x50, 0x5b, - 0xb6, 0xc0, 0x8d, 0xf6, 0xc9, 0xe9, 0xda, 0x8a, 0x53, 0x36, 0x98, 0x36, 0xdc, 0xda, 0x27, 0xac, - 0xa4, 0x65, 0xe5, 0x18, 0xca, 0x84, 0x04, 0xbc, 0xe0, 0xec, 0x38, 0x45, 0x66, 0x7e, 0x04, 0xb5, - 0xda, 0x50, 0x0c, 0xf2, 0x0a, 0xa0, 0xf4, 0xb1, 0x26, 0x89, 0x53, 0x5e, 0x36, 0xc9, 0x42, 0x87, - 0xf9, 0x01, 0xd4, 0xcd, 0x18, 0xbb, 0x1c, 0xd7, 0x56, 0xf2, 0x7f, 0x12, 0x0f, 0xe1, 0x76, 0x8d, - 0xf7, 0x4a, 0x76, 0xf7, 0x4d, 0x02, 0xf5, 0x7d, 0xe4, 0x5d, 0xf9, 0xc4, 0xe8, 0x25, 0x74, 0x13, - 0xc1, 0x2b, 0xde, 0xa4, 0x70, 0x4e, 0x77, 0xa8, 0xd7, 0x9c, 0xba, 0x93, 0x3d, 0xdb, 0x37, 0x2e, - 0x3b, 0x72, 0x20, 0x87, 0x67, 0x71, 0x26, 0xb7, 0x36, 0xd4, 0x95, 0xc8, 0x7d, 0x0c, 0xea, 0x16, - 0x0e, 0x70, 0x83, 0xda, 0x25, 0x96, 0x1d, 0xfe, 0x68, 0x01, 0x94, 0x46, 0x41, 0x6f, 0xa1, 0xb5, - 0x8b, 0x39, 0x32, 0x2b, 0x7f, 0xb2, 0xe1, 0x11, 0xe8, 0xf7, 0xfe, 0x8a, 0x29, 0xe4, 0x1c, 0x40, - 0x3b, 0xb3, 0x22, 0xaa, 0xfe, 0xbf, 0x68, 0x34, 0xb4, 0xfe, 0xe0, 0x12, 0x54, 0x41, 0x7a, 0x08, - 0x4a, 0xee, 0x16, 0x54, 0x6d, 0x68, 0x36, 0xa7, 0xfe, 0xf0, 0x32, 0x58, 0x49, 0x9c, 0xdf, 0xa5, - 0x46, 0xdc, 0xec, 0xa1, 0x1a, 0xf1, 0xb2, 0xab, 0xee, 0x82, 0x92, 0xdf, 0xa5, 0x46, 0xdc, 0x7c, - 0x2e, 0x5d, 0xad, 0x39, 0x69, 0x3b, 0xfb, 0x75, 0xd8, 0xd0, 0x4e, 0xce, 0x8c, 0x95, 0x5f, 0x67, - 0xc6, 0xca, 0xd7, 0xd4, 0x90, 0x4e, 0x52, 0x43, 0xfa, 0x99, 0x1a, 0xd2, 0xef, 0xd4, 0x90, 0x46, - 0x8a, 0x40, 0x3e, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xcd, 0xee, 0x1b, 0xe2, 0x06, 0x00, - 0x00, + 0x10, 0xae, 0x93, 0xe0, 0x36, 0x13, 0x21, 0xa1, 0x25, 0x04, 0x63, 0xa4, 0x24, 0x32, 0x3f, 0xca, + 0x05, 0x1b, 0xc2, 0x85, 0x9f, 0x0a, 0xa9, 0xe9, 0x9f, 0x2a, 0x15, 0x0e, 0x6e, 0xa1, 0xdc, 0x2a, + 0x27, 0xde, 0x04, 0xab, 0x8e, 0xd7, 0x78, 0x37, 0x95, 0x72, 0xe3, 0x11, 0x90, 0x78, 0x05, 0x8e, + 0x3c, 0x48, 0x8f, 0x1c, 0x39, 0x15, 0x9a, 0x27, 0x41, 0xbb, 0x5e, 0xd7, 0xa9, 0xed, 0x50, 0x10, + 0xbd, 0xcd, 0x78, 0xbe, 0xf9, 0x32, 0xf3, 0xcd, 0x67, 0x07, 0x76, 0x46, 0x1e, 0xfb, 0x30, 0xe9, + 0x9b, 0x03, 0x32, 0xb6, 0x06, 0x24, 0x60, 0x8e, 0x17, 0xe0, 0xc8, 0x9d, 0x0f, 0x9d, 0xd0, 0xb3, + 0x28, 0x8e, 0x8e, 0xbd, 0x01, 0xa6, 0xe9, 0xf3, 0xf9, 0xd0, 0x0c, 0x23, 0xc2, 0x08, 0xba, 0x9e, + 0x36, 0x99, 0xc7, 0x4f, 0xf4, 0xfa, 0x88, 0x8c, 0x88, 0xa8, 0x58, 0x3c, 0x8a, 0x41, 0xfa, 0x9d, + 0x11, 0x21, 0x23, 0x1f, 0x5b, 0x22, 0xeb, 0x4f, 0x86, 0x96, 0x13, 0x4c, 0x65, 0xe9, 0x6e, 0xb6, + 0x84, 0xc7, 0x21, 0x4b, 0x8a, 0xed, 0x6c, 0x71, 0xe8, 0x61, 0xdf, 0x3d, 0x1c, 0x3b, 0xf4, 0x48, + 0x22, 0x5a, 0x59, 0x04, 0xf3, 0xc6, 0x98, 0x32, 0x67, 0x1c, 0x4a, 0xc0, 0xd6, 0x5f, 0xad, 0xca, + 0xa6, 0x21, 0xa6, 0x96, 0x8b, 0xe9, 0x20, 0xf2, 0x42, 0x46, 0xa2, 0xb9, 0x30, 0xe6, 0x31, 0xbe, + 0x96, 0xa1, 0xba, 0x9e, 0x34, 0xa1, 0x06, 0x94, 0x3c, 0x57, 0x53, 0xda, 0x4a, 0xa7, 0xda, 0x53, + 0x67, 0xa7, 0xad, 0xd2, 0xce, 0x86, 0x5d, 0xf2, 0x5c, 0xb4, 0x0a, 0xaa, 0xef, 0xf4, 0xb1, 0x4f, + 0xb5, 0x52, 0xbb, 0xdc, 0xa9, 0x75, 0xef, 0x9b, 0x17, 0xe4, 0x31, 0xcf, 0x19, 0xcc, 0x5d, 0x01, + 0xdb, 0x0c, 0x58, 0x34, 0xb5, 0x65, 0x0f, 0xaa, 0xc3, 0x35, 0x6f, 0xec, 0x8c, 0xb0, 0x56, 0xe6, + 0xc4, 0x76, 0x9c, 0x20, 0x0d, 0x96, 0xa3, 0x49, 0xc0, 0xf7, 0xd2, 0x2a, 0xe2, 0x79, 0x92, 0xa2, + 0x0e, 0x54, 0x68, 0x88, 0x07, 0x9a, 0xda, 0x56, 0x3a, 0xb5, 0x6e, 0xdd, 0x8c, 0xb5, 0x30, 0x13, + 0x2d, 0xcc, 0xb5, 0x60, 0x6a, 0x0b, 0x04, 0x32, 0x40, 0x8d, 0x08, 0x61, 0x43, 0xaa, 0x2d, 0x8b, + 0x99, 0x61, 0x76, 0xda, 0x52, 0x6d, 0x42, 0xd8, 0xd6, 0x9e, 0x2d, 0x2b, 0x68, 0x1d, 0x60, 0x10, + 0x61, 0x87, 0x61, 0xf7, 0xd0, 0x61, 0xda, 0x8a, 0xe0, 0xd4, 0x73, 0x9c, 0xfb, 0x89, 0xbe, 0xbd, + 0x95, 0x93, 0xd3, 0xd6, 0xd2, 0xe7, 0x9f, 0x2d, 0xc5, 0xae, 0xca, 0xbe, 0x35, 0xc6, 0x49, 0x26, + 0xa1, 0x9b, 0x90, 0x54, 0xff, 0x85, 0x44, 0xf6, 0xad, 0x31, 0xfd, 0x39, 0xd4, 0xe6, 0xe4, 0x41, + 0x37, 0xa0, 0x7c, 0x84, 0xa7, 0xb1, 0xda, 0x36, 0x0f, 0xb9, 0x50, 0xc7, 0x8e, 0x3f, 0xc1, 0x5a, + 0x29, 0x16, 0x4a, 0x24, 0x2f, 0x4a, 0xcf, 0x14, 0xe3, 0x11, 0xdc, 0xdc, 0xc6, 0xec, 0x5c, 0x66, + 0x1b, 0x7f, 0x9c, 0x60, 0xca, 0x16, 0xdd, 0xcb, 0xd8, 0x87, 0xfa, 0x45, 0x38, 0x0d, 0x49, 0x40, + 0x31, 0x5a, 0x85, 0xea, 0xf9, 0xe1, 0x44, 0x5b, 0xad, 0xab, 0x2d, 0x3a, 0x65, 0xaf, 0xc2, 0x77, + 0xb0, 0xd3, 0x06, 0xc3, 0x82, 0x5b, 0xbb, 0x1e, 0x4d, 0x69, 0x69, 0x3a, 0x86, 0x3a, 0xf4, 0x7c, + 0x26, 0x39, 0xab, 0xb6, 0xcc, 0x8c, 0xf7, 0xd0, 0xc8, 0x36, 0xc8, 0x41, 0x5e, 0x01, 0xa4, 0xaf, + 0x9c, 0xa6, 0x08, 0x53, 0x5d, 0x36, 0xc9, 0x5c, 0x87, 0xf1, 0x0e, 0x1a, 0xeb, 0xe2, 0x38, 0x39, + 0x49, 0xfe, 0x6f, 0xc5, 0x03, 0xb8, 0x9d, 0xe3, 0xbd, 0x12, 0xed, 0xbe, 0x28, 0xd0, 0x78, 0x2b, + 0x9c, 0x70, 0xb5, 0x13, 0xa3, 0x97, 0x50, 0x8b, 0x1d, 0x26, 0x3e, 0x1f, 0xc2, 0x39, 0x45, 0xd6, + 0xdc, 0xe2, 0x5f, 0x98, 0xd7, 0x0e, 0x3d, 0xb2, 0xa5, 0x91, 0x79, 0xcc, 0xd7, 0xcd, 0x0d, 0x75, + 0x25, 0xeb, 0x3e, 0x86, 0xc6, 0x06, 0xf6, 0x71, 0xc1, 0xb6, 0x0b, 0x2c, 0xdb, 0xfd, 0x56, 0x06, + 0x48, 0x8d, 0x82, 0xde, 0x40, 0x79, 0x1b, 0x33, 0x64, 0x64, 0x7e, 0xb2, 0xe0, 0x25, 0xd0, 0xef, + 0xfd, 0x11, 0x23, 0xd7, 0xd9, 0x83, 0x0a, 0xb7, 0x22, 0xca, 0x7e, 0xb9, 0x0a, 0x0d, 0xad, 0x3f, + 0xb8, 0x04, 0x25, 0x49, 0x0f, 0x40, 0x8d, 0xdd, 0x82, 0xb2, 0x0d, 0xc5, 0xe6, 0xd4, 0x1f, 0x5e, + 0x06, 0x4b, 0x89, 0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0x3d, 0x94, 0x23, 0x5e, 0x74, 0xd5, 0x6d, 0x50, + 0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0xcf, 0xa5, 0x37, 0x72, 0x4e, 0xda, 0xe4, 0x7f, 0x64, 0x3d, 0xed, + 0xe4, 0xac, 0xb9, 0xf4, 0xe3, 0xac, 0xb9, 0xf4, 0x69, 0xd6, 0x54, 0x4e, 0x66, 0x4d, 0xe5, 0xfb, + 0xac, 0xa9, 0xfc, 0x9a, 0x35, 0x95, 0xbe, 0x2a, 0x90, 0x4f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, + 0xc1, 0x18, 0xeb, 0x02, 0x8d, 0x07, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/containers/containers.proto b/vendor/github.com/containerd/containerd/api/services/containers/containers.proto index bcdb85d009..445ebdea2f 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/containers.proto +++ b/vendor/github.com/containerd/containerd/api/services/containers/containers.proto @@ -6,6 +6,7 @@ import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; // Containers provides metadata storage for containers used in the execution @@ -65,6 +66,9 @@ message Container { // // This field may be updated. string rootfs = 7 [(gogoproto.customname) = "RootFS"]; + + google.protobuf.Timestamp created_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Timestamp updated_at = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message GetContainerRequest { diff --git a/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go b/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go index a2b5dc8d97..133aebaefd 100644 --- a/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go @@ -14,6 +14,7 @@ StartRequest DeleteRequest DeleteResponse + DeleteProcessRequest InfoRequest InfoResponse ListRequest @@ -133,13 +134,22 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{4} } +type DeleteProcessRequest struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } +func (*DeleteProcessRequest) ProtoMessage() {} +func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{5} } + type InfoRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } func (m *InfoRequest) Reset() { *m = InfoRequest{} } func (*InfoRequest) ProtoMessage() {} -func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{5} } +func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} } type InfoResponse struct { Task *containerd_v1_types2.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"` @@ -147,14 +157,14 @@ type InfoResponse struct { func (m *InfoResponse) Reset() { *m = InfoResponse{} } func (*InfoResponse) ProtoMessage() {} -func (*InfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} } +func (*InfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} } type ListRequest struct { } func (m *ListRequest) Reset() { *m = ListRequest{} } func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} } +func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } type ListResponse struct { Tasks []*containerd_v1_types2.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` @@ -162,7 +172,7 @@ type ListResponse struct { func (m *ListResponse) Reset() { *m = ListResponse{} } func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } +func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } type KillRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -175,7 +185,7 @@ type KillRequest struct { func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{10} } type isKillRequest_PidOrAll interface { isKillRequest_PidOrAll() @@ -287,7 +297,7 @@ type EventsRequest struct { func (m *EventsRequest) Reset() { *m = EventsRequest{} } func (*EventsRequest) ProtoMessage() {} -func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{10} } +func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } type ExecRequest struct { // ContainerID specifies the container in which to exec the process. @@ -304,7 +314,7 @@ type ExecRequest struct { func (m *ExecRequest) Reset() { *m = ExecRequest{} } func (*ExecRequest) ProtoMessage() {} -func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } +func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{12} } type ExecResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` @@ -312,7 +322,7 @@ type ExecResponse struct { func (m *ExecResponse) Reset() { *m = ExecResponse{} } func (*ExecResponse) ProtoMessage() {} -func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{12} } +func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } type PtyRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -323,7 +333,7 @@ type PtyRequest struct { func (m *PtyRequest) Reset() { *m = PtyRequest{} } func (*PtyRequest) ProtoMessage() {} -func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } +func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{14} } type CloseStdinRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -332,7 +342,7 @@ type CloseStdinRequest struct { func (m *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } func (*CloseStdinRequest) ProtoMessage() {} -func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{14} } +func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{15} } type PauseRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -340,7 +350,7 @@ type PauseRequest struct { func (m *PauseRequest) Reset() { *m = PauseRequest{} } func (*PauseRequest) ProtoMessage() {} -func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{15} } +func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{16} } type ResumeRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -348,7 +358,7 @@ type ResumeRequest struct { func (m *ResumeRequest) Reset() { *m = ResumeRequest{} } func (*ResumeRequest) ProtoMessage() {} -func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{16} } +func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{17} } type ProcessesRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -356,7 +366,7 @@ type ProcessesRequest struct { func (m *ProcessesRequest) Reset() { *m = ProcessesRequest{} } func (*ProcessesRequest) ProtoMessage() {} -func (*ProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{17} } +func (*ProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } type ProcessesResponse struct { Processes []*containerd_v1_types2.Process `protobuf:"bytes,1,rep,name=processes" json:"processes,omitempty"` @@ -364,7 +374,7 @@ type ProcessesResponse struct { func (m *ProcessesResponse) Reset() { *m = ProcessesResponse{} } func (*ProcessesResponse) ProtoMessage() {} -func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } +func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{19} } type CheckpointRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -379,7 +389,7 @@ type CheckpointRequest struct { func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } func (*CheckpointRequest) ProtoMessage() {} -func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{19} } +func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{20} } type CheckpointResponse struct { Descriptors []*containerd_v1_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` @@ -387,7 +397,7 @@ type CheckpointResponse struct { func (m *CheckpointResponse) Reset() { *m = CheckpointResponse{} } func (*CheckpointResponse) ProtoMessage() {} -func (*CheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{20} } +func (*CheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{21} } func init() { proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.execution.CreateRequest") @@ -395,6 +405,7 @@ func init() { proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.execution.StartRequest") proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.execution.DeleteRequest") proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.execution.DeleteResponse") + proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.v1.services.execution.DeleteProcessRequest") proto.RegisterType((*InfoRequest)(nil), "containerd.v1.services.execution.InfoRequest") proto.RegisterType((*InfoResponse)(nil), "containerd.v1.services.execution.InfoResponse") proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.execution.ListRequest") @@ -427,6 +438,7 @@ type TasksClient interface { Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) @@ -475,6 +487,15 @@ func (c *tasksClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grp return out, nil } +func (c *tasksClient) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + out := new(DeleteResponse) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/DeleteProcess", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *tasksClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) { out := new(InfoResponse) err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Info", in, out, c.cc, opts...) @@ -603,6 +624,7 @@ type TasksServer interface { Create(context.Context, *CreateRequest) (*CreateResponse, error) Start(context.Context, *StartRequest) (*google_protobuf.Empty, error) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) Info(context.Context, *InfoRequest) (*InfoResponse, error) List(context.Context, *ListRequest) (*ListResponse, error) Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) @@ -674,6 +696,24 @@ func _Tasks_Delete_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Tasks_DeleteProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteProcessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TasksServer).DeleteProcess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.services.execution.Tasks/DeleteProcess", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TasksServer).DeleteProcess(ctx, req.(*DeleteProcessRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Tasks_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(InfoRequest) if err := dec(in); err != nil { @@ -891,6 +931,10 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{ MethodName: "Delete", Handler: _Tasks_Delete_Handler, }, + { + MethodName: "DeleteProcess", + Handler: _Tasks_DeleteProcess_Handler, + }, { MethodName: "Info", Handler: _Tasks_Info_Handler, @@ -1130,6 +1174,35 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *DeleteProcessRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if m.Pid != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + } + return i, nil +} + func (m *InfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1793,6 +1866,19 @@ func (m *DeleteResponse) Size() (n int) { return n } +func (m *DeleteProcessRequest) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovExecution(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovExecution(uint64(m.Pid)) + } + return n +} + func (m *InfoRequest) Size() (n int) { var l int _ = l @@ -2096,6 +2182,17 @@ func (this *DeleteResponse) String() string { }, "") return s } +func (this *DeleteProcessRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteProcessRequest{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `}`, + }, "") + return s +} func (this *InfoRequest) String() string { if this == nil { return "nil" @@ -2934,6 +3031,104 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteProcessRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteProcessRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipExecution(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthExecution + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *InfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4684,81 +4879,83 @@ func init() { } var fileDescriptorExecution = []byte{ - // 1209 bytes of a gzipped FileDescriptorProto + // 1242 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xdb, 0xc6, - 0x13, 0x37, 0xad, 0x8f, 0xbf, 0x34, 0x94, 0x12, 0x7b, 0x11, 0x04, 0x8a, 0xf2, 0xaf, 0x24, 0x10, - 0x28, 0xa0, 0x16, 0x09, 0x95, 0xca, 0x3d, 0x05, 0x2d, 0x02, 0xcb, 0x76, 0x5a, 0x23, 0x49, 0xed, - 0xd2, 0x6e, 0x83, 0x9c, 0x04, 0x9a, 0x5c, 0xcb, 0x0b, 0x51, 0x5c, 0x96, 0xbb, 0xf2, 0xc7, 0x2d, - 0x6f, 0xd0, 0x9e, 0xfb, 0x04, 0x7d, 0x14, 0xa3, 0x40, 0x81, 0x1e, 0x8b, 0x1e, 0xdc, 0xc6, 0x4f, - 0xd1, 0x63, 0xb1, 0xcb, 0x25, 0x45, 0x29, 0x56, 0x45, 0x57, 0xbd, 0x48, 0xbb, 0xc3, 0x99, 0xdf, - 0xce, 0xc7, 0xce, 0xfc, 0x16, 0xbe, 0x18, 0x10, 0x7e, 0x32, 0x3e, 0x32, 0x1d, 0x3a, 0xea, 0x38, - 0xd4, 0xe7, 0x36, 0xf1, 0x71, 0xe8, 0xa6, 0x97, 0x76, 0x40, 0x3a, 0x0c, 0x87, 0xa7, 0xc4, 0xc1, - 0xac, 0x83, 0xcf, 0xb1, 0x33, 0xe6, 0x84, 0xfa, 0x93, 0x95, 0x19, 0x84, 0x94, 0x53, 0xd4, 0x9a, - 0x98, 0x98, 0xa7, 0x9f, 0x98, 0xb1, 0x85, 0x99, 0xe8, 0xd5, 0x1f, 0x0e, 0x28, 0x1d, 0x78, 0xb8, - 0x23, 0xf5, 0x8f, 0xc6, 0xc7, 0x1d, 0x3c, 0x0a, 0xf8, 0x45, 0x64, 0x5e, 0x7f, 0x30, 0xfb, 0xd1, - 0xf6, 0xe3, 0x4f, 0xf7, 0x06, 0x74, 0x40, 0xe5, 0xb2, 0x23, 0x56, 0x4a, 0xfa, 0x59, 0x26, 0xc7, - 0xf9, 0x45, 0x80, 0x59, 0x67, 0x44, 0xc7, 0x3e, 0x8f, 0x7e, 0x95, 0xf5, 0xf3, 0x5b, 0x58, 0xbb, - 0x98, 0x39, 0x21, 0x09, 0x38, 0x0d, 0x53, 0x4b, 0x85, 0xf3, 0xf4, 0x16, 0x38, 0xdc, 0x66, 0x43, - 0xf9, 0xa3, 0x6c, 0x9b, 0xb3, 0x21, 0x73, 0x32, 0xc2, 0x8c, 0xdb, 0xa3, 0x20, 0x52, 0x30, 0x7e, - 0x5c, 0x85, 0xea, 0x56, 0x88, 0x6d, 0x8e, 0x2d, 0xfc, 0xdd, 0x18, 0x33, 0x8e, 0xba, 0x50, 0x49, - 0xa0, 0xfb, 0xc4, 0xad, 0xad, 0xb6, 0xb4, 0x76, 0xb9, 0x77, 0xf7, 0xfa, 0xaa, 0xa9, 0x6f, 0xc5, - 0xf2, 0xdd, 0x6d, 0x4b, 0x4f, 0x94, 0x76, 0x5d, 0xd4, 0x85, 0x62, 0x48, 0x29, 0x3f, 0x66, 0xb5, - 0x5c, 0x2b, 0xd7, 0xd6, 0xbb, 0x75, 0x73, 0xba, 0x52, 0xd2, 0x39, 0xf3, 0x95, 0x48, 0x8e, 0xa5, - 0x34, 0xd1, 0x3d, 0x28, 0x30, 0xee, 0x12, 0xbf, 0x56, 0x10, 0x07, 0x58, 0xd1, 0x06, 0xdd, 0x87, - 0x22, 0xe3, 0x2e, 0x1d, 0xf3, 0x5a, 0x51, 0x8a, 0xd5, 0x4e, 0xc9, 0x71, 0x18, 0xd6, 0xfe, 0x97, - 0xc8, 0x71, 0x18, 0xa2, 0x3a, 0x94, 0x38, 0x0e, 0x47, 0xc4, 0xb7, 0xbd, 0x5a, 0xa9, 0xa5, 0xb5, - 0x4b, 0x56, 0xb2, 0x47, 0xcf, 0x00, 0x9c, 0x13, 0xec, 0x0c, 0x03, 0x4a, 0x7c, 0x5e, 0x2b, 0xb7, - 0xb4, 0xb6, 0xde, 0x6d, 0xde, 0xe8, 0xd9, 0x76, 0x92, 0x73, 0x2b, 0x65, 0x62, 0x7c, 0x0b, 0x77, - 0xe2, 0xdc, 0xb0, 0x80, 0xfa, 0x0c, 0xff, 0xab, 0xe4, 0xac, 0x41, 0x2e, 0x20, 0x6e, 0x2d, 0xd7, - 0xd2, 0xda, 0x55, 0x4b, 0x2c, 0x8d, 0x1e, 0x54, 0x0e, 0xb8, 0x1d, 0xf2, 0x79, 0x29, 0xd7, 0x16, - 0xa3, 0x1a, 0x5b, 0x50, 0xdd, 0xc6, 0x1e, 0x9e, 0x5f, 0xb7, 0x2c, 0x20, 0x3f, 0x69, 0x70, 0x27, - 0x46, 0x99, 0x13, 0x61, 0x06, 0x18, 0xd4, 0x04, 0x1d, 0x9f, 0x13, 0xde, 0x67, 0xdc, 0xe6, 0x63, - 0x26, 0x93, 0x52, 0xb5, 0x40, 0x88, 0x0e, 0xa4, 0x04, 0x6d, 0x42, 0x59, 0xec, 0xb0, 0xdb, 0xb7, - 0xb9, 0x4c, 0x84, 0xb8, 0x22, 0xd1, 0xd5, 0x34, 0xe3, 0xab, 0x69, 0x1e, 0xc6, 0x57, 0xb3, 0x57, - 0xba, 0xbc, 0x6a, 0xae, 0xfc, 0xf0, 0x47, 0x53, 0xb3, 0x4a, 0x91, 0xd9, 0x26, 0x37, 0x36, 0x41, - 0xdf, 0xf5, 0x8f, 0xe9, 0x32, 0xd1, 0x7e, 0x0e, 0x95, 0x08, 0x42, 0x85, 0xfa, 0x18, 0xf2, 0xa2, - 0x55, 0xa4, 0xad, 0xde, 0x7d, 0x70, 0xe3, 0xcd, 0x38, 0xb4, 0xd9, 0xd0, 0x92, 0x6a, 0x46, 0x15, - 0xf4, 0x97, 0x84, 0xc5, 0x45, 0x33, 0x9e, 0x41, 0x25, 0xda, 0x2a, 0xb4, 0x0e, 0x14, 0x84, 0x1a, - 0xab, 0x69, 0xb2, 0x05, 0xfe, 0x01, 0x2e, 0xd2, 0x33, 0xbe, 0xd7, 0x40, 0x7f, 0x41, 0x3c, 0x6f, - 0x89, 0x90, 0x64, 0x5b, 0x90, 0x81, 0xb8, 0xfc, 0x51, 0xd2, 0xd5, 0x0e, 0x21, 0xc8, 0xd9, 0x9e, - 0x27, 0x53, 0x5d, 0xfa, 0x72, 0xc5, 0x12, 0x1b, 0x21, 0x13, 0xf7, 0x30, 0x2f, 0x14, 0x85, 0x2c, - 0x20, 0x6e, 0xaf, 0x02, 0x10, 0x10, 0xb7, 0x4f, 0xc3, 0xbe, 0xed, 0x79, 0xc6, 0x5d, 0xa8, 0xee, - 0x9c, 0x62, 0x9f, 0xb3, 0x38, 0xc6, 0x5f, 0x34, 0xd0, 0x77, 0xce, 0xb1, 0xb3, 0x8c, 0x8b, 0xe9, - 0x0e, 0x5d, 0x9d, 0xe9, 0xd0, 0x64, 0x06, 0xe4, 0x6e, 0x9e, 0x01, 0xf9, 0x39, 0x33, 0xa0, 0x30, - 0x35, 0x03, 0xda, 0x90, 0x67, 0x01, 0x76, 0xe4, 0xc4, 0xd0, 0xbb, 0xf7, 0xde, 0xbb, 0x58, 0x9b, - 0xfe, 0x85, 0x25, 0x35, 0x8c, 0x16, 0x54, 0xa2, 0x70, 0x54, 0xcd, 0x54, 0x6b, 0x6a, 0x93, 0xd6, - 0x7c, 0xab, 0x01, 0xec, 0xf3, 0x8b, 0x65, 0x02, 0x56, 0xa0, 0xab, 0x09, 0xa8, 0x08, 0xf3, 0x8c, - 0xb8, 0xfc, 0x44, 0xcd, 0x80, 0x68, 0x23, 0xc2, 0x39, 0xc1, 0x64, 0x70, 0x12, 0x85, 0x59, 0xb5, - 0xd4, 0xce, 0x78, 0x03, 0xeb, 0x5b, 0x1e, 0x65, 0xf8, 0x40, 0x24, 0xe3, 0x3f, 0x75, 0x44, 0x0c, - 0x9e, 0x7d, 0x7b, 0xcc, 0xf0, 0x92, 0x83, 0xc7, 0xc2, 0x6c, 0x3c, 0x5a, 0x0a, 0xe4, 0x39, 0xac, - 0xed, 0x87, 0xd4, 0xc1, 0x8c, 0x61, 0xb6, 0x0c, 0xce, 0x1e, 0xac, 0xa7, 0x70, 0x54, 0x55, 0x9f, - 0x42, 0x39, 0x88, 0x85, 0xaa, 0x1b, 0xff, 0x7f, 0x63, 0x37, 0x2a, 0x53, 0x6b, 0xa2, 0x6e, 0xfc, - 0xb5, 0x0a, 0xeb, 0x5b, 0x09, 0x03, 0x2c, 0x93, 0xfd, 0x87, 0x50, 0xb6, 0x3d, 0x8f, 0x9e, 0xf5, - 0xb9, 0x13, 0xc4, 0x17, 0x5f, 0x0a, 0x0e, 0x9d, 0x00, 0x3d, 0x02, 0x14, 0x7d, 0x1c, 0xfb, 0xe4, - 0xbc, 0xcf, 0xa8, 0x33, 0xc4, 0x9c, 0x45, 0xed, 0x6a, 0xad, 0xc9, 0x2f, 0xdf, 0xf8, 0xe4, 0xfc, - 0x20, 0x92, 0xa3, 0x0f, 0xe1, 0x8e, 0x82, 0x8a, 0x1b, 0x29, 0x2f, 0x35, 0xab, 0x11, 0x5e, 0xdc, - 0x4d, 0x1f, 0x00, 0x1c, 0x13, 0x0f, 0xf7, 0x3d, 0xea, 0x0c, 0x99, 0xec, 0x91, 0x92, 0x55, 0x16, - 0x92, 0x97, 0x42, 0x80, 0x3e, 0x82, 0x35, 0xf9, 0x1a, 0xea, 0xfb, 0xf6, 0x08, 0xb3, 0xc0, 0x76, - 0x30, 0xab, 0x15, 0x5b, 0xb9, 0x76, 0xd9, 0xba, 0x2b, 0xe5, 0x5f, 0x25, 0x62, 0xd4, 0x87, 0xf5, - 0xc0, 0x0e, 0xb1, 0xcf, 0xfb, 0x29, 0x02, 0x95, 0xc4, 0xdb, 0xeb, 0x8a, 0xd9, 0xfc, 0xfb, 0x55, - 0xf3, 0xe3, 0xd4, 0xab, 0x84, 0x06, 0xd8, 0x4f, 0x42, 0x67, 0x9d, 0x01, 0x7d, 0xec, 0x92, 0x01, - 0x66, 0xdc, 0xdc, 0x96, 0x7f, 0xd6, 0x5a, 0x04, 0x36, 0xc9, 0x2b, 0x42, 0x90, 0x17, 0x93, 0x5d, - 0x51, 0xb6, 0x5c, 0x1b, 0xaf, 0x01, 0xa5, 0x33, 0xaf, 0x8a, 0xb9, 0x09, 0xfa, 0xe4, 0x45, 0x14, - 0x97, 0x73, 0x21, 0x8b, 0xa7, 0x6d, 0xba, 0x3f, 0x03, 0x14, 0xc4, 0xe0, 0x65, 0x68, 0x08, 0xc5, - 0x88, 0xd0, 0x51, 0xc7, 0x5c, 0xf4, 0x96, 0x34, 0xa7, 0x9e, 0x45, 0xf5, 0x27, 0xd9, 0x0d, 0x94, - 0xe7, 0x7b, 0x50, 0x90, 0x2c, 0x8f, 0xcc, 0xc5, 0xa6, 0xe9, 0xe7, 0x40, 0xfd, 0xfe, 0x7b, 0x13, - 0x6c, 0x47, 0xd4, 0x47, 0x78, 0x1f, 0x91, 0x75, 0x16, 0xef, 0xa7, 0x1e, 0x07, 0x59, 0xbc, 0x9f, - 0x79, 0x07, 0x60, 0xc8, 0x0b, 0xb2, 0x44, 0x8f, 0x17, 0x5b, 0xa6, 0x78, 0xb9, 0x6e, 0x66, 0x55, - 0x9f, 0x1c, 0x23, 0x58, 0x34, 0xcb, 0x31, 0x29, 0xf2, 0xcd, 0x72, 0xcc, 0x14, 0x39, 0xbf, 0x82, - 0xbc, 0xa0, 0xda, 0x2c, 0xc7, 0xa4, 0x28, 0x79, 0x6e, 0x25, 0x5e, 0x43, 0x31, 0x22, 0xca, 0x2c, - 0x95, 0x98, 0xa2, 0xd4, 0xfa, 0xcd, 0x4f, 0x63, 0xa9, 0xf3, 0x44, 0x13, 0xe9, 0x10, 0x04, 0x95, - 0xc5, 0xcf, 0x14, 0x2f, 0x67, 0x49, 0xc7, 0x14, 0xef, 0xbd, 0x80, 0xdc, 0x3e, 0xbf, 0x40, 0x8f, - 0x16, 0x9b, 0x4d, 0xb8, 0x70, 0x6e, 0x32, 0xde, 0x00, 0x4c, 0xf8, 0x0a, 0x6d, 0x64, 0xe8, 0x93, - 0x59, 0x76, 0x9b, 0x0b, 0xbd, 0x07, 0x05, 0xc9, 0x57, 0x59, 0x5a, 0x28, 0x4d, 0x6c, 0x73, 0x01, - 0xbf, 0x86, 0x62, 0x44, 0x5e, 0x59, 0x0a, 0x37, 0x45, 0x73, 0x73, 0x21, 0x39, 0x94, 0x13, 0x0a, - 0x42, 0xdd, 0x0c, 0x7e, 0xce, 0xf0, 0x5e, 0x7d, 0xe3, 0x56, 0x36, 0xaa, 0x82, 0x67, 0x00, 0xa9, - 0x71, 0x9a, 0x25, 0xe9, 0xb3, 0xa4, 0x56, 0xff, 0xf4, 0x76, 0x46, 0xd1, 0xc1, 0xbd, 0xda, 0xe5, - 0xbb, 0xc6, 0xca, 0x6f, 0xef, 0x1a, 0x2b, 0x6f, 0xaf, 0x1b, 0xda, 0xe5, 0x75, 0x43, 0xfb, 0xf5, - 0xba, 0xa1, 0xfd, 0x79, 0xdd, 0xd0, 0x8e, 0x8a, 0x32, 0x31, 0x1b, 0x7f, 0x07, 0x00, 0x00, 0xff, - 0xff, 0x7f, 0x76, 0x43, 0x00, 0xef, 0x0f, 0x00, 0x00, + 0x13, 0x37, 0xad, 0x8f, 0xbf, 0x34, 0x94, 0x12, 0x7b, 0x61, 0x04, 0x8a, 0xf2, 0xaf, 0x24, 0x10, + 0x28, 0xa0, 0x16, 0x09, 0x95, 0x2a, 0x45, 0x0f, 0x41, 0x8b, 0xc0, 0xb2, 0x9d, 0xd6, 0x48, 0x52, + 0xbb, 0xb4, 0xdb, 0x20, 0x40, 0x01, 0x81, 0x26, 0xd7, 0xf2, 0x42, 0x14, 0x97, 0xe5, 0xae, 0x6c, + 0xeb, 0x96, 0x37, 0x68, 0xcf, 0x7d, 0x82, 0xbe, 0x48, 0x01, 0x5f, 0x0a, 0xf4, 0x58, 0xf4, 0xe0, + 0x36, 0x7e, 0x8a, 0x1e, 0x8b, 0xdd, 0x25, 0x25, 0x4a, 0xb1, 0x2a, 0x3a, 0xca, 0x45, 0xda, 0x1d, + 0xce, 0xcc, 0xee, 0xfe, 0xe6, 0xe3, 0x37, 0xf0, 0x65, 0x8f, 0xf0, 0x93, 0xe1, 0x91, 0xe9, 0xd0, + 0x41, 0xcb, 0xa1, 0x3e, 0xb7, 0x89, 0x8f, 0x43, 0x37, 0xb9, 0xb4, 0x03, 0xd2, 0x62, 0x38, 0x3c, + 0x25, 0x0e, 0x66, 0x2d, 0x7c, 0x8e, 0x9d, 0x21, 0x27, 0xd4, 0x9f, 0xac, 0xcc, 0x20, 0xa4, 0x9c, + 0xa2, 0xc6, 0xc4, 0xc4, 0x3c, 0xfd, 0xc4, 0x8c, 0x2d, 0xcc, 0xb1, 0x5e, 0xf5, 0x5e, 0x8f, 0xd2, + 0x9e, 0x87, 0x5b, 0x52, 0xff, 0x68, 0x78, 0xdc, 0xc2, 0x83, 0x80, 0x8f, 0x94, 0x79, 0xf5, 0xee, + 0xec, 0x47, 0xdb, 0x8f, 0x3f, 0x6d, 0xf4, 0x68, 0x8f, 0xca, 0x65, 0x4b, 0xac, 0x22, 0xe9, 0xe7, + 0xa9, 0x2e, 0xce, 0x47, 0x01, 0x66, 0xad, 0x01, 0x1d, 0xfa, 0x5c, 0xfd, 0x46, 0xd6, 0x4f, 0x6f, + 0x60, 0xed, 0x62, 0xe6, 0x84, 0x24, 0xe0, 0x34, 0x4c, 0x2c, 0x23, 0x3f, 0x8f, 0x6f, 0xe0, 0x87, + 0xdb, 0xac, 0x2f, 0x7f, 0x22, 0xdb, 0xfa, 0xec, 0x93, 0x39, 0x19, 0x60, 0xc6, 0xed, 0x41, 0xa0, + 0x14, 0x8c, 0x9f, 0x57, 0xa1, 0xbc, 0x15, 0x62, 0x9b, 0x63, 0x0b, 0xff, 0x30, 0xc4, 0x8c, 0xa3, + 0x36, 0x94, 0xc6, 0xae, 0xbb, 0xc4, 0xad, 0xac, 0x36, 0xb4, 0x66, 0xb1, 0x73, 0xfb, 0xea, 0xb2, + 0xae, 0x6f, 0xc5, 0xf2, 0xdd, 0x6d, 0x4b, 0x1f, 0x2b, 0xed, 0xba, 0xa8, 0x0d, 0xf9, 0x90, 0x52, + 0x7e, 0xcc, 0x2a, 0x99, 0x46, 0xa6, 0xa9, 0xb7, 0xab, 0xe6, 0x74, 0xa4, 0xe4, 0xe5, 0xcc, 0x17, + 0x02, 0x1c, 0x2b, 0xd2, 0x44, 0x1b, 0x90, 0x63, 0xdc, 0x25, 0x7e, 0x25, 0x27, 0x0e, 0xb0, 0xd4, + 0x06, 0xdd, 0x81, 0x3c, 0xe3, 0x2e, 0x1d, 0xf2, 0x4a, 0x5e, 0x8a, 0xa3, 0x5d, 0x24, 0xc7, 0x61, + 0x58, 0xf9, 0xdf, 0x58, 0x8e, 0xc3, 0x10, 0x55, 0xa1, 0xc0, 0x71, 0x38, 0x20, 0xbe, 0xed, 0x55, + 0x0a, 0x0d, 0xad, 0x59, 0xb0, 0xc6, 0x7b, 0xf4, 0x04, 0xc0, 0x39, 0xc1, 0x4e, 0x3f, 0xa0, 0xc4, + 0xe7, 0x95, 0x62, 0x43, 0x6b, 0xea, 0xed, 0xfa, 0xb5, 0x37, 0xdb, 0x1e, 0x63, 0x6e, 0x25, 0x4c, + 0x8c, 0xef, 0xe0, 0x56, 0x8c, 0x0d, 0x0b, 0xa8, 0xcf, 0xf0, 0x3b, 0x81, 0xb3, 0x06, 0x99, 0x80, + 0xb8, 0x95, 0x4c, 0x43, 0x6b, 0x96, 0x2d, 0xb1, 0x34, 0x3a, 0x50, 0x3a, 0xe0, 0x76, 0xc8, 0xe7, + 0x41, 0xae, 0x2d, 0xf6, 0x6a, 0x6c, 0x41, 0x79, 0x1b, 0x7b, 0x78, 0x7e, 0xdc, 0xd2, 0x38, 0xf9, + 0x45, 0x83, 0x5b, 0xb1, 0x97, 0x39, 0x2f, 0x4c, 0xe1, 0x06, 0xd5, 0x41, 0xc7, 0xe7, 0x84, 0x77, + 0x19, 0xb7, 0xf9, 0x90, 0x49, 0x50, 0xca, 0x16, 0x08, 0xd1, 0x81, 0x94, 0xa0, 0x4d, 0x28, 0x8a, + 0x1d, 0x76, 0xbb, 0x36, 0x97, 0x40, 0x88, 0x14, 0x51, 0xa9, 0x69, 0xc6, 0xa9, 0x69, 0x1e, 0xc6, + 0xa9, 0xd9, 0x29, 0x5c, 0x5c, 0xd6, 0x57, 0x7e, 0xfa, 0xab, 0xae, 0x59, 0x05, 0x65, 0xb6, 0xc9, + 0x8d, 0xef, 0x61, 0x43, 0xdd, 0x74, 0x3f, 0xa4, 0x0e, 0x66, 0x6c, 0x89, 0x67, 0xc7, 0x11, 0x59, + 0x9d, 0x44, 0x64, 0x13, 0xf4, 0x5d, 0xff, 0x98, 0x2e, 0x83, 0xe5, 0x17, 0x50, 0x52, 0x2e, 0x22, + 0x20, 0x1f, 0x40, 0x56, 0x14, 0xa2, 0xb4, 0xd5, 0xdb, 0x77, 0xaf, 0xcd, 0xbb, 0x43, 0x9b, 0xf5, + 0x2d, 0xa9, 0x66, 0x94, 0x41, 0x7f, 0x4e, 0x58, 0x9c, 0x12, 0xc6, 0x13, 0x28, 0xa9, 0x6d, 0xe4, + 0xad, 0x05, 0x39, 0xa1, 0xc6, 0x2a, 0x9a, 0x2c, 0xb0, 0xff, 0x70, 0xa7, 0xf4, 0x8c, 0x1f, 0x35, + 0xd0, 0x9f, 0x11, 0xcf, 0x5b, 0x06, 0x27, 0x51, 0x74, 0xa4, 0x27, 0x4a, 0x4b, 0x41, 0x15, 0xed, + 0x10, 0x82, 0x8c, 0xed, 0x79, 0x32, 0x90, 0x85, 0xaf, 0x56, 0x2c, 0xb1, 0x11, 0x32, 0x81, 0x69, + 0x56, 0x28, 0x0a, 0x59, 0x40, 0xdc, 0x4e, 0x09, 0x20, 0x20, 0x6e, 0x97, 0x86, 0x5d, 0xdb, 0xf3, + 0x8c, 0xdb, 0x50, 0xde, 0x39, 0xc5, 0x3e, 0x8f, 0x43, 0x67, 0xfc, 0xa6, 0x81, 0xbe, 0x73, 0x8e, + 0x9d, 0x65, 0xae, 0x98, 0xac, 0xff, 0xd5, 0x99, 0xfa, 0x1f, 0x77, 0x98, 0xcc, 0xf5, 0x1d, 0x26, + 0x3b, 0xa7, 0xc3, 0xe4, 0xa6, 0x3a, 0x4c, 0x13, 0xb2, 0x2c, 0xc0, 0x8e, 0xec, 0x47, 0x7a, 0x7b, + 0xe3, 0xad, 0xb4, 0xdd, 0xf4, 0x47, 0x96, 0xd4, 0x30, 0x1a, 0x50, 0x52, 0xcf, 0x89, 0x62, 0x16, + 0xa5, 0x99, 0x36, 0x49, 0xb3, 0xd7, 0x1a, 0xc0, 0x3e, 0x1f, 0xbd, 0xd7, 0xdc, 0x15, 0xcf, 0x3c, + 0x23, 0x2e, 0x3f, 0x89, 0x3a, 0x8c, 0xda, 0x88, 0xe7, 0x9c, 0x60, 0xd2, 0x3b, 0x51, 0xcf, 0x2c, + 0x5b, 0xd1, 0xce, 0x78, 0x05, 0xeb, 0x5b, 0x1e, 0x65, 0xf8, 0x40, 0x80, 0xf1, 0x7e, 0x8b, 0xa8, + 0x03, 0xa5, 0x7d, 0x7b, 0xc8, 0xf0, 0x92, 0x6d, 0xcd, 0xc2, 0x6c, 0x38, 0x58, 0xca, 0xc9, 0x53, + 0x58, 0x8b, 0xba, 0x04, 0x5e, 0xa6, 0x4f, 0x18, 0x7b, 0xb0, 0x9e, 0xf0, 0x13, 0x45, 0xf5, 0x31, + 0x14, 0x83, 0x58, 0x18, 0x55, 0xe3, 0xff, 0xaf, 0xad, 0xc6, 0xb8, 0x51, 0x4d, 0xd4, 0x8d, 0x7f, + 0x56, 0x61, 0x7d, 0x6b, 0xcc, 0x2f, 0xcb, 0xa0, 0x7f, 0x0f, 0x8a, 0xb6, 0xe7, 0xd1, 0xb3, 0x2e, + 0x77, 0x82, 0x38, 0xf1, 0xa5, 0xe0, 0xd0, 0x09, 0xd0, 0x7d, 0x40, 0xea, 0xe3, 0xd0, 0x27, 0xe7, + 0x5d, 0x46, 0x9d, 0x3e, 0xe6, 0x4c, 0x95, 0xab, 0xb5, 0x26, 0xbf, 0x7c, 0xeb, 0x93, 0xf3, 0x03, + 0x25, 0x47, 0x1f, 0xc2, 0xad, 0xc8, 0x55, 0x5c, 0x48, 0x59, 0xa9, 0x59, 0x56, 0xfe, 0xe2, 0x6a, + 0xfa, 0x00, 0xe0, 0x98, 0x78, 0xb8, 0xeb, 0x51, 0xa7, 0xcf, 0x64, 0x8d, 0x14, 0xac, 0xa2, 0x90, + 0x3c, 0x17, 0x02, 0xf4, 0x11, 0xac, 0xc9, 0x59, 0xab, 0xeb, 0xdb, 0x03, 0xcc, 0x02, 0xdb, 0xc1, + 0xac, 0x92, 0x6f, 0x64, 0x9a, 0x45, 0xeb, 0xb6, 0x94, 0x7f, 0x3d, 0x16, 0xa3, 0x2e, 0xac, 0x07, + 0x76, 0x88, 0x7d, 0xde, 0x4d, 0xd0, 0xb3, 0xa4, 0xf5, 0x4e, 0x5b, 0x74, 0xfe, 0x3f, 0x2f, 0xeb, + 0x1f, 0x27, 0x66, 0x1e, 0x1a, 0x60, 0x7f, 0xfc, 0x74, 0xd6, 0xea, 0xd1, 0x07, 0x2e, 0xe9, 0x61, + 0xc6, 0xcd, 0x6d, 0xf9, 0x67, 0xad, 0x29, 0x67, 0x13, 0x5c, 0x11, 0x82, 0xac, 0xe0, 0x8d, 0x68, + 0x20, 0x90, 0x6b, 0xe3, 0x25, 0xa0, 0x24, 0xf2, 0x51, 0x30, 0x37, 0x41, 0x9f, 0xcc, 0x5b, 0x71, + 0x38, 0x17, 0xce, 0x08, 0x49, 0x9b, 0xf6, 0xaf, 0x3a, 0xe4, 0x44, 0xe3, 0x65, 0xa8, 0x0f, 0x79, + 0x35, 0x2e, 0xa0, 0x96, 0xb9, 0x68, 0x52, 0x35, 0xa7, 0x86, 0xae, 0xea, 0xc3, 0xf4, 0x06, 0xd1, + 0xcd, 0xf7, 0x20, 0x27, 0x67, 0x08, 0x64, 0x2e, 0x36, 0x4d, 0x0e, 0x1b, 0xd5, 0x3b, 0x6f, 0x75, + 0xb0, 0x1d, 0x11, 0x1f, 0x71, 0x7b, 0x45, 0xb0, 0x69, 0x6e, 0x3f, 0x35, 0x7a, 0xa4, 0xb9, 0xfd, + 0xcc, 0x94, 0x31, 0x8a, 0xa7, 0x97, 0xa8, 0x48, 0xd0, 0x67, 0x69, 0x5d, 0x4c, 0xd3, 0xff, 0x3b, + 0x1c, 0x8d, 0x21, 0x2b, 0x78, 0x1a, 0x3d, 0x58, 0x6c, 0x99, 0x18, 0x09, 0xaa, 0x66, 0x5a, 0xf5, + 0xc9, 0x31, 0x82, 0xc0, 0xd3, 0x1c, 0x93, 0xe0, 0xfd, 0x34, 0xc7, 0x4c, 0xcd, 0x05, 0x2f, 0x20, + 0x2b, 0x58, 0x3e, 0xcd, 0x31, 0x89, 0x69, 0x60, 0x6e, 0x12, 0xbc, 0x84, 0xbc, 0xe2, 0xe8, 0x34, + 0x49, 0x30, 0xc5, 0xe6, 0xd5, 0xeb, 0x67, 0x7e, 0xa9, 0xf3, 0x50, 0x13, 0x70, 0x08, 0x6e, 0x4c, + 0x73, 0xcf, 0xc4, 0x48, 0x90, 0x06, 0x8e, 0x29, 0xca, 0x7d, 0x06, 0x99, 0x7d, 0x3e, 0x42, 0xf7, + 0x17, 0x9b, 0x4d, 0x68, 0x78, 0x2e, 0x18, 0xaf, 0x00, 0x26, 0x54, 0x89, 0x1e, 0xa5, 0x28, 0xd1, + 0x59, 0x62, 0x9d, 0xeb, 0x7a, 0x0f, 0x72, 0x92, 0x2a, 0xd3, 0x54, 0x6f, 0x92, 0x53, 0xe7, 0x3a, + 0xfc, 0x06, 0xf2, 0x8a, 0x37, 0xd3, 0x04, 0x6e, 0x8a, 0x61, 0xe7, 0xba, 0xe4, 0x50, 0x1c, 0xb3, + 0x1f, 0x6a, 0xa7, 0xb8, 0xe7, 0x0c, 0xe5, 0x56, 0x1f, 0xdd, 0xc8, 0x26, 0x8a, 0xe0, 0x19, 0x40, + 0xa2, 0x93, 0xa7, 0x01, 0x7d, 0x96, 0x4f, 0xab, 0x9f, 0xde, 0xcc, 0x48, 0x1d, 0xdc, 0xa9, 0x5c, + 0xbc, 0xa9, 0xad, 0xfc, 0xf1, 0xa6, 0xb6, 0xf2, 0xfa, 0xaa, 0xa6, 0x5d, 0x5c, 0xd5, 0xb4, 0xdf, + 0xaf, 0x6a, 0xda, 0xdf, 0x57, 0x35, 0xed, 0x28, 0x2f, 0x81, 0x79, 0xf4, 0x6f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x46, 0xa7, 0x8c, 0x94, 0xc8, 0x10, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/execution/execution.proto b/vendor/github.com/containerd/containerd/api/services/execution/execution.proto index 4aa3f3d6cc..0b2d9210df 100644 --- a/vendor/github.com/containerd/containerd/api/services/execution/execution.proto +++ b/vendor/github.com/containerd/containerd/api/services/execution/execution.proto @@ -14,6 +14,7 @@ service Tasks { rpc Create(CreateRequest) returns (CreateResponse); rpc Start(StartRequest) returns (google.protobuf.Empty); rpc Delete(DeleteRequest) returns (DeleteResponse); + rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse); rpc Info(InfoRequest) returns (InfoResponse); rpc List(ListRequest) returns (ListResponse); rpc Kill(KillRequest) returns (google.protobuf.Empty); @@ -81,6 +82,11 @@ message DeleteResponse { google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } +message DeleteProcessRequest { + string container_id = 1; + uint32 pid = 2; +} + message InfoRequest { string container_id = 1; } diff --git a/vendor/github.com/containerd/containerd/api/types/task/task.pb.go b/vendor/github.com/containerd/containerd/api/types/task/task.pb.go index cb8775ef42..be43ffd575 100644 --- a/vendor/github.com/containerd/containerd/api/types/task/task.pb.go +++ b/vendor/github.com/containerd/containerd/api/types/task/task.pb.go @@ -113,6 +113,10 @@ type Task struct { Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"` + Stdin string `protobuf:"bytes,6,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,7,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,8,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,9,opt,name=terminal,proto3" json:"terminal,omitempty"` } func (m *Task) Reset() { *m = Task{} } @@ -129,6 +133,9 @@ type Process struct { ExitStatus uint32 `protobuf:"varint,7,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` RuntimeData *google_protobuf1.Any `protobuf:"bytes,9,opt,name=runtime_data,json=runtimeData" json:"runtime_data,omitempty"` + Stdin string `protobuf:"bytes,10,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,11,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,12,opt,name=stderr,proto3" json:"stderr,omitempty"` } func (m *Process) Reset() { *m = Process{} } @@ -212,6 +219,34 @@ func (m *Task) MarshalTo(dAtA []byte) (int, error) { } i += n1 } + if len(m.Stdin) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin))) + i += copy(dAtA[i:], m.Stdin) + } + if len(m.Stdout) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout))) + i += copy(dAtA[i:], m.Stdout) + } + if len(m.Stderr) > 0 { + dAtA[i] = 0x42 + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr))) + i += copy(dAtA[i:], m.Stderr) + } + if m.Terminal { + dAtA[i] = 0x48 + i++ + if m.Terminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } return i, nil } @@ -311,6 +346,24 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { } i += n3 } + if len(m.Stdin) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stdin))) + i += copy(dAtA[i:], m.Stdin) + } + if len(m.Stdout) > 0 { + dAtA[i] = 0x5a + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stdout))) + i += copy(dAtA[i:], m.Stdout) + } + if len(m.Stderr) > 0 { + dAtA[i] = 0x62 + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.Stderr))) + i += copy(dAtA[i:], m.Stderr) + } return i, nil } @@ -454,6 +507,21 @@ func (m *Task) Size() (n int) { l = m.Spec.Size() n += 1 + l + sovTask(uint64(l)) } + l = len(m.Stdin) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + l = len(m.Stdout) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + l = len(m.Stderr) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + if m.Terminal { + n += 2 + } return n } @@ -496,6 +564,18 @@ func (m *Process) Size() (n int) { l = m.RuntimeData.Size() n += 1 + l + sovTask(uint64(l)) } + l = len(m.Stdin) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + l = len(m.Stdout) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + l = len(m.Stderr) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } return n } @@ -562,6 +642,10 @@ func (this *Task) String() string { `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, + `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, + `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, + `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, + `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `}`, }, "") return s @@ -580,6 +664,9 @@ func (this *Process) String() string { `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`, `RuntimeData:` + strings.Replace(fmt.Sprintf("%v", this.RuntimeData), "Any", "google_protobuf1.Any", 1) + `,`, + `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, + `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, + `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `}`, }, "") return s @@ -776,6 +863,113 @@ func (m *Task) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stderr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTask(dAtA[iNdEx:]) @@ -1056,6 +1250,93 @@ func (m *Process) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stderr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTask(dAtA[iNdEx:]) @@ -1503,50 +1784,54 @@ func init() { } var fileDescriptorTask = []byte{ - // 718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbf, 0x6f, 0xf3, 0x44, - 0x18, 0xce, 0x39, 0xce, 0xaf, 0x4b, 0x93, 0xcf, 0x1c, 0x9f, 0x90, 0xbf, 0x80, 0x1c, 0x2b, 0x42, - 0x22, 0x42, 0xc2, 0x11, 0xe9, 0x00, 0x62, 0x4b, 0x63, 0xab, 0x8a, 0x10, 0x49, 0xb8, 0x38, 0xa2, - 0x5b, 0x74, 0xcd, 0x1d, 0xe6, 0xd4, 0xc6, 0xb6, 0xec, 0x73, 0x4b, 0x36, 0x46, 0xd4, 0x89, 0x7f, - 0xa0, 0x0b, 0xb0, 0xb2, 0x32, 0xb0, 0xb2, 0x74, 0x64, 0x64, 0x2a, 0x34, 0x7f, 0x09, 0xf2, 0xd9, - 0xf9, 0xa1, 0x36, 0x20, 0x16, 0xeb, 0xbd, 0xf7, 0x79, 0xee, 0xbd, 0xe7, 0x79, 0xee, 0x0c, 0x3f, - 0xf3, 0xb8, 0xf8, 0x26, 0xb9, 0xb4, 0x96, 0xc1, 0xaa, 0xb7, 0x0c, 0x7c, 0x41, 0xb8, 0xcf, 0x22, - 0x7a, 0x58, 0x92, 0x90, 0xf7, 0xc4, 0x3a, 0x64, 0x71, 0x4f, 0x90, 0xf8, 0x4a, 0x7e, 0xac, 0x30, - 0x0a, 0x44, 0x80, 0xde, 0xde, 0xb3, 0xac, 0x9b, 0x8f, 0x2d, 0x49, 0x6a, 0xbd, 0xf6, 0x02, 0x2f, - 0x90, 0x78, 0x2f, 0xad, 0x32, 0x6a, 0xeb, 0x8d, 0x17, 0x04, 0xde, 0x35, 0xeb, 0xc9, 0xd5, 0x65, - 0xf2, 0x75, 0x8f, 0xf8, 0xeb, 0x1c, 0x6a, 0x3f, 0x87, 0x04, 0x5f, 0xb1, 0x58, 0x90, 0x55, 0x98, - 0x11, 0x3a, 0xbf, 0x03, 0xa8, 0xba, 0x24, 0xbe, 0x42, 0xef, 0x40, 0x85, 0x53, 0x1d, 0x98, 0xa0, - 0x5b, 0x3b, 0x2b, 0x6f, 0x1e, 0xdb, 0xca, 0xc8, 0xc6, 0x0a, 0xa7, 0xa8, 0x0f, 0x4f, 0x76, 0x4a, - 0x16, 0x9c, 0xea, 0x8a, 0x64, 0xbc, 0xda, 0x3c, 0xb6, 0xeb, 0xc3, 0x6d, 0x7f, 0x64, 0xe3, 0xfa, - 0x8e, 0x34, 0xa2, 0x48, 0x83, 0xc5, 0x90, 0x53, 0xbd, 0x68, 0x82, 0x6e, 0x03, 0xa7, 0x25, 0x3a, - 0x85, 0xe5, 0x58, 0x10, 0x91, 0xc4, 0xba, 0x6a, 0x82, 0x6e, 0xb3, 0xff, 0xae, 0x75, 0xc4, 0x9e, - 0x35, 0x93, 0x14, 0x9c, 0x53, 0x51, 0x17, 0xaa, 0x71, 0xc8, 0x96, 0x7a, 0xc9, 0x04, 0xdd, 0x7a, - 0xff, 0xb5, 0x95, 0x79, 0xb1, 0xb6, 0x5e, 0xac, 0x81, 0xbf, 0xc6, 0x92, 0xd1, 0xf9, 0x45, 0x81, - 0x95, 0x69, 0x14, 0x2c, 0x59, 0x1c, 0x6f, 0x0f, 0x07, 0xfb, 0xc3, 0x11, 0x54, 0x49, 0xe4, 0xc5, - 0xba, 0x62, 0x16, 0xbb, 0x35, 0x2c, 0xeb, 0x94, 0xc5, 0xfc, 0x1b, 0xbd, 0x28, 0x5b, 0x69, 0x89, - 0x3e, 0x82, 0x6a, 0x12, 0xb3, 0x48, 0x0a, 0xac, 0xf7, 0xdf, 0x1c, 0x15, 0x38, 0x8f, 0x59, 0x84, - 0x25, 0x2d, 0x1d, 0xb0, 0xbc, 0xa5, 0x52, 0x5b, 0x0d, 0xa7, 0x25, 0x6a, 0xc1, 0xaa, 0x60, 0xd1, - 0x8a, 0xfb, 0xe4, 0x5a, 0x2f, 0x9b, 0xa0, 0x5b, 0xc5, 0xbb, 0x35, 0x6a, 0xc3, 0x3a, 0xfb, 0x96, - 0x8b, 0x45, 0x1e, 0x42, 0x45, 0x8a, 0x83, 0x69, 0x2b, 0xf3, 0x7c, 0x10, 0x50, 0xf5, 0xff, 0x07, - 0xf4, 0x09, 0x3c, 0x89, 0x12, 0x3f, 0xbd, 0xd2, 0x05, 0x25, 0x82, 0xe8, 0xb5, 0xff, 0x08, 0xaa, - 0x9e, 0x33, 0x6d, 0x22, 0x48, 0x67, 0x06, 0xd5, 0x79, 0x6e, 0x22, 0xd9, 0x67, 0x95, 0x70, 0x79, - 0x75, 0x5e, 0x7e, 0xcb, 0x0d, 0x9c, 0x96, 0xe8, 0x03, 0xf8, 0x8a, 0x50, 0xca, 0x05, 0x0f, 0x7c, - 0x72, 0xbd, 0xf0, 0x38, 0x8d, 0x65, 0x6a, 0x0d, 0xdc, 0xdc, 0xb7, 0xcf, 0x39, 0x8d, 0x3b, 0x3f, - 0x2a, 0xb0, 0xe4, 0xdc, 0x30, 0x5f, 0xfc, 0xeb, 0x5b, 0xfa, 0x14, 0xaa, 0xa9, 0x0f, 0x39, 0xbd, - 0xd9, 0x7f, 0xff, 0xa8, 0x45, 0x39, 0x21, 0xfb, 0xba, 0xeb, 0x90, 0x61, 0xb9, 0xe3, 0xc8, 0x8b, - 0x7a, 0x96, 0xa8, 0xfa, 0x22, 0xd1, 0x01, 0xac, 0xa5, 0x2b, 0x46, 0x17, 0x44, 0xe4, 0x4f, 0xa8, - 0xf5, 0x22, 0x19, 0x77, 0xfb, 0x3b, 0x9c, 0x55, 0x1f, 0x1e, 0xdb, 0x85, 0x1f, 0xfe, 0x6a, 0x03, - 0x5c, 0xcd, 0xb6, 0x0d, 0x44, 0xe7, 0x4b, 0x58, 0xdb, 0x09, 0x41, 0x55, 0xa8, 0x3a, 0x17, 0x23, - 0x57, 0x2b, 0xa0, 0x0a, 0x2c, 0x4e, 0x26, 0x5f, 0x68, 0x00, 0x41, 0x58, 0x1e, 0x62, 0x67, 0xe0, - 0x3a, 0x9a, 0x82, 0x6a, 0xb0, 0x34, 0x73, 0x07, 0xd8, 0xd5, 0x8a, 0xa8, 0x09, 0xa1, 0x73, 0xe1, - 0x0c, 0x17, 0x03, 0xdb, 0x76, 0x6c, 0x4d, 0x4d, 0x69, 0xd3, 0xc1, 0x7c, 0xe6, 0xd8, 0x5a, 0xe9, - 0xc3, 0x5f, 0x01, 0x2c, 0xe7, 0x02, 0x0d, 0x58, 0x99, 0x8f, 0x3f, 0x1f, 0x4f, 0xbe, 0x1a, 0x6b, - 0x85, 0xd6, 0x5b, 0x77, 0xf7, 0x66, 0x23, 0x03, 0xe6, 0xfe, 0x95, 0x1f, 0xdc, 0xfa, 0x29, 0x9e, - 0x4d, 0xb7, 0x35, 0x70, 0x88, 0x0f, 0x23, 0x46, 0x04, 0xa3, 0x29, 0x8e, 0xe7, 0xe3, 0xf1, 0x68, - 0x7c, 0xae, 0x29, 0x87, 0x38, 0x4e, 0x7c, 0x9f, 0xfb, 0x5e, 0x8a, 0xcf, 0xdc, 0xc9, 0x74, 0xea, - 0xd8, 0x5a, 0xf1, 0x10, 0x9f, 0x89, 0x20, 0x0c, 0x19, 0x45, 0xef, 0xed, 0x64, 0xa9, 0x2d, 0xed, - 0xee, 0xde, 0x3c, 0xc9, 0xe0, 0x29, 0x49, 0x62, 0x46, 0x5b, 0xcd, 0xef, 0x7f, 0x32, 0x0a, 0xbf, - 0xfd, 0x6c, 0xe4, 0x6a, 0xcf, 0xf4, 0x87, 0x27, 0xa3, 0xf0, 0xe7, 0x93, 0x51, 0xf8, 0x6e, 0x63, - 0x80, 0x87, 0x8d, 0x01, 0xfe, 0xd8, 0x18, 0xe0, 0xef, 0x8d, 0x01, 0x2e, 0xcb, 0x32, 0xcd, 0xd3, - 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x51, 0xea, 0x99, 0x62, 0xee, 0x04, 0x00, 0x00, + // 775 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0x8e, 0x1d, 0xe7, 0x6b, 0xd2, 0x66, 0xcd, 0x50, 0xad, 0xbc, 0x01, 0x39, 0x56, 0x84, 0x44, + 0x84, 0x84, 0x23, 0xb2, 0x07, 0x10, 0xb7, 0xb4, 0xb6, 0x56, 0x11, 0x22, 0x0d, 0x13, 0x47, 0xec, + 0x2d, 0x9a, 0x66, 0x06, 0x33, 0x6a, 0x3b, 0xb6, 0x3c, 0xe3, 0x2e, 0xbd, 0x71, 0x44, 0x7b, 0xe2, + 0x0f, 0xec, 0x85, 0x8f, 0xbf, 0xc0, 0x81, 0x5f, 0xd0, 0x23, 0x47, 0x4e, 0x85, 0xcd, 0x5f, 0xe0, + 0x0f, 0xa0, 0x19, 0xbb, 0x49, 0x76, 0x9b, 0x4a, 0x7b, 0xb1, 0xde, 0x79, 0x9f, 0x67, 0x26, 0xcf, + 0xfb, 0x3c, 0x6f, 0xc0, 0x97, 0x31, 0x93, 0xdf, 0xe7, 0x67, 0xfe, 0x2a, 0xb9, 0x1c, 0xae, 0x12, + 0x2e, 0x31, 0xe3, 0x34, 0x23, 0xbb, 0x25, 0x4e, 0xd9, 0x50, 0x5e, 0xa7, 0x54, 0x0c, 0x25, 0x16, + 0xe7, 0xfa, 0xe3, 0xa7, 0x59, 0x22, 0x13, 0xf8, 0xfe, 0x96, 0xe5, 0x5f, 0x7d, 0xe6, 0x6b, 0x52, + 0xf7, 0x28, 0x4e, 0xe2, 0x44, 0xe3, 0x43, 0x55, 0x15, 0xd4, 0xee, 0x93, 0x38, 0x49, 0xe2, 0x0b, + 0x3a, 0xd4, 0xa7, 0xb3, 0xfc, 0xbb, 0x21, 0xe6, 0xd7, 0x25, 0xd4, 0x7b, 0x1b, 0x92, 0xec, 0x92, + 0x0a, 0x89, 0x2f, 0xd3, 0x82, 0xd0, 0xff, 0xdd, 0x04, 0x56, 0x84, 0xc5, 0x39, 0x7c, 0x0c, 0x4c, + 0x46, 0x1c, 0xc3, 0x33, 0x06, 0xad, 0xe3, 0xfa, 0xfa, 0xb6, 0x67, 0x4e, 0x02, 0x64, 0x32, 0x02, + 0x47, 0xe0, 0x60, 0xa3, 0x64, 0xc9, 0x88, 0x63, 0x6a, 0xc6, 0xa3, 0xf5, 0x6d, 0xaf, 0x7d, 0x72, + 0xd7, 0x9f, 0x04, 0xa8, 0xbd, 0x21, 0x4d, 0x08, 0xb4, 0x41, 0x35, 0x65, 0xc4, 0xa9, 0x7a, 0xc6, + 0xe0, 0x10, 0xa9, 0x12, 0x3e, 0x05, 0x75, 0x21, 0xb1, 0xcc, 0x85, 0x63, 0x79, 0xc6, 0xa0, 0x33, + 0xfa, 0xc0, 0xdf, 0x33, 0x9e, 0x3f, 0xd7, 0x14, 0x54, 0x52, 0xe1, 0x00, 0x58, 0x22, 0xa5, 0x2b, + 0xa7, 0xe6, 0x19, 0x83, 0xf6, 0xe8, 0xc8, 0x2f, 0x66, 0xf1, 0xef, 0x66, 0xf1, 0xc7, 0xfc, 0x1a, + 0x69, 0x06, 0x3c, 0x02, 0x35, 0x21, 0x09, 0xe3, 0x4e, 0x5d, 0xa9, 0x43, 0xc5, 0x01, 0x3e, 0x56, + 0x3f, 0x4a, 0x92, 0x5c, 0x3a, 0x0d, 0xdd, 0x2e, 0x4f, 0x65, 0x9f, 0x66, 0x99, 0xd3, 0xdc, 0xf4, + 0x69, 0x96, 0xc1, 0x2e, 0x68, 0x4a, 0x9a, 0x5d, 0x32, 0x8e, 0x2f, 0x9c, 0x96, 0x67, 0x0c, 0x9a, + 0x68, 0x73, 0xee, 0xff, 0x67, 0x82, 0xc6, 0x2c, 0x4b, 0x56, 0x54, 0x88, 0xbb, 0xf1, 0x8c, 0xed, + 0x78, 0x10, 0x58, 0x38, 0x8b, 0x85, 0x63, 0x7a, 0xd5, 0x41, 0x0b, 0xe9, 0x5a, 0xb1, 0x28, 0xbf, + 0x72, 0xaa, 0xba, 0xa5, 0x4a, 0xf8, 0x29, 0xb0, 0x72, 0x41, 0x33, 0x6d, 0x41, 0x7b, 0xf4, 0x64, + 0xaf, 0x05, 0x0b, 0x41, 0x33, 0xa4, 0x69, 0xea, 0x81, 0xd5, 0x0b, 0xa2, 0xa7, 0x6f, 0x21, 0x55, + 0xbe, 0x21, 0xb0, 0xfe, 0xa6, 0x40, 0xd8, 0x03, 0x6d, 0xfa, 0x03, 0x93, 0xcb, 0xd2, 0xe6, 0x86, + 0x16, 0x07, 0x54, 0xab, 0x70, 0x75, 0x27, 0x82, 0xe6, 0xbb, 0x47, 0xf0, 0x39, 0x38, 0xc8, 0x72, + 0xae, 0x96, 0x66, 0x49, 0xb0, 0xc4, 0xda, 0x96, 0x87, 0xa2, 0x68, 0x97, 0xcc, 0x00, 0x4b, 0xbc, + 0x4d, 0x04, 0xec, 0x4f, 0xa4, 0xfd, 0x40, 0x22, 0x07, 0xbb, 0x89, 0xf4, 0xe7, 0xc0, 0x5a, 0x94, + 0x56, 0xe4, 0x5b, 0xc7, 0x73, 0xa6, 0x57, 0x2c, 0x2e, 0xb7, 0xf1, 0x10, 0xa9, 0x12, 0x7e, 0x0c, + 0x1e, 0x61, 0x42, 0x98, 0x64, 0x09, 0xc7, 0x17, 0xcb, 0x98, 0x11, 0xa1, 0xbd, 0x3f, 0x44, 0x9d, + 0x6d, 0xfb, 0x19, 0x23, 0xa2, 0xff, 0x8b, 0x09, 0x6a, 0xe1, 0x15, 0xe5, 0xf2, 0xc1, 0x9d, 0xff, + 0x02, 0x58, 0xca, 0x0d, 0xfd, 0x7a, 0x67, 0xf4, 0xd1, 0x5e, 0xa3, 0xf4, 0x0b, 0xc5, 0x37, 0xba, + 0x4e, 0x29, 0xd2, 0x37, 0xf6, 0x6c, 0xfe, 0x5b, 0xb9, 0x58, 0xf7, 0x72, 0x19, 0x83, 0x96, 0x3a, + 0x51, 0xb2, 0xc4, 0xb2, 0x5c, 0xf5, 0xee, 0x3d, 0x7f, 0xa3, 0xbb, 0xbf, 0xed, 0x71, 0xf3, 0xe6, + 0xb6, 0x57, 0xf9, 0xf9, 0x9f, 0x9e, 0x81, 0x9a, 0xc5, 0xb5, 0xb1, 0xec, 0x7f, 0x03, 0x5a, 0x1b, + 0x21, 0xb0, 0x09, 0xac, 0xf0, 0xf9, 0x24, 0xb2, 0x2b, 0xb0, 0x01, 0xaa, 0xa7, 0xa7, 0x5f, 0xdb, + 0x06, 0x04, 0xa0, 0x7e, 0x82, 0xc2, 0x71, 0x14, 0xda, 0x26, 0x6c, 0x81, 0xda, 0x3c, 0x1a, 0xa3, + 0xc8, 0xae, 0xc2, 0x0e, 0x00, 0xe1, 0xf3, 0xf0, 0x64, 0x39, 0x0e, 0x82, 0x30, 0xb0, 0x2d, 0x45, + 0x9b, 0x8d, 0x17, 0xf3, 0x30, 0xb0, 0x6b, 0x9f, 0xfc, 0x61, 0x80, 0x7a, 0x29, 0xd0, 0x05, 0x8d, + 0xc5, 0xf4, 0xab, 0xe9, 0xe9, 0xb7, 0x53, 0xbb, 0xd2, 0x7d, 0xef, 0xe5, 0x2b, 0xef, 0xb0, 0x00, + 0x16, 0xfc, 0x9c, 0x27, 0x2f, 0xb8, 0xc2, 0x8b, 0xd7, 0x03, 0xdb, 0xd8, 0xc5, 0x4f, 0x32, 0x8a, + 0x25, 0x25, 0x0a, 0x47, 0x8b, 0xe9, 0x74, 0x32, 0x7d, 0x66, 0x9b, 0xbb, 0x38, 0xca, 0x39, 0x67, + 0x3c, 0x56, 0xf8, 0x3c, 0x3a, 0x9d, 0xcd, 0xc2, 0xc0, 0xae, 0xee, 0xe2, 0x73, 0x99, 0xa4, 0x29, + 0x25, 0xf0, 0xc3, 0x8d, 0x2c, 0xab, 0x6b, 0xbf, 0x7c, 0xe5, 0x1d, 0x14, 0xf0, 0x0c, 0xe7, 0x82, + 0x92, 0x6e, 0xe7, 0xa7, 0x5f, 0xdd, 0xca, 0x9f, 0xbf, 0xb9, 0xa5, 0xda, 0x63, 0xe7, 0xe6, 0xb5, + 0x5b, 0xf9, 0xfb, 0xb5, 0x5b, 0xf9, 0x71, 0xed, 0x1a, 0x37, 0x6b, 0xd7, 0xf8, 0x6b, 0xed, 0x1a, + 0xff, 0xae, 0x5d, 0xe3, 0xac, 0xae, 0xdd, 0x7c, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, + 0xcc, 0xfd, 0x9a, 0x96, 0x05, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/types/task/task.proto b/vendor/github.com/containerd/containerd/api/types/task/task.proto index cce329f8e8..e7563200e2 100644 --- a/vendor/github.com/containerd/containerd/api/types/task/task.proto +++ b/vendor/github.com/containerd/containerd/api/types/task/task.proto @@ -23,6 +23,10 @@ message Task { uint32 pid = 3; Status status = 4; google.protobuf.Any spec = 5; + string stdin = 6; + string stdout = 7; + string stderr = 8; + bool terminal = 9; } message Process { @@ -35,6 +39,9 @@ message Process { uint32 exit_status = 7; Status status = 8; google.protobuf.Any runtime_data = 9; + string stdin = 10; + string stdout = 11; + string stderr = 12; } message User { diff --git a/vendor/github.com/containerd/containerd/containers/containers.go b/vendor/github.com/containerd/containerd/containers/containers.go new file mode 100644 index 0000000000..7a899add4a --- /dev/null +++ b/vendor/github.com/containerd/containerd/containers/containers.go @@ -0,0 +1,29 @@ +package containers + +import ( + "context" + "time" +) + +// Container represents the set of data pinned by a container. Unless otherwise +// noted, the resources here are considered in use by the container. +// +// The resources specified in this object are used to create tasks from the container. +type Container struct { + ID string + Labels map[string]string + Image string + Runtime string + Spec []byte + RootFS string + CreatedAt time.Time + UpdatedAt time.Time +} + +type Store interface { + Get(ctx context.Context, id string) (Container, error) + List(ctx context.Context, filter string) ([]Container, error) + Create(ctx context.Context, container Container) (Container, error) + Update(ctx context.Context, container Container) (Container, error) + Delete(ctx context.Context, id string) error +} diff --git a/vendor/github.com/containerd/containerd/content/content.go b/vendor/github.com/containerd/containerd/content/content.go index 7c02ded53f..9ef6b22e83 100644 --- a/vendor/github.com/containerd/containerd/content/content.go +++ b/vendor/github.com/containerd/containerd/content/content.go @@ -21,6 +21,12 @@ var ( // Use IsExists(err) to detect this condition. ErrExists = errors.New("content: exists") + // ErrLocked is returned when content is actively being uploaded, this + // indicates that another process is attempting to upload the same content. + // + // Use IsLocked(err) to detect this condition. + ErrLocked = errors.New("content: locked") + bufPool = sync.Pool{ New: func() interface{} { return make([]byte, 1<<20) @@ -30,6 +36,7 @@ var ( type Provider interface { Reader(ctx context.Context, dgst digest.Digest) (io.ReadCloser, error) + ReaderAt(ctx context.Context, dgst digest.Digest) (io.ReaderAt, error) } type Ingester interface { @@ -107,3 +114,7 @@ func IsNotFound(err error) bool { func IsExists(err error) bool { return errors.Cause(err) == ErrExists } + +func IsLocked(err error) bool { + return errors.Cause(err) == ErrLocked +} diff --git a/vendor/github.com/containerd/containerd/content/helpers.go b/vendor/github.com/containerd/containerd/content/helpers.go index 859de7095f..3610c844f6 100644 --- a/vendor/github.com/containerd/containerd/content/helpers.go +++ b/vendor/github.com/containerd/containerd/content/helpers.go @@ -41,6 +41,17 @@ func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, size i } defer cw.Close() + return Copy(cw, r, size, expected) +} + +// Copy copies data with the expected digest from the reader into the +// provided content store writer. +// +// This is useful when the digest and size are known beforehand. When +// the size or digest is unknown, these values may be empty. +// +// Copy is buffered, so no need to wrap reader in buffered io. +func Copy(cw Writer, r io.Reader, size int64, expected digest.Digest) error { ws, err := cw.Status() if err != nil { return err @@ -50,7 +61,7 @@ func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, size i r, err = seekReader(r, ws.Offset, size) if err != nil { if !isUnseekable(err) { - return errors.Wrapf(err, "unabled to resume write to %v", ref) + return errors.Wrapf(err, "unabled to resume write to %v", ws.Ref) } // reader is unseekable, try to move the writer back to the start. @@ -69,7 +80,7 @@ func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, size i if err := cw.Commit(size, expected); err != nil { if !IsExists(err) { - return errors.Wrapf(err, "failed commit on ref %q", ref) + return errors.Wrapf(err, "failed commit on ref %q", ws.Ref) } } diff --git a/vendor/github.com/containerd/containerd/content/locks.go b/vendor/github.com/containerd/containerd/content/locks.go index 400793d4a7..44ed16d3d9 100644 --- a/vendor/github.com/containerd/containerd/content/locks.go +++ b/vendor/github.com/containerd/containerd/content/locks.go @@ -3,54 +3,35 @@ package content import ( "sync" - "github.com/nightlyone/lockfile" "github.com/pkg/errors" ) -// In addition to providing inter-process locks for content ingest, we also -// define a global in process lock to prevent two goroutines writing to the -// same file. -// -// This is pretty unsophisticated for now. In the future, we'd probably like to -// have more information about who is holding which locks, as well as better -// error reporting. +// Handles locking references +// TODO: use boltdb for lock status var ( - errLocked = errors.New("key is locked") - - // locks lets us lock in process, as well as output of process. - locks = map[lockfile.Lockfile]struct{}{} + // locks lets us lock in process + locks = map[string]struct{}{} locksMu sync.Mutex ) -func tryLock(lock lockfile.Lockfile) error { +func tryLock(ref string) error { locksMu.Lock() defer locksMu.Unlock() - if _, ok := locks[lock]; ok { - return errLocked + if _, ok := locks[ref]; ok { + return errors.Wrapf(ErrLocked, "key %s is locked", ref) } - if err := lock.TryLock(); err != nil { - if errors.Cause(err) == lockfile.ErrBusy { - return errLocked - } - - return errors.Wrapf(err, "lock.TryLock() encountered an error") - } - - locks[lock] = struct{}{} + locks[ref] = struct{}{} return nil } -func unlock(lock lockfile.Lockfile) error { +func unlock(ref string) { locksMu.Lock() defer locksMu.Unlock() - if _, ok := locks[lock]; !ok { - return nil + if _, ok := locks[ref]; ok { + delete(locks, ref) } - - delete(locks, lock) - return lock.Unlock() } diff --git a/vendor/github.com/containerd/containerd/content/readerat.go b/vendor/github.com/containerd/containerd/content/readerat.go new file mode 100644 index 0000000000..74c11bd1f1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/content/readerat.go @@ -0,0 +1,26 @@ +package content + +import ( + "io" + "os" +) + +// readerat implements io.ReaderAt in a completely stateless manner by opening +// the referenced file for each call to ReadAt. +type readerAt struct { + f string +} + +func (ra readerAt) ReadAt(p []byte, offset int64) (int, error) { + fp, err := os.Open(ra.f) + if err != nil { + return 0, err + } + defer fp.Close() + + if _, err := fp.Seek(offset, io.SeekStart); err != nil { + return 0, err + } + + return fp.Read(p) +} diff --git a/vendor/github.com/containerd/containerd/content/store.go b/vendor/github.com/containerd/containerd/content/store.go index f1d59caf33..2a45c1658c 100644 --- a/vendor/github.com/containerd/containerd/content/store.go +++ b/vendor/github.com/containerd/containerd/content/store.go @@ -12,7 +12,6 @@ import ( "time" "github.com/containerd/containerd/log" - "github.com/nightlyone/lockfile" digest "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) @@ -58,11 +57,7 @@ func (s *store) info(dgst digest.Digest, fi os.FileInfo) Info { } } -// Open returns an io.ReadCloser for the blob. -// -// TODO(stevvooe): This would work much better as an io.ReaderAt in practice. -// Right now, we are doing type assertion to tease that out, but it won't scale -// well. +// Reader returns an io.ReadCloser for the blob. func (s *store) Reader(ctx context.Context, dgst digest.Digest) (io.ReadCloser, error) { fp, err := os.Open(s.blobPath(dgst)) if err != nil { @@ -75,6 +70,11 @@ func (s *store) Reader(ctx context.Context, dgst digest.Digest) (io.ReadCloser, return fp, nil } +// ReaderAt returns an io.ReaderAt for the blob. +func (s *store) ReaderAt(ctx context.Context, dgst digest.Digest) (io.ReaderAt, error) { + return readerAt{f: s.blobPath(dgst)}, nil +} + // Delete removes a blob by its digest. // // While this is safe to do concurrently, safe exist-removal logic must hold @@ -227,20 +227,19 @@ func (s *store) total(ingestPath string) int64 { // // The argument `ref` is used to uniquely identify a long-lived writer transaction. func (s *store) Writer(ctx context.Context, ref string, total int64, expected digest.Digest) (Writer, error) { - // TODO(stevvooe): Need to actually store and handle expected here. We have + // TODO(stevvooe): Need to actually store expected here. We have // code in the service that shouldn't be dealing with this. - - path, refp, data, lock, err := s.ingestPaths(ref) - if err != nil { - return nil, err + if expected != "" { + p := s.blobPath(expected) + if _, err := os.Stat(p); err == nil { + return nil, ErrExists + } } - if err := tryLock(lock); err != nil { - if !os.IsNotExist(errors.Cause(err)) { - return nil, errors.Wrapf(err, "locking %v failed", ref) - } + path, refp, data := s.ingestPaths(ref) - // if it doesn't exist, we'll make it so below! + if err := tryLock(ref); err != nil { + return nil, errors.Wrapf(err, "locking %v failed", ref) } var ( @@ -314,7 +313,6 @@ func (s *store) Writer(ctx context.Context, ref string, total int64, expected di return &writer{ s: s, fp: fp, - lock: lock, ref: ref, path: path, offset: offset, @@ -349,25 +347,18 @@ func (s *store) ingestRoot(ref string) string { return filepath.Join(s.root, "ingest", dgst.Hex()) } -// ingestPaths are returned, including the lockfile. The paths are the following: +// ingestPaths are returned. The paths are the following: // // - root: entire ingest directory // - ref: name of the starting ref, must be unique // - data: file where data is written -// - lock: lock file location // -func (s *store) ingestPaths(ref string) (string, string, string, lockfile.Lockfile, error) { +func (s *store) ingestPaths(ref string) (string, string, string) { var ( fp = s.ingestRoot(ref) rp = filepath.Join(fp, "ref") - lp = filepath.Join(fp, "lock") dp = filepath.Join(fp, "data") ) - lock, err := lockfile.New(lp) - if err != nil { - return "", "", "", "", errors.Wrapf(err, "error creating lockfile %v", lp) - } - - return fp, rp, dp, lock, nil + return fp, rp, dp } diff --git a/vendor/github.com/containerd/containerd/content/writer.go b/vendor/github.com/containerd/containerd/content/writer.go index 2a6f506a7c..c506369600 100644 --- a/vendor/github.com/containerd/containerd/content/writer.go +++ b/vendor/github.com/containerd/containerd/content/writer.go @@ -5,8 +5,6 @@ import ( "path/filepath" "time" - "github.com/containerd/containerd/log" - "github.com/nightlyone/lockfile" "github.com/opencontainers/go-digest" "github.com/pkg/errors" ) @@ -15,9 +13,8 @@ import ( type writer struct { s *store fp *os.File // opened data file - lock lockfile.Lockfile - path string // path to writer dir - ref string // ref key + path string // path to writer dir + ref string // ref key offset int64 total int64 digester digest.Digester @@ -107,8 +104,9 @@ func (w *writer) Commit(size int64, expected digest.Digest) error { return err } - unlock(w.lock) + unlock(w.ref) w.fp = nil + return nil } @@ -122,9 +120,7 @@ func (w *writer) Commit(size int64, expected digest.Digest) error { // To abandon a transaction completely, first call close then `Store.Remove` to // clean up the associated resources. func (cw *writer) Close() (err error) { - if err := unlock(cw.lock); err != nil { - log.L.Debug("unlock failed: %v", err) - } + unlock(cw.ref) if cw.fp != nil { cw.fp.Sync() diff --git a/vendor/github.com/containerd/containerd/images/handlers.go b/vendor/github.com/containerd/containerd/images/handlers.go index e647520ed5..c878046335 100644 --- a/vendor/github.com/containerd/containerd/images/handlers.go +++ b/vendor/github.com/containerd/containerd/images/handlers.go @@ -6,14 +6,23 @@ import ( "fmt" "github.com/containerd/containerd/content" + "github.com/containerd/containerd/log" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) -var SkipDesc = fmt.Errorf("skip descriptor") +var ( + // SkipDesc is used to skip processing of a descriptor and + // its descendants. + SkipDesc = fmt.Errorf("skip descriptor") -var StopHandler = fmt.Errorf("stop handler") + // StopHandler is used to signify that the descriptor + // has been handled and should not be handled further. + // This applies only to a single descriptor in a handler + // chain and does not apply to descendant descriptors. + StopHandler = fmt.Errorf("stop handler") +) type Handler interface { Handle(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) @@ -120,31 +129,42 @@ func Dispatch(ctx context.Context, handler Handler, descs ...ocispec.Descriptor) // arbitrary types. func ChildrenHandler(provider content.Provider) HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + var descs []ocispec.Descriptor switch desc.MediaType { case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: - case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerGzip, - MediaTypeDockerSchema2Config: - return nil, nil - default: - return nil, fmt.Errorf("%v not yet supported", desc.MediaType) - } + p, err := content.ReadBlob(ctx, provider, desc.Digest) + if err != nil { + return nil, err + } - p, err := content.ReadBlob(ctx, provider, desc.Digest) - if err != nil { - return nil, err - } + // TODO(stevvooe): We just assume oci manifest, for now. There may be + // subtle differences from the docker version. + var manifest ocispec.Manifest + if err := json.Unmarshal(p, &manifest); err != nil { + return nil, err + } - // TODO(stevvooe): We just assume oci manifest, for now. There may be - // subtle differences from the docker version. - var manifest ocispec.Manifest - if err := json.Unmarshal(p, &manifest); err != nil { - return nil, err - } + descs = append(descs, manifest.Config) + descs = append(descs, manifest.Layers...) + case MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + p, err := content.ReadBlob(ctx, provider, desc.Digest) + if err != nil { + return nil, err + } - var descs []ocispec.Descriptor + var index ocispec.Index + if err := json.Unmarshal(p, &index); err != nil { + return nil, err + } - descs = append(descs, manifest.Config) - descs = append(descs, manifest.Layers...) + descs = append(descs, index.Manifests...) + case MediaTypeDockerSchema2Layer, MediaTypeDockerSchema2LayerGzip, + MediaTypeDockerSchema2Config, ocispec.MediaTypeImageLayer, + ocispec.MediaTypeImageLayerGzip: // childless data types. + return nil, nil + default: + log.G(ctx).Warnf("encounted unknown type %v; children may not be fetched", desc.MediaType) + } return descs, nil } diff --git a/vendor/github.com/containerd/containerd/images/image.go b/vendor/github.com/containerd/containerd/images/image.go index c1ff32cb2d..875e366e37 100644 --- a/vendor/github.com/containerd/containerd/images/image.go +++ b/vendor/github.com/containerd/containerd/images/image.go @@ -17,6 +17,13 @@ type Image struct { Target ocispec.Descriptor } +type Store interface { + Put(ctx context.Context, name string, desc ocispec.Descriptor) error + Get(ctx context.Context, name string) (Image, error) + List(ctx context.Context) ([]Image, error) + Delete(ctx context.Context, name string) error +} + // TODO(stevvooe): Many of these functions make strong platform assumptions, // which are untrue in a lot of cases. More refactoring must be done here to // make this work in all cases. @@ -26,34 +33,7 @@ type Image struct { // The caller can then use the descriptor to resolve and process the // configuration of the image. func (image *Image) Config(ctx context.Context, provider content.Provider) (ocispec.Descriptor, error) { - var configDesc ocispec.Descriptor - return configDesc, Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { - switch image.Target.MediaType { - case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: - rc, err := provider.Reader(ctx, image.Target.Digest) - if err != nil { - return nil, err - } - defer rc.Close() - - p, err := ioutil.ReadAll(rc) - if err != nil { - return nil, err - } - - var manifest ocispec.Manifest - if err := json.Unmarshal(p, &manifest); err != nil { - return nil, err - } - - configDesc = manifest.Config - - return nil, nil - default: - return nil, errors.New("could not resolve config") - } - - }), image.Target) + return Config(ctx, provider, image.Target) } // RootFS returns the unpacked diffids that make up and images rootfs. @@ -105,12 +85,43 @@ func (image *Image) Size(ctx context.Context, provider content.Provider) (int64, }), image.Target) } +func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor) (ocispec.Descriptor, error) { + var configDesc ocispec.Descriptor + return configDesc, Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch image.MediaType { + case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: + rc, err := provider.Reader(ctx, image.Digest) + if err != nil { + return nil, err + } + defer rc.Close() + + p, err := ioutil.ReadAll(rc) + if err != nil { + return nil, err + } + + var manifest ocispec.Manifest + if err := json.Unmarshal(p, &manifest); err != nil { + return nil, err + } + + configDesc = manifest.Config + + return nil, nil + default: + return nil, errors.New("could not resolve config") + } + + }), image) +} + // RootFS returns the unpacked diffids that make up and images rootfs. // // These are used to verify that a set of layers unpacked to the expected // values. -func RootFS(ctx context.Context, provider content.Provider, desc ocispec.Descriptor) ([]digest.Digest, error) { - p, err := content.ReadBlob(ctx, provider, desc.Digest) +func RootFS(ctx context.Context, provider content.Provider, configDesc ocispec.Descriptor) ([]digest.Digest, error) { + p, err := content.ReadBlob(ctx, provider, configDesc.Digest) if err != nil { return nil, err } diff --git a/vendor/github.com/containerd/containerd/images/mediatypes.go b/vendor/github.com/containerd/containerd/images/mediatypes.go index 7b75b8affa..676af4a3ee 100644 --- a/vendor/github.com/containerd/containerd/images/mediatypes.go +++ b/vendor/github.com/containerd/containerd/images/mediatypes.go @@ -16,4 +16,6 @@ const ( MediaTypeContainerd1Resource = "application/vnd.containerd.container.resource.tar" MediaTypeContainerd1RW = "application/vnd.containerd.container.rw.tar" MediaTypeContainerd1CheckpointConfig = "application/vnd.containerd.container.checkpoint.config.v1+json" + // Legacy Docker schema1 manifest + MediaTypeDockerSchema1Manifest = "application/vnd.docker.distribution.manifest.v1+prettyjws" ) diff --git a/vendor/github.com/containerd/containerd/images/storage.go b/vendor/github.com/containerd/containerd/images/storage.go deleted file mode 100644 index 66b4e115af..0000000000 --- a/vendor/github.com/containerd/containerd/images/storage.go +++ /dev/null @@ -1,219 +0,0 @@ -package images - -import ( - "context" - "encoding/binary" - "fmt" - - "github.com/boltdb/bolt" - "github.com/containerd/containerd/log" - digest "github.com/opencontainers/go-digest" - ocispec "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" -) - -var ( - ErrExists = errors.New("images: exists") - ErrNotFound = errors.New("images: not found") -) - -type Store interface { - Put(ctx context.Context, name string, desc ocispec.Descriptor) error - Get(ctx context.Context, name string) (Image, error) - List(ctx context.Context) ([]Image, error) - Delete(ctx context.Context, name string) error -} - -// IsNotFound returns true if the error is due to a missing image. -func IsNotFound(err error) bool { - return errors.Cause(err) == ErrNotFound -} - -func IsExists(err error) bool { - return errors.Cause(err) == ErrExists -} - -var ( - bucketKeyStorageVersion = []byte("v1") - bucketKeyImages = []byte("images") - bucketKeyDigest = []byte("digest") - bucketKeyMediaType = []byte("mediatype") - bucketKeySize = []byte("size") -) - -// TODO(stevvooe): This file comprises the data required to implement the -// "metadata" store. For now, it is bound tightly to the local machine and bolt -// but we can take this and use it to define a service interface. - -// InitDB will initialize the database for use. The database must be opened for -// write and the caller must not be holding an open transaction. -func InitDB(db *bolt.DB) error { - log.L.Debug("init db") - return db.Update(func(tx *bolt.Tx) error { - _, err := createBucketIfNotExists(tx, bucketKeyStorageVersion, bucketKeyImages) - return err - }) -} - -func NewStore(tx *bolt.Tx) Store { - return &storage{tx: tx} -} - -type storage struct { - tx *bolt.Tx -} - -func (s *storage) Get(ctx context.Context, name string) (Image, error) { - var image Image - if err := withImageBucket(s.tx, name, func(bkt *bolt.Bucket) error { - image.Name = name - return readImage(&image, bkt) - }); err != nil { - return Image{}, err - } - - return image, nil -} - -func (s *storage) Put(ctx context.Context, name string, desc ocispec.Descriptor) error { - return withImagesBucket(s.tx, func(bkt *bolt.Bucket) error { - ibkt, err := bkt.CreateBucketIfNotExists([]byte(name)) - if err != nil { - return err - } - - var ( - buf [binary.MaxVarintLen64]byte - sizeEncoded []byte = buf[:] - ) - sizeEncoded = sizeEncoded[:binary.PutVarint(sizeEncoded, desc.Size)] - - if len(sizeEncoded) == 0 { - return fmt.Errorf("failed encoding size = %v", desc.Size) - } - - for _, v := range [][2][]byte{ - {bucketKeyDigest, []byte(desc.Digest)}, - {bucketKeyMediaType, []byte(desc.MediaType)}, - {bucketKeySize, sizeEncoded}, - } { - if err := ibkt.Put(v[0], v[1]); err != nil { - return err - } - } - - return nil - }) -} - -func (s *storage) List(ctx context.Context) ([]Image, error) { - var images []Image - - if err := withImagesBucket(s.tx, func(bkt *bolt.Bucket) error { - return bkt.ForEach(func(k, v []byte) error { - var ( - image = Image{ - Name: string(k), - } - kbkt = bkt.Bucket(k) - ) - - if err := readImage(&image, kbkt); err != nil { - return err - } - - images = append(images, image) - return nil - }) - }); err != nil { - return nil, err - } - - return images, nil -} - -func (s *storage) Delete(ctx context.Context, name string) error { - return withImagesBucket(s.tx, func(bkt *bolt.Bucket) error { - err := bkt.DeleteBucket([]byte(name)) - if err == bolt.ErrBucketNotFound { - return ErrNotFound - } - return err - }) -} - -func readImage(image *Image, bkt *bolt.Bucket) error { - return bkt.ForEach(func(k, v []byte) error { - if v == nil { - return nil // skip it? a bkt maybe? - } - - // TODO(stevvooe): This is why we need to use byte values for - // keys, rather than full arrays. - switch string(k) { - case string(bucketKeyDigest): - image.Target.Digest = digest.Digest(v) - case string(bucketKeyMediaType): - image.Target.MediaType = string(v) - case string(bucketKeySize): - image.Target.Size, _ = binary.Varint(v) - } - - return nil - }) -} - -func createBucketIfNotExists(tx *bolt.Tx, keys ...[]byte) (*bolt.Bucket, error) { - bkt, err := tx.CreateBucketIfNotExists(keys[0]) - if err != nil { - return nil, err - } - - for _, key := range keys[1:] { - bkt, err = bkt.CreateBucketIfNotExists(key) - if err != nil { - return nil, err - } - } - - return bkt, nil -} - -func withImagesBucket(tx *bolt.Tx, fn func(bkt *bolt.Bucket) error) error { - bkt := getImagesBucket(tx) - if bkt == nil { - return ErrNotFound - } - - return fn(bkt) -} - -func withImageBucket(tx *bolt.Tx, name string, fn func(bkt *bolt.Bucket) error) error { - bkt := getImageBucket(tx, name) - if bkt == nil { - return ErrNotFound - } - - return fn(bkt) -} - -func getImagesBucket(tx *bolt.Tx) *bolt.Bucket { - return getBucket(tx, bucketKeyStorageVersion, bucketKeyImages) -} - -func getImageBucket(tx *bolt.Tx, name string) *bolt.Bucket { - return getBucket(tx, bucketKeyStorageVersion, bucketKeyImages, []byte(name)) -} - -func getBucket(tx *bolt.Tx, keys ...[]byte) *bolt.Bucket { - bkt := tx.Bucket(keys[0]) - - for _, key := range keys[1:] { - if bkt == nil { - break - } - bkt = bkt.Bucket(key) - } - - return bkt -} diff --git a/vendor/github.com/containerd/containerd/log/grpc.go b/vendor/github.com/containerd/containerd/log/grpc.go index c209f75417..cb2c92182f 100644 --- a/vendor/github.com/containerd/containerd/log/grpc.go +++ b/vendor/github.com/containerd/containerd/log/grpc.go @@ -1,14 +1,12 @@ package log import ( - "context" + "io/ioutil" + "log" "google.golang.org/grpc/grpclog" ) func init() { - ctx := WithModule(context.Background(), "grpc") - - // completely replace the grpc logger with the logrus logger. - grpclog.SetLogger(G(ctx)) + grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags)) } diff --git a/vendor/github.com/containerd/containerd/metadata/buckets.go b/vendor/github.com/containerd/containerd/metadata/buckets.go new file mode 100644 index 0000000000..ae0ae06427 --- /dev/null +++ b/vendor/github.com/containerd/containerd/metadata/buckets.go @@ -0,0 +1,125 @@ +package metadata + +import ( + "github.com/boltdb/bolt" +) + +// The layout where a "/" delineates a bucket is desribed in the following +// section. Please try to follow this as closely as possible when adding +// functionality. We can bolster this with helpers and more structure if that +// becomes an issue. +// +// Generically, we try to do the following: +// +// /// -> +// +// version: Currently, this is "v1". Additions can be made to v1 in a backwards +// compatible way. If the layout changes, a new version must be made, along +// with a migration. +// +// namespace: the namespace to which this object belongs. +// +// object: defines which object set is stored in the bucket. There are two +// special objects, "labels" and "indexes". The "labels" bucket stores the +// labels for the parent namespace. The "indexes" object is reserved for +// indexing objects, if we require in the future. +// +// key: object-specific key identifying the storage bucket for the objects +// contents. +var ( + bucketKeyVersion = []byte("v1") + bucketKeyObjectLabels = []byte("labels") // stores the labels for a namespace. + bucketKeyObjectIndexes = []byte("indexes") // reserved + bucketKeyObjectImages = []byte("images") // stores image objects + bucketKeyObjectContainers = []byte("containers") // stores container objects + + bucketKeyDigest = []byte("digest") + bucketKeyMediaType = []byte("mediatype") + bucketKeySize = []byte("size") + bucketKeyLabels = []byte("labels") + bucketKeyImage = []byte("image") + bucketKeyRuntime = []byte("runtime") + bucketKeySpec = []byte("spec") + bucketKeyRootFS = []byte("rootfs") + bucketKeyCreatedAt = []byte("createdat") + bucketKeyUpdatedAt = []byte("updatedat") +) + +func getBucket(tx *bolt.Tx, keys ...[]byte) *bolt.Bucket { + bkt := tx.Bucket(keys[0]) + + for _, key := range keys[1:] { + if bkt == nil { + break + } + bkt = bkt.Bucket(key) + } + + return bkt +} + +func createBucketIfNotExists(tx *bolt.Tx, keys ...[]byte) (*bolt.Bucket, error) { + bkt, err := tx.CreateBucketIfNotExists(keys[0]) + if err != nil { + return nil, err + } + + for _, key := range keys[1:] { + bkt, err = bkt.CreateBucketIfNotExists(key) + if err != nil { + return nil, err + } + } + + return bkt, nil +} + +func namespaceLabelsBucketPath(namespace string) [][]byte { + return [][]byte{bucketKeyVersion, []byte(namespace), bucketKeyObjectLabels} +} + +func withNamespacesLabelsBucket(tx *bolt.Tx, namespace string, fn func(bkt *bolt.Bucket) error) error { + bkt, err := createBucketIfNotExists(tx, namespaceLabelsBucketPath(namespace)...) + if err != nil { + return err + } + + return fn(bkt) +} + +func getNamespaceLabelsBucket(tx *bolt.Tx, namespace string) *bolt.Bucket { + return getBucket(tx, namespaceLabelsBucketPath(namespace)...) +} + +func imagesBucketPath(namespace string) [][]byte { + return [][]byte{bucketKeyVersion, []byte(namespace), bucketKeyObjectImages} +} + +func withImagesBucket(tx *bolt.Tx, namespace string, fn func(bkt *bolt.Bucket) error) error { + bkt, err := createBucketIfNotExists(tx, imagesBucketPath(namespace)...) + if err != nil { + return err + } + + return fn(bkt) +} + +func getImagesBucket(tx *bolt.Tx, namespace string) *bolt.Bucket { + return getBucket(tx, imagesBucketPath(namespace)...) +} + +func createContainersBucket(tx *bolt.Tx, namespace string) (*bolt.Bucket, error) { + bkt, err := createBucketIfNotExists(tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectContainers) + if err != nil { + return nil, err + } + return bkt, nil +} + +func getContainersBucket(tx *bolt.Tx, namespace string) *bolt.Bucket { + return getBucket(tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectContainers) +} + +func getContainerBucket(tx *bolt.Tx, namespace, id string) *bolt.Bucket { + return getBucket(tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectContainers, []byte(id)) +} diff --git a/vendor/github.com/containerd/containerd/metadata/containers.go b/vendor/github.com/containerd/containerd/metadata/containers.go new file mode 100644 index 0000000000..40e5927d15 --- /dev/null +++ b/vendor/github.com/containerd/containerd/metadata/containers.go @@ -0,0 +1,218 @@ +package metadata + +import ( + "context" + "time" + + "github.com/boltdb/bolt" + "github.com/containerd/containerd/containers" + "github.com/containerd/containerd/namespaces" + "github.com/pkg/errors" +) + +type containerStore struct { + tx *bolt.Tx +} + +func NewContainerStore(tx *bolt.Tx) containers.Store { + return &containerStore{ + tx: tx, + } +} + +func (s *containerStore) Get(ctx context.Context, id string) (containers.Container, error) { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return containers.Container{}, err + } + + bkt := getContainerBucket(s.tx, namespace, id) + if bkt == nil { + return containers.Container{}, errors.Wrap(ErrNotFound, "bucket does not exist") + } + + container := containers.Container{ID: id} + if err := readContainer(&container, bkt); err != nil { + return containers.Container{}, errors.Wrap(err, "failed to read container") + } + + return container, nil +} + +func (s *containerStore) List(ctx context.Context, filter string) ([]containers.Container, error) { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return nil, err + } + + var ( + m []containers.Container + bkt = getContainersBucket(s.tx, namespace) + ) + if bkt == nil { + return m, nil + } + if err := bkt.ForEach(func(k, v []byte) error { + cbkt := bkt.Bucket(k) + if cbkt == nil { + return nil + } + container := containers.Container{ID: string(k)} + + if err := readContainer(&container, cbkt); err != nil { + return errors.Wrap(err, "failed to read container") + } + m = append(m, container) + return nil + }); err != nil { + return nil, err + } + + return m, nil +} + +func (s *containerStore) Create(ctx context.Context, container containers.Container) (containers.Container, error) { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return containers.Container{}, err + } + + bkt, err := createContainersBucket(s.tx, namespace) + if err != nil { + return containers.Container{}, err + } + + cbkt, err := bkt.CreateBucket([]byte(container.ID)) + if err != nil { + if err == bolt.ErrBucketExists { + err = errors.Wrap(ErrExists, "content for id already exists") + } + return containers.Container{}, err + } + + container.CreatedAt = time.Now() + container.UpdatedAt = container.CreatedAt + if err := writeContainer(&container, cbkt); err != nil { + return containers.Container{}, errors.Wrap(err, "failed to write container") + } + + return container, nil +} + +func (s *containerStore) Update(ctx context.Context, container containers.Container) (containers.Container, error) { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return containers.Container{}, err + } + + bkt := getContainersBucket(s.tx, namespace) + if bkt == nil { + return containers.Container{}, errors.Wrap(ErrNotFound, "no containers") + } + + cbkt := bkt.Bucket([]byte(container.ID)) + if cbkt == nil { + return containers.Container{}, errors.Wrap(ErrNotFound, "no content for id") + } + + container.UpdatedAt = time.Now() + if err := writeContainer(&container, cbkt); err != nil { + return containers.Container{}, errors.Wrap(err, "failed to write container") + } + + return container, nil +} + +func (s *containerStore) Delete(ctx context.Context, id string) error { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + + bkt := getContainersBucket(s.tx, namespace) + if bkt == nil { + return errors.Wrap(ErrNotFound, "no containers") + } + + if err := bkt.DeleteBucket([]byte(id)); err == bolt.ErrBucketNotFound { + return errors.Wrap(ErrNotFound, "no content for id") + } + return err +} + +func readContainer(container *containers.Container, bkt *bolt.Bucket) error { + return bkt.ForEach(func(k, v []byte) error { + switch string(k) { + case string(bucketKeyImage): + container.Image = string(v) + case string(bucketKeyRuntime): + container.Runtime = string(v) + case string(bucketKeySpec): + container.Spec = make([]byte, len(v)) + copy(container.Spec, v) + case string(bucketKeyRootFS): + container.RootFS = string(v) + case string(bucketKeyCreatedAt): + if err := container.CreatedAt.UnmarshalBinary(v); err != nil { + return err + } + case string(bucketKeyUpdatedAt): + if err := container.UpdatedAt.UnmarshalBinary(v); err != nil { + return err + } + case string(bucketKeyLabels): + lbkt := bkt.Bucket(bucketKeyLabels) + if lbkt == nil { + return nil + } + container.Labels = map[string]string{} + if err := lbkt.ForEach(func(k, v []byte) error { + container.Labels[string(k)] = string(v) + return nil + }); err != nil { + return err + } + } + + return nil + }) +} + +func writeContainer(container *containers.Container, bkt *bolt.Bucket) error { + createdAt, err := container.CreatedAt.MarshalBinary() + if err != nil { + return err + } + updatedAt, err := container.UpdatedAt.MarshalBinary() + if err != nil { + return err + } + for _, v := range [][2][]byte{ + {bucketKeyImage, []byte(container.Image)}, + {bucketKeyRuntime, []byte(container.Runtime)}, + {bucketKeySpec, container.Spec}, + {bucketKeyRootFS, []byte(container.RootFS)}, + {bucketKeyCreatedAt, createdAt}, + {bucketKeyUpdatedAt, updatedAt}, + } { + if err := bkt.Put(v[0], v[1]); err != nil { + return err + } + } + // Remove existing labels to keep from merging + if lbkt := bkt.Bucket(bucketKeyLabels); lbkt != nil { + if err := bkt.DeleteBucket(bucketKeyLabels); err != nil { + return err + } + } + lbkt, err := bkt.CreateBucket(bucketKeyLabels) + if err != nil { + return err + } + for k, v := range container.Labels { + if err := lbkt.Put([]byte(k), []byte(v)); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/containerd/containerd/metadata/errors.go b/vendor/github.com/containerd/containerd/metadata/errors.go new file mode 100644 index 0000000000..4607ec48e2 --- /dev/null +++ b/vendor/github.com/containerd/containerd/metadata/errors.go @@ -0,0 +1,22 @@ +package metadata + +import "github.com/pkg/errors" + +var ( + ErrExists = errors.New("metadata: exists") + ErrNotFound = errors.New("metadata: not found") + ErrNotEmpty = errors.New("metadata: namespace not empty") +) + +// IsNotFound returns true if the error is due to a missing image. +func IsNotFound(err error) bool { + return errors.Cause(err) == ErrNotFound +} + +func IsExists(err error) bool { + return errors.Cause(err) == ErrExists +} + +func IsNotEmpty(err error) bool { + return errors.Cause(err) == ErrNotEmpty +} diff --git a/vendor/github.com/containerd/containerd/metadata/images.go b/vendor/github.com/containerd/containerd/metadata/images.go new file mode 100644 index 0000000000..43c7030198 --- /dev/null +++ b/vendor/github.com/containerd/containerd/metadata/images.go @@ -0,0 +1,152 @@ +package metadata + +import ( + "context" + "encoding/binary" + "fmt" + + "github.com/boltdb/bolt" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/namespaces" + digest "github.com/opencontainers/go-digest" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" +) + +type imageStore struct { + tx *bolt.Tx +} + +func NewImageStore(tx *bolt.Tx) images.Store { + return &imageStore{tx: tx} +} + +func (s *imageStore) Get(ctx context.Context, name string) (images.Image, error) { + var image images.Image + + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return images.Image{}, err + } + + bkt := getImagesBucket(s.tx, namespace) + if bkt == nil { + return images.Image{}, ErrNotFound + } + + ibkt := bkt.Bucket([]byte(name)) + if ibkt == nil { + return images.Image{}, ErrNotFound + } + + image.Name = name + if err := readImage(&image, ibkt); err != nil { + return images.Image{}, err + } + + return image, nil +} + +func (s *imageStore) Put(ctx context.Context, name string, desc ocispec.Descriptor) error { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + + return withImagesBucket(s.tx, namespace, func(bkt *bolt.Bucket) error { + ibkt, err := bkt.CreateBucketIfNotExists([]byte(name)) + if err != nil { + return err + } + + var ( + buf [binary.MaxVarintLen64]byte + sizeEncoded []byte = buf[:] + ) + sizeEncoded = sizeEncoded[:binary.PutVarint(sizeEncoded, desc.Size)] + + if len(sizeEncoded) == 0 { + return fmt.Errorf("failed encoding size = %v", desc.Size) + } + + for _, v := range [][2][]byte{ + {bucketKeyDigest, []byte(desc.Digest)}, + {bucketKeyMediaType, []byte(desc.MediaType)}, + {bucketKeySize, sizeEncoded}, + } { + if err := ibkt.Put(v[0], v[1]); err != nil { + return err + } + } + + return nil + }) +} + +func (s *imageStore) List(ctx context.Context) ([]images.Image, error) { + var m []images.Image + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return nil, err + } + + bkt := getImagesBucket(s.tx, namespace) + if bkt == nil { + return nil, nil // empty store + } + + if err := bkt.ForEach(func(k, v []byte) error { + var ( + image = images.Image{ + Name: string(k), + } + kbkt = bkt.Bucket(k) + ) + + if err := readImage(&image, kbkt); err != nil { + return err + } + + m = append(m, image) + return nil + }); err != nil { + return nil, err + } + + return m, nil +} + +func (s *imageStore) Delete(ctx context.Context, name string) error { + namespace, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + + return withImagesBucket(s.tx, namespace, func(bkt *bolt.Bucket) error { + err := bkt.DeleteBucket([]byte(name)) + if err == bolt.ErrBucketNotFound { + return ErrNotFound + } + return err + }) +} + +func readImage(image *images.Image, bkt *bolt.Bucket) error { + return bkt.ForEach(func(k, v []byte) error { + if v == nil { + return nil // skip it? a bkt maybe? + } + + // TODO(stevvooe): This is why we need to use byte values for + // keys, rather than full arrays. + switch string(k) { + case string(bucketKeyDigest): + image.Target.Digest = digest.Digest(v) + case string(bucketKeyMediaType): + image.Target.MediaType = string(v) + case string(bucketKeySize): + image.Target.Size, _ = binary.Varint(v) + } + + return nil + }) +} diff --git a/vendor/github.com/containerd/containerd/metadata/namespaces.go b/vendor/github.com/containerd/containerd/metadata/namespaces.go new file mode 100644 index 0000000000..ffe898f67f --- /dev/null +++ b/vendor/github.com/containerd/containerd/metadata/namespaces.go @@ -0,0 +1,145 @@ +package metadata + +import ( + "context" + + "github.com/boltdb/bolt" + "github.com/containerd/containerd/namespaces" +) + +type namespaceStore struct { + tx *bolt.Tx +} + +func NewNamespaceStore(tx *bolt.Tx) namespaces.Store { + return &namespaceStore{tx: tx} +} + +func (s *namespaceStore) Create(ctx context.Context, namespace string, labels map[string]string) error { + topbkt, err := createBucketIfNotExists(s.tx, bucketKeyVersion) + if err != nil { + return err + } + + // provides the already exists error. + bkt, err := topbkt.CreateBucket([]byte(namespace)) + if err != nil { + if err == bolt.ErrBucketExists { + return ErrExists + } + + return err + } + + lbkt, err := bkt.CreateBucketIfNotExists(bucketKeyObjectLabels) + if err != nil { + return err + } + + for k, v := range labels { + if err := lbkt.Put([]byte(k), []byte(v)); err != nil { + return err + } + } + + return nil +} + +func (s *namespaceStore) Labels(ctx context.Context, namespace string) (map[string]string, error) { + labels := map[string]string{} + + bkt := getNamespaceLabelsBucket(s.tx, namespace) + if bkt == nil { + return labels, nil + } + + if err := bkt.ForEach(func(k, v []byte) error { + labels[string(k)] = string(v) + return nil + }); err != nil { + return nil, err + } + + return labels, nil +} + +func (s *namespaceStore) SetLabel(ctx context.Context, namespace, key, value string) error { + return withNamespacesLabelsBucket(s.tx, namespace, func(bkt *bolt.Bucket) error { + if value == "" { + return bkt.Delete([]byte(key)) + } + + return bkt.Put([]byte(key), []byte(value)) + }) + +} + +func (s *namespaceStore) List(ctx context.Context) ([]string, error) { + bkt := getBucket(s.tx, bucketKeyVersion) + if bkt == nil { + return nil, nil // no namespaces! + } + + var namespaces []string + if err := bkt.ForEach(func(k, v []byte) error { + if v != nil { + return nil // not a bucket + } + + namespaces = append(namespaces, string(k)) + return nil + }); err != nil { + return nil, err + } + + return namespaces, nil +} + +func (s *namespaceStore) Delete(ctx context.Context, namespace string) error { + bkt := getBucket(s.tx, bucketKeyVersion) + if empty, err := s.namespaceEmpty(ctx, namespace); err != nil { + return err + } else if !empty { + return ErrNotEmpty + } + + if err := bkt.DeleteBucket([]byte(namespace)); err != nil { + if err == bolt.ErrBucketNotFound { + return ErrNotFound + } + + return err + } + + return nil +} + +func (s *namespaceStore) namespaceEmpty(ctx context.Context, namespace string) (bool, error) { + ctx = namespaces.WithNamespace(ctx, namespace) + + // need to check the various object stores. + + imageStore := NewImageStore(s.tx) + images, err := imageStore.List(ctx) + if err != nil { + return false, err + } + if len(images) > 0 { + return false, nil + } + + containerStore := NewContainerStore(s.tx) + containers, err := containerStore.List(ctx, "") + if err != nil { + return false, err + } + + if len(containers) > 0 { + return false, nil + } + + // TODO(stevvooe): Need to add check for content store, as well. Still need + // to make content store namespace aware. + + return true, nil +} diff --git a/vendor/github.com/containerd/containerd/namespaces/context.go b/vendor/github.com/containerd/containerd/namespaces/context.go new file mode 100644 index 0000000000..fe5049e983 --- /dev/null +++ b/vendor/github.com/containerd/containerd/namespaces/context.go @@ -0,0 +1,42 @@ +package namespaces + +import ( + "github.com/pkg/errors" + "golang.org/x/net/context" +) + +var ( + errNamespaceRequired = errors.New("namespace is required") +) + +type namespaceKey struct{} + +func WithNamespace(ctx context.Context, namespace string) context.Context { + ctx = context.WithValue(ctx, namespaceKey{}, namespace) // set our key for namespace + + // also store on the grpc headers so it gets picked up by any clients that + // are using this. + return withGRPCNamespaceHeader(ctx, namespace) +} + +func Namespace(ctx context.Context) (string, bool) { + namespace, ok := ctx.Value(namespaceKey{}).(string) + if !ok { + return fromGRPCHeader(ctx) + } + + return namespace, ok +} + +func IsNamespaceRequired(err error) bool { + return errors.Cause(err) == errNamespaceRequired +} + +func NamespaceRequired(ctx context.Context) (string, error) { + namespace, ok := Namespace(ctx) + if !ok || namespace == "" { + return "", errNamespaceRequired + } + + return namespace, nil +} diff --git a/vendor/github.com/containerd/containerd/namespaces/grpc.go b/vendor/github.com/containerd/containerd/namespaces/grpc.go new file mode 100644 index 0000000000..c18fc933d1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/namespaces/grpc.go @@ -0,0 +1,44 @@ +package namespaces + +import ( + "golang.org/x/net/context" + "google.golang.org/grpc/metadata" +) + +const ( + // GRPCHeader defines the header name for specifying a containerd namespace. + GRPCHeader = "containerd-namespace" +) + +// NOTE(stevvooe): We can stub this file out if we don't want a grpc dependency here. + +func withGRPCNamespaceHeader(ctx context.Context, namespace string) context.Context { + // also store on the grpc headers so it gets picked up by any clients that + // are using this. + nsheader := metadata.Pairs(GRPCHeader, namespace) + md, ok := metadata.FromOutgoingContext(ctx) // merge with outgoing context. + if !ok { + md = nsheader + } else { + // order ensures the latest is first in this list. + md = metadata.Join(nsheader, md) + } + + return metadata.NewOutgoingContext(ctx, md) +} + +func fromGRPCHeader(ctx context.Context) (string, bool) { + // try to extract for use in grpc servers. + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + // TODO(stevvooe): Check outgoing context? + return "", false + } + + values := md[GRPCHeader] + if len(values) == 0 { + return "", false + } + + return values[0], true +} diff --git a/vendor/github.com/containerd/containerd/namespaces/store.go b/vendor/github.com/containerd/containerd/namespaces/store.go new file mode 100644 index 0000000000..68ff714bb7 --- /dev/null +++ b/vendor/github.com/containerd/containerd/namespaces/store.go @@ -0,0 +1,21 @@ +package namespaces + +import "context" + +// Store provides introspection about namespaces. +// +// Note that these are slightly different than other objects, which are record +// oriented. A namespace is really just a name and a set of labels. Objects +// that belong to a namespace are returned when the namespace is assigned to a +// given context. +// +// +type Store interface { + Create(ctx context.Context, namespace string, labels map[string]string) error + Labels(ctx context.Context, namespace string) (map[string]string, error) + SetLabel(ctx context.Context, namespace, key, value string) error + List(ctx context.Context) ([]string, error) + + // Delete removes the namespace. The namespace must be empty to be deleted. + Delete(ctx context.Context, namespace string) error +} diff --git a/vendor/github.com/containerd/containerd/plugin/container.go b/vendor/github.com/containerd/containerd/plugin/container.go index 2d2145a5a1..cce33b316e 100644 --- a/vendor/github.com/containerd/containerd/plugin/container.go +++ b/vendor/github.com/containerd/containerd/plugin/container.go @@ -7,6 +7,7 @@ type TaskInfo struct { ContainerID string Runtime string Spec []byte + Namespace string } type Task interface { @@ -32,6 +33,8 @@ type Task interface { CloseStdin(context.Context, uint32) error // Checkpoint checkpoints a container to an image with live system data Checkpoint(context.Context, CheckpointOpts) error + // DeleteProcess deletes a specific exec process via the pid + DeleteProcess(context.Context, uint32) (*Exit, error) } type CheckpointOpts struct { @@ -71,9 +74,13 @@ const ( PausedStatus ) -type State interface { +type State struct { // Status is the current status of the container - Status() Status + Status Status // Pid is the main process id for the container - Pid() uint32 + Pid uint32 + Stdin string + Stdout string + Stderr string + Terminal bool } diff --git a/vendor/github.com/containerd/containerd/plugin/context.go b/vendor/github.com/containerd/containerd/plugin/context.go new file mode 100644 index 0000000000..9f19dffa7e --- /dev/null +++ b/vendor/github.com/containerd/containerd/plugin/context.go @@ -0,0 +1,36 @@ +package plugin + +import ( + "context" + "fmt" +) + +func NewContext(plugins map[PluginType][]interface{}) *InitContext { + return &InitContext{ + plugins: plugins, + } +} + +type InitContext struct { + Root string + Context context.Context + Config interface{} + + plugins map[PluginType][]interface{} +} + +func (i *InitContext) Get(t PluginType) (interface{}, error) { + p := i.plugins[t] + if len(p) == 0 { + return nil, fmt.Errorf("no plugins registered for %s", t) + } + return p[0], nil +} + +func (i *InitContext) GetAll(t PluginType) ([]interface{}, error) { + p, ok := i.plugins[t] + if !ok { + return nil, fmt.Errorf("no plugins registered for %s", t) + } + return p, nil +} diff --git a/vendor/github.com/containerd/containerd/plugin/differ.go b/vendor/github.com/containerd/containerd/plugin/differ.go new file mode 100644 index 0000000000..80c3c61819 --- /dev/null +++ b/vendor/github.com/containerd/containerd/plugin/differ.go @@ -0,0 +1,12 @@ +package plugin + +import ( + "github.com/containerd/containerd/mount" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "golang.org/x/net/context" +) + +type Differ interface { + Apply(ctx context.Context, desc ocispec.Descriptor, mount []mount.Mount) (ocispec.Descriptor, error) + DiffMounts(ctx context.Context, lower, upper []mount.Mount, media, ref string) (ocispec.Descriptor, error) +} diff --git a/vendor/github.com/containerd/containerd/plugin/errors.go b/vendor/github.com/containerd/containerd/plugin/errors.go index 60d5203ee5..ac2003eadf 100644 --- a/vendor/github.com/containerd/containerd/plugin/errors.go +++ b/vendor/github.com/containerd/containerd/plugin/errors.go @@ -3,7 +3,6 @@ package plugin import "errors" var ( - ErrUnknownRuntime = errors.New("unknown runtime") ErrContainerExists = errors.New("container with id already exists") ErrContainerNotExist = errors.New("container does not exist") ErrRuntimeNotExist = errors.New("runtime does not exist") diff --git a/vendor/github.com/containerd/containerd/plugin/plugin.go b/vendor/github.com/containerd/containerd/plugin/plugin.go index 6310e90194..14ee9cf356 100644 --- a/vendor/github.com/containerd/containerd/plugin/plugin.go +++ b/vendor/github.com/containerd/containerd/plugin/plugin.go @@ -1,43 +1,42 @@ package plugin import ( + "errors" "fmt" "sync" - "github.com/boltdb/bolt" - "github.com/containerd/containerd/content" - "github.com/containerd/containerd/snapshot" - - "golang.org/x/net/context" "google.golang.org/grpc" ) -type PluginType int +var ( + ErrNoPluginType = errors.New("plugin: no type") + ErrNoPluginID = errors.New("plugin: no id") +) + +type PluginType string const ( - RuntimePlugin PluginType = iota + 1 - GRPCPlugin - SnapshotPlugin - TaskMonitorPlugin + RuntimePlugin PluginType = "io.containerd.runtime.v1" + GRPCPlugin PluginType = "io.containerd.grpc.v1" + SnapshotPlugin PluginType = "io.containerd.snapshotter.v1" + TaskMonitorPlugin PluginType = "io.containerd.monitor.v1" + DiffPlugin PluginType = "io.containerd.differ.v1" + MetadataPlugin PluginType = "io.containerd.metadata.v1" + ContentPlugin PluginType = "io.containerd.content.v1" ) type Registration struct { - Type PluginType - Config interface{} - Init func(*InitContext) (interface{}, error) + Type PluginType + ID string + Config interface{} + Requires []PluginType + Init func(*InitContext) (interface{}, error) + + added bool } -// TODO(@crosbymichael): how to we keep this struct from growing but support dependency injection for loaded plugins? -type InitContext struct { - Root string - State string - Runtimes map[string]Runtime - Content content.Store - Meta *bolt.DB - Snapshotter snapshot.Snapshotter - Config interface{} - Context context.Context - Monitor TaskMonitor +func (r *Registration) URI() string { + return fmt.Sprintf("%s.%s", r.Type, r.ID) } type Service interface { @@ -46,10 +45,8 @@ type Service interface { var register = struct { sync.Mutex - r map[string]*Registration -}{ - r: make(map[string]*Registration), -} + r []*Registration +}{} // Load loads all plugins at the provided path into containerd func Load(path string) (err error) { @@ -65,16 +62,39 @@ func Load(path string) (err error) { return loadPlugins(path) } -func Register(name string, r *Registration) error { +func Register(r *Registration) { register.Lock() defer register.Unlock() - if _, ok := register.r[name]; ok { - return fmt.Errorf("plugin already registered as %q", name) + if r.Type == "" { + panic(ErrNoPluginType) + } + if r.ID == "" { + panic(ErrNoPluginID) } - register.r[name] = r - return nil + register.r = append(register.r, r) } -func Registrations() map[string]*Registration { - return register.r +func Graph() (ordered []*Registration) { + for _, r := range register.r { + children(r.Requires, &ordered) + if !r.added { + ordered = append(ordered, r) + r.added = true + } + } + return ordered +} + +func children(types []PluginType, ordered *[]*Registration) { + for _, t := range types { + for _, r := range register.r { + if r.Type == t { + children(r.Requires, ordered) + if !r.added { + *ordered = append(*ordered, r) + r.added = true + } + } + } + } } diff --git a/vendor/github.com/containerd/containerd/plugin/runtime.go b/vendor/github.com/containerd/containerd/plugin/runtime.go index 5babc2cd77..8c38a5eb14 100644 --- a/vendor/github.com/containerd/containerd/plugin/runtime.go +++ b/vendor/github.com/containerd/containerd/plugin/runtime.go @@ -32,8 +32,12 @@ type Exit struct { // Runtime is responsible for the creation of containers for a certain platform, // arch, or custom usage. type Runtime interface { + // ID of the runtime + ID() string // Create creates a container with the provided id and options Create(ctx context.Context, id string, opts CreateOpts) (Task, error) + // Get returns a container + Get(context.Context, string) (Task, error) // Containers returns all the current containers for the runtime Tasks(context.Context) ([]Task, error) // Delete removes the container in the runtime diff --git a/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go b/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go index ad118fd1d7..24c2a6a54a 100644 --- a/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go +++ b/vendor/github.com/containerd/containerd/remotes/docker/fetcher.go @@ -67,6 +67,7 @@ func getV2URLPaths(desc ocispec.Descriptor) ([]string, error) { switch desc.MediaType { case images.MediaTypeDockerSchema2Manifest, images.MediaTypeDockerSchema2ManifestList, + images.MediaTypeDockerSchema1Manifest, ocispec.MediaTypeImageManifest, ocispec.MediaTypeImageIndex: urls = append(urls, path.Join("manifests", desc.Digest.String())) } diff --git a/vendor/github.com/containerd/containerd/remotes/docker/pusher.go b/vendor/github.com/containerd/containerd/remotes/docker/pusher.go index faeaa09bad..f99701820d 100644 --- a/vendor/github.com/containerd/containerd/remotes/docker/pusher.go +++ b/vendor/github.com/containerd/containerd/remotes/docker/pusher.go @@ -1,16 +1,19 @@ package docker import ( - "bytes" "context" "io" "io/ioutil" "net/http" "path" "strings" + "time" + "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) @@ -18,9 +21,23 @@ import ( type dockerPusher struct { *dockerBase tag string + + // TODO: namespace tracker + tracker StatusTracker } -func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor, r io.Reader) error { +func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (content.Writer, error) { + ref := remotes.MakeRefKey(ctx, desc) + status, err := p.tracker.GetStatus(ref) + if err == nil { + if status.Offset == status.Total { + return nil, content.ErrExists + } + // TODO: Handle incomplete status + } else if !content.IsNotFound(err) { + return nil, errors.Wrap(err, "failed to get status") + } + var ( isManifest bool existCheck string @@ -37,34 +54,35 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor, r io.Re req, err := http.NewRequest(http.MethodHead, p.url(existCheck), nil) if err != nil { - return err + return nil, err } req.Header.Set("Accept", strings.Join([]string{desc.MediaType, `*`}, ", ")) resp, err := p.doRequestWithRetries(ctx, req, nil) if err != nil { if errors.Cause(err) != ErrInvalidAuthorization { - return err + return nil, err } log.G(ctx).WithError(err).Debugf("Unable to check existence, continuing with push") } else { if resp.StatusCode == http.StatusOK { - return nil + p.tracker.SetStatus(ref, Status{ + Status: content.Status{ + Ref: ref, + // TODO: Set updated time? + }, + }) + return nil, content.ErrExists } if resp.StatusCode != http.StatusNotFound { // TODO: log error - return errors.Errorf("unexpected response: %s", resp.Status) + return nil, errors.Errorf("unexpected response: %s", resp.Status) } } // TODO: Lookup related objects for cross repository push if isManifest { - // Read all to use bytes.Reader for using GetBody - b, err := ioutil.ReadAll(r) - if err != nil { - return errors.Wrap(err, "failed to read manifest") - } var putPath string if p.tag != "" { putPath = path.Join("manifests", p.tag) @@ -72,43 +90,27 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor, r io.Re putPath = path.Join("manifests", desc.Digest.String()) } - req, err := http.NewRequest(http.MethodPut, p.url(putPath), nil) + req, err = http.NewRequest(http.MethodPut, p.url(putPath), nil) if err != nil { - return err - } - req.ContentLength = int64(len(b)) - req.Body = ioutil.NopCloser(bytes.NewReader(b)) - req.GetBody = func() (io.ReadCloser, error) { - return ioutil.NopCloser(bytes.NewReader(b)), nil + return nil, err } req.Header.Add("Content-Type", desc.MediaType) - - resp, err := p.doRequestWithRetries(ctx, req, nil) - if err != nil { - return err - } - if resp.StatusCode != http.StatusCreated { - // TODO: log error - return errors.Errorf("unexpected response: %s", resp.Status) - } } else { // TODO: Do monolithic upload if size is small - // TODO: Turn multi-request blob uploader into ingester - // Start upload request - req, err := http.NewRequest(http.MethodPost, p.url("blobs", "uploads")+"/", nil) + req, err = http.NewRequest(http.MethodPost, p.url("blobs", "uploads")+"/", nil) if err != nil { - return err + return nil, err } resp, err := p.doRequestWithRetries(ctx, req, nil) if err != nil { - return err + return nil, err } if resp.StatusCode != http.StatusAccepted { // TODO: log error - return errors.Errorf("unexpected response: %s", resp.Status) + return nil, errors.Errorf("unexpected response: %s", resp.Status) } location := resp.Header.Get("Location") @@ -119,26 +121,143 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor, r io.Re location = u.String() } - // TODO: Support chunked upload - req, err = http.NewRequest(http.MethodPut, location, r) + req, err = http.NewRequest(http.MethodPut, location, nil) if err != nil { - return err + return nil, err } q := req.URL.Query() q.Add("digest", desc.Digest.String()) req.URL.RawQuery = q.Encode() - req.ContentLength = desc.Size + } + p.tracker.SetStatus(ref, Status{ + Status: content.Status{ + Ref: ref, + Total: desc.Size, + Expected: desc.Digest, + StartedAt: time.Now(), + }, + }) + + // TODO: Support chunked upload + + pr, pw := io.Pipe() + respC := make(chan *http.Response, 1) + + req.Body = ioutil.NopCloser(pr) + req.ContentLength = desc.Size + + go func() { + defer close(respC) resp, err = p.doRequest(ctx, req) if err != nil { - return err + pr.CloseWithError(err) + return } if resp.StatusCode != http.StatusCreated { // TODO: log error - return errors.Errorf("unexpected response: %s", resp.Status) + pr.CloseWithError(errors.Errorf("unexpected response: %s", resp.Status)) } + respC <- resp + }() + + return &pushWriter{ + base: p.dockerBase, + ref: ref, + pipe: pw, + responseC: respC, + isManifest: isManifest, + expected: desc.Digest, + tracker: p.tracker, + }, nil +} +type pushWriter struct { + base *dockerBase + ref string + + pipe *io.PipeWriter + responseC <-chan *http.Response + isManifest bool + + expected digest.Digest + tracker StatusTracker +} + +func (pw *pushWriter) Write(p []byte) (n int, err error) { + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return n, err + } + n, err = pw.pipe.Write(p) + status.Offset += int64(n) + status.UpdatedAt = time.Now() + pw.tracker.SetStatus(pw.ref, status) + return +} + +func (pw *pushWriter) Close() error { + return pw.pipe.Close() +} + +func (pw *pushWriter) Status() (content.Status, error) { + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return content.Status{}, err + } + return status.Status, nil + +} + +func (pw *pushWriter) Digest() digest.Digest { + // TODO: Get rid of this function? + return pw.expected +} + +func (pw *pushWriter) Commit(size int64, expected digest.Digest) error { + // Check whether read has already thrown an error + if _, err := pw.pipe.Write([]byte{}); err != nil && err != io.ErrClosedPipe { + return errors.Wrap(err, "pipe error before commit") + } + + if err := pw.pipe.Close(); err != nil { + return err + } + // TODO: Update status to determine committing + + // TODO: timeout waiting for response + resp := <-pw.responseC + if resp == nil { + return errors.New("no response") + } + + status, err := pw.tracker.GetStatus(pw.ref) + if err != nil { + return errors.Wrap(err, "failed to get status") + } + + if size > 0 && size != status.Offset { + return errors.Errorf("unxpected size %d, expected %d", status.Offset, size) + } + + if expected == "" { + expected = status.Expected + } + + actual, err := digest.Parse(resp.Header.Get("Docker-Content-Digest")) + if err != nil { + return errors.Wrap(err, "invalid content digest in response") + } + + if actual != expected { + return errors.Errorf("got digest %s, expected %s", actual, expected) } return nil } + +func (pw *pushWriter) Truncate(size int64) error { + // TODO: if blob close request and start new request at offset + // TODO: always error on manifest + return errors.New("cannot truncate remote upload") +} diff --git a/vendor/github.com/containerd/containerd/remotes/docker/resolver.go b/vendor/github.com/containerd/containerd/remotes/docker/resolver.go index 8b55d7c19b..fe96268589 100644 --- a/vendor/github.com/containerd/containerd/remotes/docker/resolver.go +++ b/vendor/github.com/containerd/containerd/remotes/docker/resolver.go @@ -38,6 +38,7 @@ type dockerResolver struct { credentials func(string) (string, string, error) plainHTTP bool client *http.Client + tracker StatusTracker } // ResolverOptions are used to configured a new Docker register resolver @@ -52,14 +53,24 @@ type ResolverOptions struct { // Client is the http client to used when making registry requests Client *http.Client + + // Tracker is used to track uploads to the registry. This is used + // since the registry does not have upload tracking and the existing + // mechanism for getting blob upload status is expensive. + Tracker StatusTracker } // NewResolver returns a new resolver to a Docker registry func NewResolver(options ResolverOptions) remotes.Resolver { + tracker := options.Tracker + if tracker == nil { + tracker = NewInMemoryTracker() + } return &dockerResolver{ credentials: options.Credentials, plainHTTP: options.PlainHTTP, client: options.Client, + tracker: tracker, } } @@ -212,6 +223,7 @@ func (r *dockerResolver) Pusher(ctx context.Context, ref string) (remotes.Pusher return dockerPusher{ dockerBase: base, tag: refspec.Object, + tracker: r.tracker, }, nil } diff --git a/vendor/github.com/containerd/containerd/remotes/docker/status.go b/vendor/github.com/containerd/containerd/remotes/docker/status.go new file mode 100644 index 0000000000..34280f1d12 --- /dev/null +++ b/vendor/github.com/containerd/containerd/remotes/docker/status.go @@ -0,0 +1,46 @@ +package docker + +import ( + "sync" + + "github.com/containerd/containerd/content" +) + +type Status struct { + content.Status + + // UploadUUID is used by the Docker registry to reference blob uploads + UploadUUID string +} + +type StatusTracker interface { + GetStatus(string) (Status, error) + SetStatus(string, Status) +} + +type memoryStatusTracker struct { + statuses map[string]Status + m sync.Mutex +} + +func NewInMemoryTracker() StatusTracker { + return &memoryStatusTracker{ + statuses: map[string]Status{}, + } +} + +func (t *memoryStatusTracker) GetStatus(ref string) (Status, error) { + t.m.Lock() + defer t.m.Unlock() + status, ok := t.statuses[ref] + if !ok { + return Status{}, content.ErrNotFound + } + return status, nil +} + +func (t *memoryStatusTracker) SetStatus(ref string, status Status) { + t.m.Lock() + t.statuses[ref] = status + t.m.Unlock() +} diff --git a/vendor/github.com/containerd/containerd/remotes/handlers.go b/vendor/github.com/containerd/containerd/remotes/handlers.go index ec95511727..a811773264 100644 --- a/vendor/github.com/containerd/containerd/remotes/handlers.go +++ b/vendor/github.com/containerd/containerd/remotes/handlers.go @@ -3,6 +3,7 @@ package remotes import ( "context" "fmt" + "time" "github.com/Sirupsen/logrus" "github.com/containerd/containerd/content" @@ -19,12 +20,15 @@ func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string { // product of the context, which may include information about the ongoing // fetch process. switch desc.MediaType { - case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest, - images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: return "manifest-" + desc.Digest.String() - case images.MediaTypeDockerSchema2Layer, images.MediaTypeDockerSchema2LayerGzip: + case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + return "index-" + desc.Digest.String() + case images.MediaTypeDockerSchema2Layer, images.MediaTypeDockerSchema2LayerGzip, + ocispec.MediaTypeImageLayer, ocispec.MediaTypeImageLayerGzip, + ocispec.MediaTypeImageLayerNonDistributable, ocispec.MediaTypeImageLayerNonDistributableGzip: return "layer-" + desc.Digest.String() - case "application/vnd.docker.container.image.v1+json": + case images.MediaTypeDockerSchema2Config, ocispec.MediaTypeImageConfig: return "config-" + desc.Digest.String() default: log.G(ctx).Warnf("reference for unknown type: %s", desc.MediaType) @@ -44,8 +48,8 @@ func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc })) switch desc.MediaType { - case images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: - return nil, fmt.Errorf("%v not yet supported", desc.MediaType) + case images.MediaTypeDockerSchema1Manifest: + return nil, fmt.Errorf("%v not supported", desc.MediaType) default: err := fetch(ctx, ingester, fetcher, desc) return nil, err @@ -55,12 +59,82 @@ func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc func fetch(ctx context.Context, ingester content.Ingester, fetcher Fetcher, desc ocispec.Descriptor) error { log.G(ctx).Debug("fetch") - ref := MakeRefKey(ctx, desc) + + var ( + ref = MakeRefKey(ctx, desc) + cw content.Writer + err error + retry = 16 + ) + for { + cw, err = ingester.Writer(ctx, ref, desc.Size, desc.Digest) + if err != nil { + if content.IsExists(err) { + return nil + } else if !content.IsLocked(err) { + return err + } + + // TODO: On first time locked is encountered, get status + // of writer and abort if not updated recently. + + select { + case <-time.After(time.Millisecond * time.Duration(retry)): + if retry < 2048 { + retry = retry << 1 + } + continue + case <-ctx.Done(): + // Propagate lock error + return err + } + } + defer cw.Close() + break + } + rc, err := fetcher.Fetch(ctx, desc) if err != nil { return err } defer rc.Close() - return content.WriteBlob(ctx, ingester, ref, rc, desc.Size, desc.Digest) + return content.Copy(cw, rc, desc.Size, desc.Digest) +} + +// PushHandler returns a handler that will push all content from the provider +// using a writer from the pusher. +func PushHandler(provider content.Provider, pusher Pusher) images.HandlerFunc { + return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ + "digest": desc.Digest, + "mediatype": desc.MediaType, + "size": desc.Size, + })) + + err := push(ctx, provider, pusher, desc) + return nil, err + } +} + +func push(ctx context.Context, provider content.Provider, pusher Pusher, desc ocispec.Descriptor) error { + log.G(ctx).Debug("push") + + cw, err := pusher.Push(ctx, desc) + if err != nil { + if !content.IsExists(err) { + return err + } + + return nil + } + defer cw.Close() + + rc, err := provider.Reader(ctx, desc.Digest) + if err != nil { + return err + } + defer rc.Close() + + return content.Copy(cw, rc, desc.Size, desc.Digest) } diff --git a/vendor/github.com/containerd/containerd/remotes/resolver.go b/vendor/github.com/containerd/containerd/remotes/resolver.go index 0dde5bfc87..d5fa60fc6b 100644 --- a/vendor/github.com/containerd/containerd/remotes/resolver.go +++ b/vendor/github.com/containerd/containerd/remotes/resolver.go @@ -4,6 +4,7 @@ import ( "context" "io" + "github.com/containerd/containerd/content" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -37,9 +38,9 @@ type Fetcher interface { } type Pusher interface { - // Push pushes the resource identified by the descriptor using the - // passed in reader. - Push(ctx context.Context, d ocispec.Descriptor, r io.Reader) error + // Push returns a content writer for the given resource identified + // by the descriptor. + Push(ctx context.Context, d ocispec.Descriptor) (content.Writer, error) } // FetcherFunc allows package users to implement a Fetcher with just a diff --git a/vendor/github.com/containerd/containerd/services/content/helpers.go b/vendor/github.com/containerd/containerd/services/content/helpers.go index a107bcb981..d518909c57 100644 --- a/vendor/github.com/containerd/containerd/services/content/helpers.go +++ b/vendor/github.com/containerd/containerd/services/content/helpers.go @@ -13,6 +13,8 @@ func rewriteGRPCError(err error) error { return content.ErrExists case codes.NotFound: return content.ErrNotFound + case codes.Unavailable: + return content.ErrLocked } return err @@ -24,6 +26,8 @@ func serverErrorToGRPC(err error, id string) error { return grpc.Errorf(codes.NotFound, "%v: not found", id) case content.IsExists(err): return grpc.Errorf(codes.AlreadyExists, "%v: exists", id) + case content.IsLocked(err): + return grpc.Errorf(codes.Unavailable, "%v: locked", id) } return err diff --git a/vendor/github.com/containerd/containerd/services/content/reader.go b/vendor/github.com/containerd/containerd/services/content/reader.go index e40150231d..7c22db9874 100644 --- a/vendor/github.com/containerd/containerd/services/content/reader.go +++ b/vendor/github.com/containerd/containerd/services/content/reader.go @@ -1,7 +1,10 @@ package content import ( + "context" + contentapi "github.com/containerd/containerd/api/services/content" + digest "github.com/opencontainers/go-digest" ) type remoteReader struct { @@ -34,18 +37,46 @@ func (rr *remoteReader) Read(p []byte) (n int, err error) { n += copied p = p[copied:] - if copied < len(p) { - continue + if len(p) == 0 { + rr.extra = append(rr.extra, resp.Data[copied:]...) } - - rr.extra = append(rr.extra, resp.Data[copied:]...) } return } -// TODO(stevvooe): Implemente io.ReaderAt. - func (rr *remoteReader) Close() error { return rr.client.CloseSend() } + +type remoteReaderAt struct { + ctx context.Context + digest digest.Digest + client contentapi.ContentClient +} + +func (ra *remoteReaderAt) ReadAt(p []byte, off int64) (n int, err error) { + rr := &contentapi.ReadRequest{ + Digest: ra.digest, + Offset: off, + Size_: int64(len(p)), + } + rc, err := ra.client.Read(ra.ctx, rr) + if err != nil { + return 0, err + } + + for len(p) > 0 { + var resp *contentapi.ReadResponse + // fill our buffer up until we can fill p. + resp, err = rc.Recv() + if err != nil { + return n, err + } + + copied := copy(p, resp.Data) + n += copied + p = p[copied:] + } + return n, nil +} diff --git a/vendor/github.com/containerd/containerd/services/content/service.go b/vendor/github.com/containerd/containerd/services/content/service.go index 662d41d65b..fb84d113c6 100644 --- a/vendor/github.com/containerd/containerd/services/content/service.go +++ b/vendor/github.com/containerd/containerd/services/content/service.go @@ -30,15 +30,23 @@ var bufPool = sync.Pool{ var _ api.ContentServer = &Service{} func init() { - plugin.Register("content-grpc", &plugin.Registration{ + plugin.Register(&plugin.Registration{ Type: plugin.GRPCPlugin, + ID: "content", + Requires: []plugin.PluginType{ + plugin.ContentPlugin, + }, Init: NewService, }) } func NewService(ic *plugin.InitContext) (interface{}, error) { + c, err := ic.Get(plugin.ContentPlugin) + if err != nil { + return nil, err + } return &Service{ - store: ic.Content, + store: c.(content.Store), }, nil } @@ -275,7 +283,7 @@ func (s *Service) Write(session api.Content_WriteServer) (err error) { // this action locks the writer for the session. wr, err := s.store.Writer(ctx, ref, total, expected) if err != nil { - return err + return serverErrorToGRPC(err, ref) } defer wr.Close() @@ -283,7 +291,7 @@ func (s *Service) Write(session api.Content_WriteServer) (err error) { msg.Action = req.Action ws, err := wr.Status() if err != nil { - return err + return serverErrorToGRPC(err, ref) } msg.Offset = ws.Offset // always set the offset. diff --git a/vendor/github.com/containerd/containerd/services/content/store.go b/vendor/github.com/containerd/containerd/services/content/store.go index e5c19e4587..11ad37b0ea 100644 --- a/vendor/github.com/containerd/containerd/services/content/store.go +++ b/vendor/github.com/containerd/containerd/services/content/store.go @@ -85,6 +85,14 @@ func (rs *remoteStore) Reader(ctx context.Context, dgst digest.Digest) (io.ReadC }, nil } +func (rs *remoteStore) ReaderAt(ctx context.Context, dgst digest.Digest) (io.ReaderAt, error) { + return &remoteReaderAt{ + ctx: ctx, + digest: dgst, + client: rs.client, + }, nil +} + func (rs *remoteStore) Status(ctx context.Context, re string) ([]content.Status, error) { resp, err := rs.client.Status(ctx, &contentapi.StatusRequest{ Regexp: re, @@ -115,6 +123,7 @@ func (rs *remoteStore) Writer(ctx context.Context, ref string, size int64, expec } return &remoteWriter{ + ref: ref, client: wrclient, offset: offset, }, nil diff --git a/vendor/github.com/containerd/containerd/services/content/writer.go b/vendor/github.com/containerd/containerd/services/content/writer.go index be601448a8..6ea17ef1ea 100644 --- a/vendor/github.com/containerd/containerd/services/content/writer.go +++ b/vendor/github.com/containerd/containerd/services/content/writer.go @@ -16,14 +16,6 @@ type remoteWriter struct { digest digest.Digest } -func newRemoteWriter(client contentapi.Content_WriteClient, ref string, offset int64) (*remoteWriter, error) { - return &remoteWriter{ - ref: ref, - client: client, - offset: offset, - }, nil -} - // send performs a synchronous req-resp cycle on the client. func (rw *remoteWriter) send(req *contentapi.WriteRequest) (*contentapi.WriteResponse, error) { if err := rw.client.Send(req); err != nil { diff --git a/vendor/github.com/containerd/containerd/services/images/helpers.go b/vendor/github.com/containerd/containerd/services/images/helpers.go index 539a918d30..19ce9e18af 100644 --- a/vendor/github.com/containerd/containerd/services/images/helpers.go +++ b/vendor/github.com/containerd/containerd/services/images/helpers.go @@ -4,6 +4,8 @@ import ( imagesapi "github.com/containerd/containerd/api/services/images" "github.com/containerd/containerd/api/types/descriptor" "github.com/containerd/containerd/images" + "github.com/containerd/containerd/metadata" + "github.com/containerd/containerd/namespaces" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "google.golang.org/grpc" @@ -67,9 +69,9 @@ func rewriteGRPCError(err error) error { switch grpc.Code(errors.Cause(err)) { case codes.AlreadyExists: - return images.ErrExists + return metadata.ErrExists case codes.NotFound: - return images.ErrNotFound + return metadata.ErrNotFound } return err @@ -77,10 +79,12 @@ func rewriteGRPCError(err error) error { func mapGRPCError(err error, id string) error { switch { - case images.IsNotFound(err): + case metadata.IsNotFound(err): return grpc.Errorf(codes.NotFound, "image %v not found", id) - case images.IsExists(err): + case metadata.IsExists(err): return grpc.Errorf(codes.AlreadyExists, "image %v already exists", id) + case namespaces.IsNamespaceRequired(err): + return grpc.Errorf(codes.InvalidArgument, "namespace required, please set %q header", namespaces.GRPCHeader) } return err diff --git a/vendor/github.com/containerd/containerd/services/images/service.go b/vendor/github.com/containerd/containerd/services/images/service.go index 2310db4e3a..57d1f0b146 100644 --- a/vendor/github.com/containerd/containerd/services/images/service.go +++ b/vendor/github.com/containerd/containerd/services/images/service.go @@ -4,6 +4,7 @@ import ( "github.com/boltdb/bolt" imagesapi "github.com/containerd/containerd/api/services/images" "github.com/containerd/containerd/images" + "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" @@ -11,10 +12,18 @@ import ( ) func init() { - plugin.Register("images-grpc", &plugin.Registration{ + plugin.Register(&plugin.Registration{ Type: plugin.GRPCPlugin, + ID: "images", + Requires: []plugin.PluginType{ + plugin.MetadataPlugin, + }, Init: func(ic *plugin.InitContext) (interface{}, error) { - return NewService(ic.Meta), nil + m, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } + return NewService(m.(*bolt.DB)), nil }, }) } @@ -73,7 +82,7 @@ func (s *Service) Delete(ctx context.Context, req *imagesapi.DeleteRequest) (*em } func (s *Service) withStore(ctx context.Context, fn func(ctx context.Context, store images.Store) error) func(tx *bolt.Tx) error { - return func(tx *bolt.Tx) error { return fn(ctx, images.NewStore(tx)) } + return func(tx *bolt.Tx) error { return fn(ctx, metadata.NewImageStore(tx)) } } func (s *Service) withStoreView(ctx context.Context, fn func(ctx context.Context, store images.Store) error) error { diff --git a/vendor/github.com/containerd/containerd/snapshot/errors.go b/vendor/github.com/containerd/containerd/snapshot/errors.go deleted file mode 100644 index 0b6e5174b1..0000000000 --- a/vendor/github.com/containerd/containerd/snapshot/errors.go +++ /dev/null @@ -1,44 +0,0 @@ -package snapshot - -import "github.com/pkg/errors" - -var ( - // ErrSnapshotNotExist is returned when a snapshot cannot be found - ErrSnapshotNotExist = errors.New("snapshot does not exist") - - // ErrSnapshotExist is returned when an operation to create a snapshot - // encounters a snapshot with the same key - ErrSnapshotExist = errors.New("snapshot already exists") - - // ErrSnapshotNotActive is returned when a request which requires an - // active snapshot encounters a non-active snapshot. - ErrSnapshotNotActive = errors.New("snapshot is not active") - - // ErrSnapshotNotCommitted is returned when a request which requires a - // committed snapshot encounters a non-committed snapshot. - ErrSnapshotNotCommitted = errors.New("snapshot is not committed") -) - -// IsNotExist returns whether the error represents that a snapshot -// was not found. -func IsNotExist(err error) bool { - return errors.Cause(err) == ErrSnapshotNotExist -} - -// IsExist returns whether the error represents whether a snapshot -// already exists using a provided key. -func IsExist(err error) bool { - return errors.Cause(err) == ErrSnapshotExist -} - -// IsNotActive returns whether the error represents a request -// for a non active snapshot when an active snapshot is expected. -func IsNotActive(err error) bool { - return errors.Cause(err) == ErrSnapshotNotActive -} - -// IsNotCommitted returns whether the error represents a request -// for a non committed snapshot when a committed snapshot is expected. -func IsNotCommitted(err error) bool { - return errors.Cause(err) == ErrSnapshotNotCommitted -} diff --git a/vendor/github.com/containerd/containerd/snapshot/snapshotter.go b/vendor/github.com/containerd/containerd/snapshot/snapshotter.go deleted file mode 100644 index a0e956d792..0000000000 --- a/vendor/github.com/containerd/containerd/snapshot/snapshotter.go +++ /dev/null @@ -1,238 +0,0 @@ -package snapshot - -import ( - "context" - - "github.com/containerd/containerd/mount" -) - -// Kind identifies the kind of snapshot. -type Kind int - -// definitions of snapshot kinds -const ( - KindActive Kind = iota - KindCommitted -) - -// Info provides information about a particular snapshot. -type Info struct { - Name string // name or key of snapshot - Parent string // name of parent snapshot - Kind Kind // active or committed snapshot - Readonly bool // true if readonly, only valid for active -} - -// Usage defines statistics for disk resources consumed by the snapshot. -// -// These resources only include the resources consumed by the snapshot itself -// and does not include resources usage by the parent. -type Usage struct { - Inodes int64 // number of inodes in use. - Size int64 // provides usage, in bytes, of snapshot -} - -func (u *Usage) Add(other Usage) { - u.Size += other.Size - - // TODO(stevvooe): assumes independent inodes, but provides and upper - // bound. This should be pretty close, assumming the inodes for a - // snapshot are roughly unique to it. Don't trust this assumption. - u.Inodes += other.Inodes -} - -// Snapshotter defines the methods required to implement a snapshot snapshotter for -// allocating, snapshotting and mounting filesystem changesets. The model works -// by building up sets of changes with parent-child relationships. -// -// A snapshot represents a filesystem state. Every snapshot has a parent, where -// the empty parent is represented by the empty string. A diff can be taken -// between a parent and its snapshot to generate a classic layer. -// -// An active snapshot is created by calling `Prepare`. After mounting, changes -// can be made to the snapshot. The act of commiting creates a committed -// snapshot. The committed snapshot will get the parent of active snapshot. The -// committed snapshot can then be used as a parent. Active snapshots can never -// act as a parent. -// -// Snapshots are best understood by their lifecycle. Active snapshots are -// always created with Prepare or View. Committed snapshots are always created -// with Commit. Active snapshots never become committed snapshots and vice -// versa. All snapshots may be removed. -// -// For consistency, we define the following terms to be used throughout this -// interface for snapshotter implementations: -// -// `ctx` - refers to a context.Context -// `key` - refers to an active snapshot -// `name` - refers to a committed snapshot -// `parent` - refers to the parent in relation -// -// Most methods take various combinations of these identifiers. Typically, -// `name` and `parent` will be used in cases where a method *only* takes -// committed snapshots. `key` will be used to refer to active snapshots in most -// cases, except where noted. All variables used to access snapshots use the -// same key space. For example, an active snapshot may not share the same key -// with a committed snapshot. -// -// We cover several examples below to demonstrate the utility of a snapshot -// snapshotter. -// -// Importing a Layer -// -// To import a layer, we simply have the Snapshotter provide a list of -// mounts to be applied such that our dst will capture a changeset. We start -// out by getting a path to the layer tar file and creating a temp location to -// unpack it to: -// -// layerPath, tmpDir := getLayerPath(), mkTmpDir() // just a path to layer tar file. -// -// We start by using a Snapshotter to Prepare a new snapshot transaction, using a -// key and descending from the empty parent "": -// -// mounts, err := snapshotter.Prepare(ctx, key, "") -// if err != nil { ... } -// -// We get back a list of mounts from Snapshotter.Prepare, with the key identifying -// the active snapshot. Mount this to the temporary location with the -// following: -// -// if err := containerd.MountAll(mounts, tmpDir); err != nil { ... } -// -// Once the mounts are performed, our temporary location is ready to capture -// a diff. In practice, this works similar to a filesystem transaction. The -// next step is to unpack the layer. We have a special function unpackLayer -// that applies the contents of the layer to target location and calculates the -// DiffID of the unpacked layer (this is a requirement for docker -// implementation): -// -// layer, err := os.Open(layerPath) -// if err != nil { ... } -// digest, err := unpackLayer(tmpLocation, layer) // unpack into layer location -// if err != nil { ... } -// -// When the above completes, we should have a filesystem the represents the -// contents of the layer. Careful implementations should verify that digest -// matches the expected DiffID. When completed, we unmount the mounts: -// -// unmount(mounts) // optional, for now -// -// Now that we've verified and unpacked our layer, we commit the active -// snapshot to a name. For this example, we are just going to use the layer -// digest, but in practice, this will probably be the ChainID: -// -// if err := snapshotter.Commit(ctx, digest.String(), key); err != nil { ... } -// -// Now, we have a layer in the Snapshotter that can be accessed with the digest -// provided during commit. Once you have committed the snapshot, the active -// snapshot can be removed with the following: -// -// snapshotter.Remove(ctx, key) -// -// Importing the Next Layer -// -// Making a layer depend on the above is identical to the process described -// above except that the parent is provided as parent when calling -// Manager.Prepare, assuming a clean, unique key identifier: -// -// mounts, err := snapshotter.Prepare(ctx, key, parentDigest) -// -// We then mount, apply and commit, as we did above. The new snapshot will be -// based on the content of the previous one. -// -// Running a Container -// -// To run a container, we simply provide Snapshotter.Prepare the committed image -// snapshot as the parent. After mounting, the prepared path can -// be used directly as the container's filesystem: -// -// mounts, err := snapshotter.Prepare(ctx, containerKey, imageRootFSChainID) -// -// The returned mounts can then be passed directly to the container runtime. If -// one would like to create a new image from the filesystem, Manager.Commit is -// called: -// -// if err := snapshotter.Commit(ctx, newImageSnapshot, containerKey); err != nil { ... } -// -// Alternatively, for most container runs, Snapshotter.Remove will be called to -// signal the Snapshotter to abandon the changes. -type Snapshotter interface { - // Stat returns the info for an active or committed snapshot by name or - // key. - // - // Should be used for parent resolution, existence checks and to discern - // the kind of snapshot. - Stat(ctx context.Context, key string) (Info, error) - - // Usage returns the resource usage of an active or committed snapshot - // excluding the usage of parent snapshots. - // - // The running time of this call for active snapshots is dependent on - // implementation, but may be proportional to the size of the resource. - // Callers should take this into consideration. Implementations should - // attempt to honer context cancellation and avoid taking locks when making - // the calculation. - Usage(ctx context.Context, key string) (Usage, error) - - // Mounts returns the mounts for the active snapshot transaction identified - // by key. Can be called on an read-write or readonly transaction. This is - // available only for active snapshots. - // - // This can be used to recover mounts after calling View or Prepare. - Mounts(ctx context.Context, key string) ([]mount.Mount, error) - - // Prepare creates an active snapshot identified by key descending from the - // provided parent. The returned mounts can be used to mount the snapshot - // to capture changes. - // - // If a parent is provided, after performing the mounts, the destination - // will start with the content of the parent. The parent must be a - // committed snapshot. Changes to the mounted destination will be captured - // in relation to the parent. The default parent, "", is an empty - // directory. - // - // The changes may be saved to a committed snapshot by calling Commit. When - // one is done with the transaction, Remove should be called on the key. - // - // Multiple calls to Prepare or View with the same key should fail. - Prepare(ctx context.Context, key, parent string) ([]mount.Mount, error) - - // View behaves identically to Prepare except the result may not be - // committed back to the snapshot snapshotter. View returns a readonly view on - // the parent, with the active snapshot being tracked by the given key. - // - // This method operates identically to Prepare, except that Mounts returned - // may have the readonly flag set. Any modifications to the underlying - // filesystem will be ignored. Implementations may perform this in a more - // efficient manner that differs from what would be attempted with - // `Prepare`. - // - // Commit may not be called on the provided key and will return an error. - // To collect the resources associated with key, Remove must be called with - // key as the argument. - View(ctx context.Context, key, parent string) ([]mount.Mount, error) - - // Commit captures the changes between key and its parent into a snapshot - // identified by name. The name can then be used with the snapshotter's other - // methods to create subsequent snapshots. - // - // A committed snapshot will be created under name with the parent of the - // active snapshot. - // - // Commit may be called multiple times on the same key. Snapshots created - // in this manner will all reference the parent used to start the - // transaction. - Commit(ctx context.Context, name, key string) error - - // Remove the committed or active snapshot by the provided key. - // - // All resources associated with the key will be removed. - // - // If the snapshot is a parent of another snapshot, its children must be - // removed before proceeding. - Remove(ctx context.Context, key string) error - - // Walk all snapshots in the snapshotter. For each snapshot in the - // snapshotter, the function will be called. - Walk(ctx context.Context, fn func(context.Context, Info) error) error -} diff --git a/vendor/github.com/containerd/containerd/vendor.conf b/vendor/github.com/containerd/containerd/vendor.conf index 0d06aff284..cf83911655 100644 --- a/vendor/github.com/containerd/containerd/vendor.conf +++ b/vendor/github.com/containerd/containerd/vendor.conf @@ -25,11 +25,10 @@ github.com/urfave/cli 8ba6f23b6e36d03666a14bd9421f5e3efcb59aca golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6 google.golang.org/grpc v1.3.0 github.com/pkg/errors v0.8.0 -github.com/nightlyone/lockfile 1d49c987357a327b5b03aa84cbddd582c328615d github.com/opencontainers/go-digest 21dfd564fd89c944783d00d069f33e3e7123c448 golang.org/x/sys f3918c30c5c2cb527c0b071a27c35120a6c0719a -github.com/opencontainers/image-spec v1.0.0-rc5 -github.com/containerd/continuity f4ad4294c92f596c9241947c416d1297f9faf3ea +github.com/opencontainers/image-spec 372ad780f63454fbbbbcc7cf80e5b90245c13e13 +github.com/containerd/continuity 86cec1535a968310e7532819f699ff2830ed7463 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/BurntSushi/toml v0.2.0-21-g9906417 github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0 diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux.go index 794439af5f..cd18136343 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_linux.go @@ -7,6 +7,9 @@ import "syscall" // $ GOOS=linux GOARCH=amd64 ./generate.sh xattr // $ GOOS=linux GOARCH=arm ./generate.sh xattr // $ GOOS=linux GOARCH=arm64 ./generate.sh xattr +// $ GOOS=linux GOARCH=ppc64 ./generate.sh xattr +// $ GOOS=linux GOARCH=ppc64le ./generate.sh xattr +// $ GOOS=linux GOARCH=s390x ./generate.sh xattr // Listxattr calls syscall listxattr and reads all content // and returns a string array diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go index 33385d70a9..dec46faaaf 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go @@ -1,19 +1,111 @@ +// mksyscall.pl xattr_linux.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + package sysx -import "github.com/pkg/errors" +import ( + "syscall" + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func llistxattr(path string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "llistxattr not implemented on ppc64") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + use(unsafe.Pointer(_p0)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lremovexattr(path string, attr string) (err error) { - return errors.Wrap(ErrNotSupported, "lremovexattr not implemented on ppc64") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - return errors.Wrap(ErrNotSupported, "lsetxattr not implemented on ppc64") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "lgetxattr not implemented on ppc64") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go index dc65a72fdf..dec46faaaf 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go @@ -1,19 +1,111 @@ +// mksyscall.pl xattr_linux.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + package sysx -import "github.com/pkg/errors" +import ( + "syscall" + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func llistxattr(path string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "llistxattr not implemented on ppc64le") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + use(unsafe.Pointer(_p0)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lremovexattr(path string, attr string) (err error) { - return errors.Wrap(ErrNotSupported, "lremovexattr not implemented on ppc64le") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - return errors.Wrap(ErrNotSupported, "lsetxattr not implemented on ppc64le") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "lgetxattr not implemented on ppc64le") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go index 0af2b2c27e..dec46faaaf 100644 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go +++ b/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go @@ -1,19 +1,111 @@ +// mksyscall.pl xattr_linux.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + package sysx -import "github.com/pkg/errors" +import ( + "syscall" + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func llistxattr(path string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "llistxattr not implemented on s390x") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(dest) > 0 { + _p1 = unsafe.Pointer(&dest[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) + use(unsafe.Pointer(_p0)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lremovexattr(path string, attr string) (err error) { - return errors.Wrap(ErrNotSupported, "lremovexattr not implemented on s390x") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - return errors.Wrap(ErrNotSupported, "lsetxattr not implemented on s390x") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(data) > 0 { + _p2 = unsafe.Pointer(&data[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + if e1 != 0 { + err = errnoErr(e1) + } + return } +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - return 0, errors.Wrap(ErrNotSupported, "lgetxattr not implemented on s390x") + var _p0 *byte + _p0, err = syscall.BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(attr) + if err != nil { + return + } + var _p2 unsafe.Pointer + if len(dest) > 0 { + _p2 = unsafe.Pointer(&dest[0]) + } else { + _p2 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) + use(unsafe.Pointer(_p0)) + use(unsafe.Pointer(_p1)) + sz = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return } diff --git a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go b/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go index 46c765a96e..ae15941446 100644 --- a/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/empty/empty.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: github.com/golang/protobuf/ptypes/empty/empty.proto -// DO NOT EDIT! /* Package empty is a generated protocol buffer package. @@ -55,15 +54,15 @@ func init() { } var fileDescriptor0 = []byte{ - // 150 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, + // 147 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc, 0x4b, 0xd7, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x28, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x4f, 0xcd, 0x2d, 0x28, 0xa9, 0x84, 0x90, 0x7a, 0x60, 0x39, 0x21, 0xfe, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, - 0x3d, 0x98, 0x4a, 0x25, 0x76, 0x2e, 0x56, 0x57, 0x90, 0xbc, 0x53, 0x25, 0x97, 0x70, 0x72, 0x7e, + 0x3d, 0x98, 0x4a, 0x25, 0x76, 0x2e, 0x56, 0x57, 0x90, 0xbc, 0x53, 0x19, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36, 0x00, 0xc4, 0x0d, 0x60, 0x8c, 0x52, 0x27, 0xd2, - 0xce, 0x05, 0x8c, 0x8c, 0x3f, 0x18, 0x19, 0x17, 0x31, 0x31, 0xbb, 0x07, 0x38, 0xad, 0x62, 0x92, - 0x73, 0x87, 0x18, 0x1a, 0x00, 0x55, 0xaa, 0x17, 0x9e, 0x9a, 0x93, 0xe3, 0x9d, 0x97, 0x5f, 0x9e, - 0x17, 0x02, 0xd2, 0x92, 0xc4, 0x06, 0x36, 0xc3, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xbb, - 0xf4, 0x0e, 0xd2, 0x00, 0x00, 0x00, + 0xce, 0x1f, 0x8c, 0x8c, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c, 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x4c, + 0x0c, 0x80, 0xaa, 0xd3, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce, 0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0xa9, + 0x4f, 0x62, 0x03, 0x1b, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x8e, 0x0a, 0x06, 0xcf, + 0x00, 0x00, 0x00, } diff --git a/vendor/github.com/golang/protobuf/ptypes/empty/empty.proto b/vendor/github.com/golang/protobuf/ptypes/empty/empty.proto index 37f4cd10ee..03cacd2330 100644 --- a/vendor/github.com/golang/protobuf/ptypes/empty/empty.proto +++ b/vendor/github.com/golang/protobuf/ptypes/empty/empty.proto @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/empty"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; option cc_enable_arenas = true; diff --git a/vendor/github.com/nightlyone/lockfile/LICENSE b/vendor/github.com/nightlyone/lockfile/LICENSE deleted file mode 100644 index eb5b804685..0000000000 --- a/vendor/github.com/nightlyone/lockfile/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Ingo Oeser - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/nightlyone/lockfile/README.md b/vendor/github.com/nightlyone/lockfile/README.md deleted file mode 100644 index 54ee19cc41..0000000000 --- a/vendor/github.com/nightlyone/lockfile/README.md +++ /dev/null @@ -1,52 +0,0 @@ -lockfile -========= -Handle locking via pid files. - -[![Build Status Unix][1]][2] -[![Build status Windows][3]][4] - -[1]: https://secure.travis-ci.org/nightlyone/lockfile.png -[2]: https://travis-ci.org/nightlyone/lockfile -[3]: https://ci.appveyor.com/api/projects/status/7mojkmauj81uvp8u/branch/master?svg=true -[4]: https://ci.appveyor.com/project/nightlyone/lockfile/branch/master - - - -install -------- -Install [Go 1][5], either [from source][6] or [with a prepackaged binary][7]. -For Windows suport, Go 1.4 or newer is required. - -Then run - - go get github.com/nightlyone/lockfile - -[5]: http://golang.org -[6]: http://golang.org/doc/install/source -[7]: http://golang.org/doc/install - -LICENSE -------- -BSD - -documentation -------------- -[package documentation at godoc.org](http://godoc.org/github.com/nightlyone/lockfile) - -install -------------------- - go get github.com/nightlyone/lockfile - - -contributing -============ - -Contributions are welcome. Please open an issue or send me a pull request for a dedicated branch. -Make sure the git commit hooks show it works. - -git commit hooks ------------------------ -enable commit hooks via - - cd .git ; rm -rf hooks; ln -s ../git-hooks hooks ; cd .. - diff --git a/vendor/github.com/nightlyone/lockfile/lockfile.go b/vendor/github.com/nightlyone/lockfile/lockfile.go deleted file mode 100644 index da00bec786..0000000000 --- a/vendor/github.com/nightlyone/lockfile/lockfile.go +++ /dev/null @@ -1,201 +0,0 @@ -// Package lockfile handles pid file based locking. -// While a sync.Mutex helps against concurrency issues within a single process, -// this package is designed to help against concurrency issues between cooperating processes -// or serializing multiple invocations of the same process. You can also combine sync.Mutex -// with Lockfile in order to serialize an action between different goroutines in a single program -// and also multiple invocations of this program. -package lockfile - -import ( - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" -) - -// Lockfile is a pid file which can be locked -type Lockfile string - -// TemporaryError is a type of error where a retry after a random amount of sleep should help to mitigate it. -type TemporaryError string - -func (t TemporaryError) Error() string { return string(t) } - -// Temporary returns always true. -// It exists, so you can detect it via -// if te, ok := err.(interface{ Temporary() bool }); ok { -// fmt.Println("I am a temporay error situation, so wait and retry") -// } -func (t TemporaryError) Temporary() bool { return true } - -// Various errors returned by this package -var ( - ErrBusy = TemporaryError("Locked by other process") // If you get this, retry after a short sleep might help - ErrNotExist = TemporaryError("Lockfile created, but doesn't exist") // If you get this, retry after a short sleep might help - ErrNeedAbsPath = errors.New("Lockfiles must be given as absolute path names") - ErrInvalidPid = errors.New("Lockfile contains invalid pid for system") - ErrDeadOwner = errors.New("Lockfile contains pid of process not existent on this system anymore") - ErrRogueDeletion = errors.New("Lockfile owned by me has been removed unexpectedly") -) - -// New describes a new filename located at the given absolute path. -func New(path string) (Lockfile, error) { - if !filepath.IsAbs(path) { - return Lockfile(""), ErrNeedAbsPath - } - return Lockfile(path), nil -} - -// GetOwner returns who owns the lockfile. -func (l Lockfile) GetOwner() (*os.Process, error) { - name := string(l) - - // Ok, see, if we have a stale lockfile here - content, err := ioutil.ReadFile(name) - if err != nil { - return nil, err - } - - // try hard for pids. If no pid, the lockfile is junk anyway and we delete it. - pid, err := scanPidLine(content) - if err != nil { - return nil, err - } - running, err := isRunning(pid) - if err != nil { - return nil, err - } - - if running { - proc, err := os.FindProcess(pid) - if err != nil { - return nil, err - } - return proc, nil - } - return nil, ErrDeadOwner - -} - -// TryLock tries to own the lock. -// It Returns nil, if successful and and error describing the reason, it didn't work out. -// Please note, that existing lockfiles containing pids of dead processes -// and lockfiles containing no pid at all are simply deleted. -func (l Lockfile) TryLock() error { - name := string(l) - - // This has been checked by New already. If we trigger here, - // the caller didn't use New and re-implemented it's functionality badly. - // So panic, that he might find this easily during testing. - if !filepath.IsAbs(name) { - panic(ErrNeedAbsPath) - } - - tmplock, err := ioutil.TempFile(filepath.Dir(name), "") - if err != nil { - return err - } - - cleanup := func() { - _ = tmplock.Close() - _ = os.Remove(tmplock.Name()) - } - defer cleanup() - - if err := writePidLine(tmplock, os.Getpid()); err != nil { - return err - } - - // return value intentionally ignored, as ignoring it is part of the algorithm - _ = os.Link(tmplock.Name(), name) - - fiTmp, err := os.Lstat(tmplock.Name()) - if err != nil { - return err - } - fiLock, err := os.Lstat(name) - if err != nil { - // tell user that a retry would be a good idea - if os.IsNotExist(err) { - return ErrNotExist - } - return err - } - - // Success - if os.SameFile(fiTmp, fiLock) { - return nil - } - - proc, err := l.GetOwner() - switch err { - default: - // Other errors -> defensively fail and let caller handle this - return err - case nil: - if proc.Pid != os.Getpid() { - return ErrBusy - } - case ErrDeadOwner, ErrInvalidPid: - // cases we can fix below - } - - // clean stale/invalid lockfile - err = os.Remove(name) - if err != nil { - // If it doesn't exist, then it doesn't matter who removed it. - if !os.IsNotExist(err) { - return err - } - } - - // now that the stale lockfile is gone, let's recurse - return l.TryLock() -} - -// Unlock a lock again, if we owned it. Returns any error that happend during release of lock. -func (l Lockfile) Unlock() error { - proc, err := l.GetOwner() - switch err { - case ErrInvalidPid, ErrDeadOwner: - return ErrRogueDeletion - case nil: - if proc.Pid == os.Getpid() { - // we really own it, so let's remove it. - return os.Remove(string(l)) - } - // Not owned by me, so don't delete it. - return ErrRogueDeletion - default: - // This is an application error or system error. - // So give a better error for logging here. - if os.IsNotExist(err) { - return ErrRogueDeletion - } - // Other errors -> defensively fail and let caller handle this - return err - } -} - -func writePidLine(w io.Writer, pid int) error { - _, err := io.WriteString(w, fmt.Sprintf("%d\n", pid)) - return err -} - -func scanPidLine(content []byte) (int, error) { - if len(content) == 0 { - return 0, ErrInvalidPid - } - - var pid int - if _, err := fmt.Sscanln(string(content), &pid); err != nil { - return 0, ErrInvalidPid - } - - if pid <= 0 { - return 0, ErrInvalidPid - } - return pid, nil -} diff --git a/vendor/github.com/nightlyone/lockfile/lockfile_unix.go b/vendor/github.com/nightlyone/lockfile/lockfile_unix.go deleted file mode 100644 index 742b041fb6..0000000000 --- a/vendor/github.com/nightlyone/lockfile/lockfile_unix.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris - -package lockfile - -import ( - "os" - "syscall" -) - -func isRunning(pid int) (bool, error) { - proc, err := os.FindProcess(pid) - if err != nil { - return false, err - } - - if err := proc.Signal(syscall.Signal(0)); err != nil { - return false, nil - } - return true, nil -} diff --git a/vendor/github.com/nightlyone/lockfile/lockfile_windows.go b/vendor/github.com/nightlyone/lockfile/lockfile_windows.go deleted file mode 100644 index 482bd91d7b..0000000000 --- a/vendor/github.com/nightlyone/lockfile/lockfile_windows.go +++ /dev/null @@ -1,30 +0,0 @@ -package lockfile - -import ( - "syscall" -) - -//For some reason these consts don't exist in syscall. -const ( - error_invalid_parameter = 87 - code_still_active = 259 -) - -func isRunning(pid int) (bool, error) { - procHnd, err := syscall.OpenProcess(syscall.PROCESS_QUERY_INFORMATION, true, uint32(pid)) - if err != nil { - if scerr, ok := err.(syscall.Errno); ok { - if uintptr(scerr) == error_invalid_parameter { - return false, nil - } - } - } - - var code uint32 - err = syscall.GetExitCodeProcess(procHnd, &code) - if err != nil { - return false, err - } - - return code == code_still_active, nil -} From 39b778a7cc0d7f0bc1ddac544fc9adbceb9bab87 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 15 Jun 2017 14:44:19 +0100 Subject: [PATCH 02/35] Update to OCI image-spec f03dbe35d449c54915d235f1a3cf8f585a24babe This is v1.0.0-rc6-12-g372ad78 and corresponds to what the vendored containerd is using. Signed-off-by: Ian Campbell --- vendor.conf | 2 +- .../image-spec/specs-go/v1/annotations.go | 56 +++++++++++++++++++ .../image-spec/specs-go/v1/descriptor.go | 8 +-- .../image-spec/specs-go/version.go | 2 +- 4 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go diff --git a/vendor.conf b/vendor.conf index 2558fb6965..449bd194f3 100644 --- a/vendor.conf +++ b/vendor.conf @@ -28,7 +28,7 @@ github.com/docker/libnetwork 37e20af882e13dd01ade3658b7aabdae3412118b github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a github.com/opencontainers/runc b6b70e53451794e8333e9b602cc096b47a20bd0f github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb -github.com/opencontainers/image-spec f03dbe35d449c54915d235f1a3cf8f585a24babe +github.com/opencontainers/image-spec 372ad780f63454fbbbbcc7cf80e5b90245c13e13 # containerd executor github.com/containerd/containerd 7e3b7dead60d96e9a7b13b8813d1712c7761e327 diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go new file mode 100644 index 0000000000..35d8108958 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/annotations.go @@ -0,0 +1,56 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package v1 + +const ( + // AnnotationCreated is the annotation key for the date and time on which the image was built (date-time string as defined by RFC 3339). + AnnotationCreated = "org.opencontainers.image.created" + + // AnnotationAuthors is the annotation key for the contact details of the people or organization responsible for the image (freeform string). + AnnotationAuthors = "org.opencontainers.image.authors" + + // AnnotationURL is the annotation key for the URL to find more information on the image. + AnnotationURL = "org.opencontainers.image.url" + + // AnnotationDocumentation is the annotation key for the URL to get documentation on the image. + AnnotationDocumentation = "org.opencontainers.image.documentation" + + // AnnotationSource is the annotation key for the URL to get source code for building the image. + AnnotationSource = "org.opencontainers.image.source" + + // AnnotationVersion is the annotation key for the version of the packaged software. + // The version MAY match a label or tag in the source code repository. + // The version MAY be Semantic versioning-compatible. + AnnotationVersion = "org.opencontainers.image.version" + + // AnnotationRevision is the annotation key for the source control revision identifier for the packaged software. + AnnotationRevision = "org.opencontainers.image.revision" + + // AnnotationVendor is the annotation key for the name of the distributing entity, organization or individual. + AnnotationVendor = "org.opencontainers.image.vendor" + + // AnnotationLicenses is the annotation key for the license(s) under which contained software is distributed as an SPDX License Expression. + AnnotationLicenses = "org.opencontainers.image.licenses" + + // AnnotationRefName is the annotation key for the name of the reference for a target. + // SHOULD only be considered valid when on descriptors on `index.json` within image layout. + AnnotationRefName = "org.opencontainers.image.ref.name" + + // AnnotationTitle is the annotation key for the human-readable title of the image. + AnnotationTitle = "org.opencontainers.image.title" + + // AnnotationDescription is the annotation key for the human-readable description of the software packaged in the image. + AnnotationDescription = "org.opencontainers.image.description" +) diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go index c461647ef0..6e442a0853 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go @@ -51,7 +51,7 @@ type Platform struct { OS string `json:"os"` // OSVersion is an optional field specifying the operating system - // version, for example `10.0.10586`. + // version, for example on Windows `10.0.14393.1066`. OSVersion string `json:"os.version,omitempty"` // OSFeatures is an optional field specifying an array of strings, @@ -59,10 +59,6 @@ type Platform struct { OSFeatures []string `json:"os.features,omitempty"` // Variant is an optional field specifying a variant of the CPU, for - // example `ppc64le` to specify a little-endian version of a PowerPC CPU. + // example `v7` to specify ARMv7 when architecture is `arm`. Variant string `json:"variant,omitempty"` - - // Features is an optional field specifying an array of strings, each - // listing a required CPU feature (for example `sse4` or `aes`). - Features []string `json:"features,omitempty"` } diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/version.go b/vendor/github.com/opencontainers/image-spec/specs-go/version.go index 0e7d3be29b..f4cda6ed8d 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/version.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/version.go @@ -25,7 +25,7 @@ const ( VersionPatch = 0 // VersionDev indicates development branch. Releases will be empty string. - VersionDev = "-rc5-dev" + VersionDev = "-rc6-dev" ) // Version is the specification version that the package types support. From 543daf106d9d01163c3afa6ae39110d4e66a78d8 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 19 Jun 2017 16:45:08 +0100 Subject: [PATCH 03/35] containerd: Fix a typo in a comment. Signed-off-by: Ian Campbell --- agent/exec/containerd/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index a427f78f92..f9c71c9e82 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -147,7 +147,7 @@ func (r *controller) Start(ctx context.Context) error { return errors.Wrap(err, "starting container failed") } - // TODO(ijc): Wait for HealtCheck to report OK. + // TODO(ijc): Wait for HealthCheck to report OK. return nil } From 522e4b8fc8fefaa96476fc7afe4080eb3baae937 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 11 May 2017 22:29:31 +0100 Subject: [PATCH 04/35] containerd: Implement ContainerStatuser Signed-off-by: Ian Campbell --- agent/exec/containerd/controller.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index f9c71c9e82..401ed246f2 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -38,6 +38,34 @@ func newController(conn *grpc.ClientConn, containerDir string, task *api.Task, s }, nil } +// ContainerStatus returns the container-specific status for the task. +func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus, error) { + ctnr, err := r.adapter.inspect(ctx) + if err != nil { + if isUnknownContainer(err) { + return nil, nil + } + + return nil, err + } + + status := &api.ContainerStatus{ + ContainerID: ctnr.ID, + PID: int32(ctnr.Pid), + } + + switch ctnr.Status { + case task.StatusStopped: + exitStatus, err := r.adapter.shutdown(ctx) + if err != nil { + return nil, err + } + status.ExitCode = int32(exitStatus) + } + + return status, err +} + // Update takes a recent task update and applies it to the container. func (r *controller) Update(ctx context.Context, t *api.Task) error { log.G(ctx).Warnf("task updates not yet supported") From 66d0b33e3ee4ecbe75438c19811a4ed29775f3fb Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 16 Jun 2017 14:14:00 +0100 Subject: [PATCH 05/35] containerd: Rename containerAdapter.container -> spec The containerd client library contains a containerd.Container which will be a more appropriate use of the name. The existing spec function is renamed makeSpec() but after the switch to the client library the function becomes so simple it can be inlined into create. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 2d7b930865..2135b66d7c 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -64,7 +64,7 @@ var ( type containerAdapter struct { conn *grpc.ClientConn taskClient execution.TasksClient - container *api.ContainerSpec + spec *api.ContainerSpec task *api.Task secrets exec.SecretGetter dir string @@ -77,8 +77,8 @@ func withNamespace(ctx context.Context) context.Context { } func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { - container := task.Spec.GetContainer() - if container == nil { + spec := task.Spec.GetContainer() + if spec == nil { return nil, exec.ErrRuntimeUnsupported } @@ -87,7 +87,7 @@ func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.T return &containerAdapter{ conn: conn, taskClient: execution.NewTasksClient(conn), - container: container, + spec: spec, task: task, secrets: secrets, dir: dir, @@ -178,7 +178,7 @@ func (c *containerAdapter) pullImage(ctx context.Context) error { resolver := docker.NewResolver(options) - name, desc, err := resolver.Resolve(ctx, c.container.Image) + name, desc, err := resolver.Resolve(ctx, c.spec.Image) if err != nil { return errors.Wrap(err, "failed to resolve ref") } @@ -335,7 +335,7 @@ func (c *containerAdapter) setMounts(ctx context.Context, s *specs.Spec, mounts return nil } -func (c *containerAdapter) spec(ctx context.Context, config *ocispec.ImageConfig, rootfs string) (*specs.Spec, error) { +func (c *containerAdapter) makeSpec(ctx context.Context, config *ocispec.ImageConfig, rootfs string) (*specs.Spec, error) { caps := []string{ "CAP_CHOWN", "CAP_DAC_OVERRIDE", @@ -430,20 +430,20 @@ func (c *containerAdapter) spec(ctx context.Context, config *ocispec.ImageConfig spec.Process.Env = config.Env var args []string - if len(c.container.Args) > 0 { - args = c.container.Args + if len(c.spec.Args) > 0 { + args = c.spec.Args } else { args = config.Cmd } - if len(c.container.Command) > 0 { - spec.Process.Args = append(c.container.Command, args...) + if len(c.spec.Command) > 0 { + spec.Process.Args = append(c.spec.Command, args...) } else { spec.Process.Args = append(config.Entrypoint, args...) } log.G(ctx).Debugf("Process args: %v", spec.Process.Args) - if err := c.setMounts(ctx, &spec, c.container.Mounts, config.Volumes); err != nil { + if err := c.setMounts(ctx, &spec, c.spec.Mounts, config.Volumes); err != nil { return nil, errors.Wrap(err, "failed to set mounts") } sort.Sort(mounts(spec.Mounts)) @@ -504,7 +504,7 @@ func (c *containerAdapter) create(ctx context.Context) error { } } - spec, err := c.spec(ctx, &config.Config, rootfs) + spec, err := c.makeSpec(ctx, &config.Config, rootfs) if err != nil { return err } From b142570b7f2749224f80b577894f78597e47bf69 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 16 Jun 2017 14:28:22 +0100 Subject: [PATCH 06/35] containerd: Drop c.task, it is only used for naming, so store the name instead The containerd client library contains a containerd.Task which will be a more appropriate use of the name. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 33 +++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 2135b66d7c..0e5da23cc5 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -65,9 +65,9 @@ type containerAdapter struct { conn *grpc.ClientConn taskClient execution.TasksClient spec *api.ContainerSpec - task *api.Task secrets exec.SecretGetter dir string + name string resolvedImageName string deleteResponse *execution.DeleteResponse } @@ -88,9 +88,9 @@ func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.T conn: conn, taskClient: execution.NewTasksClient(conn), spec: spec, - task: task, secrets: secrets, dir: dir, + name: naming.Task(task), }, nil } @@ -519,10 +519,9 @@ func (c *containerAdapter) create(ctx context.Context) error { return err } - cid := naming.Task(c.task) _, err = containers.Create(ctx, &containersapi.CreateContainerRequest{ Container: containersapi.Container{ - ID: cid, + ID: c.name, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: data, @@ -535,7 +534,7 @@ func (c *containerAdapter) create(ctx context.Context) error { } _, err = c.taskClient.Create(ctx, &execution.CreateRequest{ - ContainerID: cid, + ContainerID: c.name, Rootfs: []*mount.Mount{}, Stdin: stdin, Stdout: stdout, @@ -552,7 +551,7 @@ func (c *containerAdapter) create(ctx context.Context) error { func (c *containerAdapter) start(ctx context.Context) error { ctx = withNamespace(ctx) _, err := c.taskClient.Start(ctx, &execution.StartRequest{ - ContainerID: naming.Task(c.task), + ContainerID: c.name, }) return err } @@ -575,10 +574,8 @@ func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan t func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) (<-chan task.Event, <-chan struct{}, error) { ctx = withNamespace(ctx) - id := naming.Task(c.task) - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": id, + "ID": c.name, }) // TODO(stevvooe): Move this to a single, global event dispatch. For @@ -605,7 +602,7 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) l.WithError(err).Error("fatal error from events stream") return } - if evt.ID != id { + if evt.ID != c.name { l.Debugf("Event for a different container %s", evt.ID) continue } @@ -624,8 +621,7 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { ctx = withNamespace(ctx) - id := naming.Task(c.task) - rsp, err := c.taskClient.Info(ctx, &execution.InfoRequest{ContainerID: id}) + rsp, err := c.taskClient.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) if err != nil { return task.Task{}, err } @@ -635,16 +631,15 @@ func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { ctx = withNamespace(ctx) - id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ - "ID": id, + "ID": c.name, }) if c.deleteResponse == nil { var err error l.Debug("Deleting") - rsp, err := c.taskClient.Delete(ctx, &execution.DeleteRequest{ContainerID: id}) + rsp, err := c.taskClient.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) if err != nil { return 0, err } @@ -653,7 +648,7 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { containers := containersapi.NewContainersClient(c.conn) _, err = containers.Delete(ctx, &containersapi.DeleteContainerRequest{ - ID: id, + ID: c.name, }) if err != nil { l.WithError(err).Warnf("failed to delete container") @@ -666,9 +661,8 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { func (c *containerAdapter) terminate(ctx context.Context) error { ctx = withNamespace(ctx) - id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ - "ID": id, + "ID": c.name, }) l.Debug("Terminate") return errors.New("terminate not implemented") @@ -677,9 +671,8 @@ func (c *containerAdapter) terminate(ctx context.Context) error { func (c *containerAdapter) remove(ctx context.Context) error { ctx = withNamespace(ctx) - id := naming.Task(c.task) l := log.G(ctx).WithFields(logrus.Fields{ - "ID": id, + "ID": c.name, }) l.Debug("Remove") return os.RemoveAll(c.dir) From 1b2aa1418bc614ced66b5110371564ef84c3be33 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 6 Jun 2017 17:30:29 +0100 Subject: [PATCH 07/35] containerd: Port to containerd client library. This simplifies a bunch of stuff, with more potential improvements yet to come. Hardcodes the default namespace for now. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 165 +- agent/exec/containerd/controller.go | 5 +- agent/exec/containerd/executor.go | 37 +- .../containerd/api/services/diff/diff.pb.go | 1111 ++++++++ .../containerd/api/services/diff/diff.proto | 58 + .../api/services/namespaces/namespace.pb.go | 2008 ++++++++++++++ .../api/services/namespaces/namespace.proto | 88 + .../api/services/snapshot/snapshots.pb.go | 2379 +++++++++++++++++ .../api/services/snapshot/snapshots.proto | 81 + .../api/services/version/version.pb.go | 465 ++++ .../api/services/version/version.proto | 15 + .../containerd/containerd/client.go | 486 ++++ .../containerd/containerd/client_unix.go | 19 + .../containerd/containerd/client_windows.go | 16 + .../containerd/containerd/container.go | 222 ++ .../containerd/containerd/container_unix.go | 115 + .../github.com/containerd/containerd/grpc.go | 35 + .../github.com/containerd/containerd/image.go | 76 + vendor/github.com/containerd/containerd/io.go | 140 + .../containerd/containerd/io_unix.go | 71 + .../containerd/containerd/io_windows.go | 93 + .../containerd/containerd/process.go | 124 + .../remotes/docker/schema1/converter.go | 449 ++++ .../containerd/containerd/rootfs/apply.go | 84 + .../containerd/containerd/rootfs/diff.go | 52 + .../containerd/containerd/rootfs/init.go | 99 + .../containerd/rootfs/init_linux.go | 114 + .../containerd/rootfs/init_other.go | 7 + .../containerd/services/diff/client.go | 82 + .../containerd/services/diff/service.go | 81 + .../containerd/services/snapshot/client.go | 158 ++ .../containerd/services/snapshot/service.go | 212 ++ .../containerd/containerd/snapshot/errors.go | 44 + .../containerd/snapshot/snapshotter.go | 238 ++ .../github.com/containerd/containerd/spec.go | 27 + .../containerd/containerd/spec_unix.go | 274 ++ .../containerd/containerd/spec_windows.go | 94 + .../github.com/containerd/containerd/task.go | 335 +++ .../image-spec/identity/chainid.go | 67 + .../image-spec/identity/helpers.go | 40 + .../grpc/health/grpc_health_v1/health.pb.go | 176 ++ .../grpc/health/grpc_health_v1/health.proto | 20 + 42 files changed, 10310 insertions(+), 152 deletions(-) create mode 100644 vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/services/diff/diff.proto create mode 100644 vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto create mode 100644 vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto create mode 100644 vendor/github.com/containerd/containerd/api/services/version/version.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/services/version/version.proto create mode 100644 vendor/github.com/containerd/containerd/client.go create mode 100644 vendor/github.com/containerd/containerd/client_unix.go create mode 100644 vendor/github.com/containerd/containerd/client_windows.go create mode 100644 vendor/github.com/containerd/containerd/container.go create mode 100644 vendor/github.com/containerd/containerd/container_unix.go create mode 100644 vendor/github.com/containerd/containerd/grpc.go create mode 100644 vendor/github.com/containerd/containerd/image.go create mode 100644 vendor/github.com/containerd/containerd/io.go create mode 100644 vendor/github.com/containerd/containerd/io_unix.go create mode 100644 vendor/github.com/containerd/containerd/io_windows.go create mode 100644 vendor/github.com/containerd/containerd/process.go create mode 100644 vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go create mode 100644 vendor/github.com/containerd/containerd/rootfs/apply.go create mode 100644 vendor/github.com/containerd/containerd/rootfs/diff.go create mode 100644 vendor/github.com/containerd/containerd/rootfs/init.go create mode 100644 vendor/github.com/containerd/containerd/rootfs/init_linux.go create mode 100644 vendor/github.com/containerd/containerd/rootfs/init_other.go create mode 100644 vendor/github.com/containerd/containerd/services/diff/client.go create mode 100644 vendor/github.com/containerd/containerd/services/diff/service.go create mode 100644 vendor/github.com/containerd/containerd/services/snapshot/client.go create mode 100644 vendor/github.com/containerd/containerd/services/snapshot/service.go create mode 100644 vendor/github.com/containerd/containerd/snapshot/errors.go create mode 100644 vendor/github.com/containerd/containerd/snapshot/snapshotter.go create mode 100644 vendor/github.com/containerd/containerd/spec.go create mode 100644 vendor/github.com/containerd/containerd/spec_unix.go create mode 100644 vendor/github.com/containerd/containerd/spec_windows.go create mode 100644 vendor/github.com/containerd/containerd/task.go create mode 100644 vendor/github.com/opencontainers/image-spec/identity/chainid.go create mode 100644 vendor/github.com/opencontainers/image-spec/identity/helpers.go create mode 100644 vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go create mode 100644 vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 0e5da23cc5..ff1fe4e97e 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -1,12 +1,9 @@ package containerd import ( - "crypto/tls" "encoding/json" "fmt" "io" - "net" - "net/http" "os" "path/filepath" "runtime" @@ -14,31 +11,21 @@ import ( "strings" "sync" "syscall" - "time" "github.com/Sirupsen/logrus" + "github.com/containerd/containerd" containersapi "github.com/containerd/containerd/api/services/containers" - contentapi "github.com/containerd/containerd/api/services/content" "github.com/containerd/containerd/api/services/execution" - imagesapi "github.com/containerd/containerd/api/services/images" - "github.com/containerd/containerd/api/types/mount" "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/archive" "github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/content" - "github.com/containerd/containerd/images" - "github.com/containerd/containerd/namespaces" - "github.com/containerd/containerd/remotes" - "github.com/containerd/containerd/remotes/docker" - contentservice "github.com/containerd/containerd/services/content" - imagesservice "github.com/containerd/containerd/services/images" "github.com/containerd/fifo" dockermount "github.com/docker/docker/pkg/mount" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/api/naming" "github.com/docker/swarmkit/log" - protobuf "github.com/gogo/protobuf/types" "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/runtime-spec/specs-go" @@ -62,21 +49,18 @@ var ( // are mostly naked calls to the client API, seeded with information from // containerConfig. type containerAdapter struct { - conn *grpc.ClientConn - taskClient execution.TasksClient - spec *api.ContainerSpec - secrets exec.SecretGetter - dir string - name string - resolvedImageName string - deleteResponse *execution.DeleteResponse + client *containerd.Client + spec *api.ContainerSpec + secrets exec.SecretGetter + dir string + name string + image containerd.Image // Pulled image + container containerd.Container + task containerd.Task + deleteResponse *execution.DeleteResponse } -func withNamespace(ctx context.Context) context.Context { - return namespaces.WithNamespace(ctx, "default") -} - -func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { +func newContainerAdapter(client *containerd.Client, containerDir string, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { spec := task.Spec.GetContainer() if spec == nil { return nil, exec.ErrRuntimeUnsupported @@ -85,12 +69,11 @@ func newContainerAdapter(conn *grpc.ClientConn, containerDir string, task *api.T dir := filepath.Join(containerDir, task.ID) return &containerAdapter{ - conn: conn, - taskClient: execution.NewTasksClient(conn), - spec: spec, - secrets: secrets, - dir: dir, - name: naming.Task(task), + client: client, + spec: spec, + secrets: secrets, + dir: dir, + name: naming.Task(task), }, nil } @@ -154,52 +137,13 @@ func prepareStdio(stdout, stderr string, console bool) (wg *sync.WaitGroup, err } func (c *containerAdapter) pullImage(ctx context.Context) error { - ctx = withNamespace(ctx) - - options := docker.ResolverOptions{} - - tr := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 10, - IdleConnTimeout: 30 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - TLSClientConfig: &tls.Config{}, - ExpectContinueTimeout: 5 * time.Second, - } - - options.Client = &http.Client{ - Transport: tr, - } - - resolver := docker.NewResolver(options) - - name, desc, err := resolver.Resolve(ctx, c.spec.Image) - if err != nil { - return errors.Wrap(err, "failed to resolve ref") - } - fetcher, err := resolver.Fetcher(ctx, name) + image, err := c.client.Pull(ctx, c.spec.Image) if err != nil { - return errors.Wrap(err, "failed to resolve fetcher") - } - c.resolvedImageName = name - - content := contentservice.NewStoreFromClient(contentapi.NewContentClient(c.conn)) - imageStore := imagesservice.NewStoreFromClient(imagesapi.NewImagesClient(c.conn)) - - if err := imageStore.Put(ctx, name, desc); err != nil { - return errors.Wrap(err, "put image") + return errors.Wrap(err, "pulling container image") } + c.image = image - return images.Dispatch(ctx, - images.Handlers( - remotes.FetchHandler(content, fetcher), - images.ChildrenHandler(content)), - desc) + return nil } func (c *containerAdapter) makeAnonVolume(ctx context.Context, target string) (specs.Mount, error) { @@ -452,17 +396,14 @@ func (c *containerAdapter) makeSpec(ctx context.Context, config *ocispec.ImageCo } func (c *containerAdapter) create(ctx context.Context) error { - ctx = withNamespace(ctx) - - if c.resolvedImageName == "" { + if c.image == nil { return errors.New("image has not been pulled") } - containers := containersapi.NewContainersClient(c.conn) - cs := contentservice.NewStoreFromClient(contentapi.NewContentClient(c.conn)) - imageStore := imagesservice.NewStoreFromClient(imagesapi.NewImagesClient(c.conn)) + cs := c.client.ContentStore() + imageStore := c.client.ImageService() - image, err := imageStore.Get(ctx, c.resolvedImageName) + image, err := imageStore.Get(ctx, c.image.Name()) if err != nil { return errors.Wrap(err, "image get") } @@ -514,33 +455,21 @@ func (c *containerAdapter) create(ctx context.Context) error { return err } - data, err := json.MarshalIndent(spec, " ", " ") + c.container, err = c.client.NewContainer(ctx, c.name, containerd.WithSpec(spec)) if err != nil { - return err + return errors.Wrap(err, "creating container") } - _, err = containers.Create(ctx, &containersapi.CreateContainerRequest{ - Container: containersapi.Container{ - ID: c.name, - Spec: &protobuf.Any{ - TypeUrl: specs.Version, - Value: data, - }, - Runtime: "io.containerd.runtime.v1.linux", - }, - }) - if err != nil { - return errors.Wrap(err, "creating container") + io := func() (*containerd.IO, error) { + return &containerd.IO{ + Stdin: stdin, + Stdout: stdout, + Stderr: stderr, + Terminal: spec.Process.Terminal, + }, nil } - _, err = c.taskClient.Create(ctx, &execution.CreateRequest{ - ContainerID: c.name, - Rootfs: []*mount.Mount{}, - Stdin: stdin, - Stdout: stdout, - Stderr: stderr, - Terminal: spec.Process.Terminal, - }) + c.task, err = c.container.NewTask(ctx, io) if err != nil { return errors.Wrap(err, "creating task") } @@ -549,8 +478,9 @@ func (c *containerAdapter) create(ctx context.Context) error { } func (c *containerAdapter) start(ctx context.Context) error { - ctx = withNamespace(ctx) - _, err := c.taskClient.Start(ctx, &execution.StartRequest{ + tasks := c.client.TaskService() + + _, err := tasks.Start(ctx, &execution.StartRequest{ ContainerID: c.name, }) return err @@ -572,8 +502,6 @@ func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan t // A chan struct{} is returned that will be closed if the event processing // fails and needs to be restarted. func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) (<-chan task.Event, <-chan struct{}, error) { - ctx = withNamespace(ctx) - l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -587,7 +515,8 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) l.Debugf("waiting on events") - cl, err := c.taskClient.Events(ctx, &execution.EventsRequest{}, opts...) + tasks := c.client.TaskService() + cl, err := tasks.Events(ctx, &execution.EventsRequest{}, opts...) if err != nil { l.WithError(err).Errorf("failed to start event stream") return nil, nil, err @@ -619,9 +548,8 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) } func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { - ctx = withNamespace(ctx) - - rsp, err := c.taskClient.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) + tasks := c.client.TaskService() + rsp, err := tasks.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) if err != nil { return task.Task{}, err } @@ -629,8 +557,6 @@ func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { } func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { - ctx = withNamespace(ctx) - l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -639,14 +565,15 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { var err error l.Debug("Deleting") - rsp, err := c.taskClient.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) + tasks := c.client.TaskService() + rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) if err != nil { return 0, err } l.Debugf("Status=%d", rsp.ExitStatus) c.deleteResponse = rsp - containers := containersapi.NewContainersClient(c.conn) + containers := c.client.ContainerService() _, err = containers.Delete(ctx, &containersapi.DeleteContainerRequest{ ID: c.name, }) @@ -659,8 +586,6 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { } func (c *containerAdapter) terminate(ctx context.Context) error { - ctx = withNamespace(ctx) - l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -669,8 +594,6 @@ func (c *containerAdapter) terminate(ctx context.Context) error { } func (c *containerAdapter) remove(ctx context.Context) error { - ctx = withNamespace(ctx) - l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 401ed246f2..759122e017 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -3,6 +3,7 @@ package containerd import ( "fmt" + "github.com/containerd/containerd" "github.com/containerd/containerd/api/types/task" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" @@ -25,8 +26,8 @@ type controller struct { var _ exec.Controller = &controller{} -func newController(conn *grpc.ClientConn, containerDir string, task *api.Task, secrets exec.SecretGetter) (exec.Controller, error) { - adapter, err := newContainerAdapter(conn, containerDir, task, secrets) +func newController(client *containerd.Client, containerDir string, task *api.Task, secrets exec.SecretGetter) (exec.Controller, error) { + adapter, err := newContainerAdapter(client, containerDir, task, secrets) if err != nil { return nil, err } diff --git a/agent/exec/containerd/executor.go b/agent/exec/containerd/executor.go index 32081f0e44..60b07e4b05 100644 --- a/agent/exec/containerd/executor.go +++ b/agent/exec/containerd/executor.go @@ -1,12 +1,11 @@ package containerd import ( - "net" "os" "path/filepath" "runtime" - "time" + "github.com/containerd/containerd" "github.com/docker/docker/pkg/sysinfo" "github.com/docker/docker/pkg/system" "github.com/docker/swarmkit/agent/exec" @@ -15,12 +14,10 @@ import ( "github.com/docker/swarmkit/log" "github.com/pkg/errors" "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/grpclog" ) type executor struct { - conn *grpc.ClientConn + client *containerd.Client secrets exec.SecretsManager genericResources []*api.GenericResource containerDir string @@ -28,37 +25,19 @@ type executor struct { var _ exec.Executor = &executor{} -func getGRPCConnection(ctx context.Context, sock string) (*grpc.ClientConn, error) { - grpclog.SetLogger(log.G(ctx)) - - dialOpts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(100 * time.Second)} - dialOpts = append(dialOpts, - grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) { - return net.DialTimeout("unix", sock, timeout) - }, - )) - - conn, err := grpc.Dial("unix://"+sock, dialOpts...) - if err != nil { - return nil, errors.Wrapf(err, "failed to dial %q", sock) - } - - return conn, nil -} - // NewExecutor returns an executor using the given containerd control socket func NewExecutor(sock, stateDir string, genericResources []*api.GenericResource) (exec.Executor, error) { - ctx := log.WithModule(context.Background(), "containerd") - - conn, err := getGRPCConnection(ctx, sock) + // TODO(ijc), configurable namespace. + // TODO(ijc), default to swarmd? + client, err := containerd.New(sock, containerd.WithDefaultNamespace("default")) if err != nil { - return nil, err + return nil, errors.Wrap(err, "creating containerd client") } containerDir := filepath.Join(stateDir, "containers") return &executor{ - conn: conn, + client: client, secrets: secrets.NewManager(), genericResources: genericResources, containerDir: containerDir, @@ -104,7 +83,7 @@ func (e *executor) Configure(ctx context.Context, node *api.Node) error { // Controller returns a docker container controller. func (e *executor) Controller(t *api.Task) (exec.Controller, error) { - ctlr, err := newController(e.conn, e.containerDir, t, secrets.Restrict(e.secrets, t)) + ctlr, err := newController(e.client, e.containerDir, t, secrets.Restrict(e.secrets, t)) if err != nil { return nil, err } diff --git a/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go b/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go new file mode 100644 index 0000000000..1891bac5e6 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go @@ -0,0 +1,1111 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/diff/diff.proto +// DO NOT EDIT! + +/* + Package diff is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/diff/diff.proto + + It has these top-level messages: + ApplyRequest + ApplyResponse + DiffRequest + DiffResponse +*/ +package diff + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/golang/protobuf/ptypes/empty" +import _ "github.com/gogo/protobuf/types" +import containerd_v1_types "github.com/containerd/containerd/api/types/mount" +import containerd_v1_types1 "github.com/containerd/containerd/api/types/descriptor" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type ApplyRequest struct { + // Diff is the descriptor of the diff to be extracted + Diff *containerd_v1_types1.Descriptor `protobuf:"bytes,1,opt,name=diff" json:"diff,omitempty"` + Mounts []*containerd_v1_types.Mount `protobuf:"bytes,2,rep,name=mounts" json:"mounts,omitempty"` +} + +func (m *ApplyRequest) Reset() { *m = ApplyRequest{} } +func (*ApplyRequest) ProtoMessage() {} +func (*ApplyRequest) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []int{0} } + +type ApplyResponse struct { + // Applied is the descriptor for the object which was applied. + // If the input was a compressed blob then the result will be + // the descriptor for the uncompressed blob. + Applied *containerd_v1_types1.Descriptor `protobuf:"bytes,1,opt,name=applied" json:"applied,omitempty"` +} + +func (m *ApplyResponse) Reset() { *m = ApplyResponse{} } +func (*ApplyResponse) ProtoMessage() {} +func (*ApplyResponse) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []int{1} } + +type DiffRequest struct { + // Left are the mounts which represent the older copy + // in which is the base of the computed changes. + Left []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=left" json:"left,omitempty"` + // Right are the mounts which represents the newer copy + // in which changes from the left were made into. + Right []*containerd_v1_types.Mount `protobuf:"bytes,2,rep,name=right" json:"right,omitempty"` + // MediaType is the media type descriptor for the created diff + // object + MediaType string `protobuf:"bytes,3,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"` + // Ref identifies the pre-commit content store object. This + // reference can be used to get the status from the content store. + Ref string `protobuf:"bytes,5,opt,name=ref,proto3" json:"ref,omitempty"` +} + +func (m *DiffRequest) Reset() { *m = DiffRequest{} } +func (*DiffRequest) ProtoMessage() {} +func (*DiffRequest) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []int{2} } + +type DiffResponse struct { + // Diff is the descriptor of the diff which can be applied + Diff *containerd_v1_types1.Descriptor `protobuf:"bytes,3,opt,name=diff" json:"diff,omitempty"` +} + +func (m *DiffResponse) Reset() { *m = DiffResponse{} } +func (*DiffResponse) ProtoMessage() {} +func (*DiffResponse) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []int{3} } + +func init() { + proto.RegisterType((*ApplyRequest)(nil), "containerd.v1.ApplyRequest") + proto.RegisterType((*ApplyResponse)(nil), "containerd.v1.ApplyResponse") + proto.RegisterType((*DiffRequest)(nil), "containerd.v1.DiffRequest") + proto.RegisterType((*DiffResponse)(nil), "containerd.v1.DiffResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Diff service + +type DiffClient interface { + // Apply applies the content associated with the provided digests onto + // the provided mounts. Archive content will be extracted and + // decompressed if necessary. + Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) + // Diff creates a diff between the given mounts and uploads the result + // to the content store. + Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffResponse, error) +} + +type diffClient struct { + cc *grpc.ClientConn +} + +func NewDiffClient(cc *grpc.ClientConn) DiffClient { + return &diffClient{cc} +} + +func (c *diffClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) { + out := new(ApplyResponse) + err := grpc.Invoke(ctx, "/containerd.v1.Diff/Apply", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *diffClient) Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffResponse, error) { + out := new(DiffResponse) + err := grpc.Invoke(ctx, "/containerd.v1.Diff/Diff", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Diff service + +type DiffServer interface { + // Apply applies the content associated with the provided digests onto + // the provided mounts. Archive content will be extracted and + // decompressed if necessary. + Apply(context.Context, *ApplyRequest) (*ApplyResponse, error) + // Diff creates a diff between the given mounts and uploads the result + // to the content store. + Diff(context.Context, *DiffRequest) (*DiffResponse, error) +} + +func RegisterDiffServer(s *grpc.Server, srv DiffServer) { + s.RegisterService(&_Diff_serviceDesc, srv) +} + +func _Diff_Apply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiffServer).Apply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Diff/Apply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiffServer).Apply(ctx, req.(*ApplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Diff_Diff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiffRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DiffServer).Diff(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Diff/Diff", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DiffServer).Diff(ctx, req.(*DiffRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Diff_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.Diff", + HandlerType: (*DiffServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Apply", + Handler: _Diff_Apply_Handler, + }, + { + MethodName: "Diff", + Handler: _Diff_Diff_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/diff/diff.proto", +} + +func (m *ApplyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ApplyRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Diff != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintDiff(dAtA, i, uint64(m.Diff.Size())) + n1, err := m.Diff.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiff(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ApplyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ApplyResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Applied != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintDiff(dAtA, i, uint64(m.Applied.Size())) + n2, err := m.Applied.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + return i, nil +} + +func (m *DiffRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DiffRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Left) > 0 { + for _, msg := range m.Left { + dAtA[i] = 0xa + i++ + i = encodeVarintDiff(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Right) > 0 { + for _, msg := range m.Right { + dAtA[i] = 0x12 + i++ + i = encodeVarintDiff(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.MediaType) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDiff(dAtA, i, uint64(len(m.MediaType))) + i += copy(dAtA[i:], m.MediaType) + } + if len(m.Ref) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDiff(dAtA, i, uint64(len(m.Ref))) + i += copy(dAtA[i:], m.Ref) + } + return i, nil +} + +func (m *DiffResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DiffResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Diff != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintDiff(dAtA, i, uint64(m.Diff.Size())) + n3, err := m.Diff.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + return i, nil +} + +func encodeFixed64Diff(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Diff(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintDiff(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ApplyRequest) Size() (n int) { + var l int + _ = l + if m.Diff != nil { + l = m.Diff.Size() + n += 1 + l + sovDiff(uint64(l)) + } + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovDiff(uint64(l)) + } + } + return n +} + +func (m *ApplyResponse) Size() (n int) { + var l int + _ = l + if m.Applied != nil { + l = m.Applied.Size() + n += 1 + l + sovDiff(uint64(l)) + } + return n +} + +func (m *DiffRequest) Size() (n int) { + var l int + _ = l + if len(m.Left) > 0 { + for _, e := range m.Left { + l = e.Size() + n += 1 + l + sovDiff(uint64(l)) + } + } + if len(m.Right) > 0 { + for _, e := range m.Right { + l = e.Size() + n += 1 + l + sovDiff(uint64(l)) + } + } + l = len(m.MediaType) + if l > 0 { + n += 1 + l + sovDiff(uint64(l)) + } + l = len(m.Ref) + if l > 0 { + n += 1 + l + sovDiff(uint64(l)) + } + return n +} + +func (m *DiffResponse) Size() (n int) { + var l int + _ = l + if m.Diff != nil { + l = m.Diff.Size() + n += 1 + l + sovDiff(uint64(l)) + } + return n +} + +func sovDiff(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozDiff(x uint64) (n int) { + return sovDiff(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ApplyRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ApplyRequest{`, + `Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ApplyResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ApplyResponse{`, + `Applied:` + strings.Replace(fmt.Sprintf("%v", this.Applied), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, + `}`, + }, "") + return s +} +func (this *DiffRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DiffRequest{`, + `Left:` + strings.Replace(fmt.Sprintf("%v", this.Left), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `Right:` + strings.Replace(fmt.Sprintf("%v", this.Right), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `MediaType:` + fmt.Sprintf("%v", this.MediaType) + `,`, + `Ref:` + fmt.Sprintf("%v", this.Ref) + `,`, + `}`, + }, "") + return s +} +func (this *DiffResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DiffResponse{`, + `Diff:` + strings.Replace(fmt.Sprintf("%v", this.Diff), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringDiff(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ApplyRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ApplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ApplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Diff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Diff == nil { + m.Diff = &containerd_v1_types1.Descriptor{} + } + if err := m.Diff.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &containerd_v1_types.Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiff(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiff + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ApplyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ApplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ApplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Applied", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Applied == nil { + m.Applied = &containerd_v1_types1.Descriptor{} + } + if err := m.Applied.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiff(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiff + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DiffRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DiffRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DiffRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Left = append(m.Left, &containerd_v1_types.Mount{}) + if err := m.Left[len(m.Left)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Right = append(m.Right, &containerd_v1_types.Mount{}) + if err := m.Right[len(m.Right)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MediaType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MediaType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ref", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ref = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiff(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiff + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DiffResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DiffResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DiffResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Diff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDiff + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDiff + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Diff == nil { + m.Diff = &containerd_v1_types1.Descriptor{} + } + if err := m.Diff.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDiff(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDiff + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDiff(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiff + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiff + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiff + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthDiff + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDiff + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipDiff(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthDiff = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDiff = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/diff/diff.proto", fileDescriptorDiff) +} + +var fileDescriptorDiff = []byte{ + // 407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0xcf, 0x93, 0x40, + 0x10, 0xfd, 0x56, 0xda, 0xcf, 0x74, 0xdb, 0x26, 0x66, 0xe3, 0x81, 0x50, 0xa5, 0x0d, 0xa7, 0x9e, + 0x40, 0xe9, 0xc9, 0x44, 0x63, 0xac, 0x8d, 0x07, 0x13, 0x2f, 0xc4, 0xbb, 0xa1, 0x30, 0xd0, 0x4d, + 0x80, 0x5d, 0xd9, 0xa5, 0x86, 0x9b, 0x77, 0xff, 0x84, 0x3f, 0xa7, 0x47, 0x8f, 0x1e, 0x2d, 0xbf, + 0xc4, 0xb0, 0x6c, 0x15, 0x9b, 0x26, 0xb6, 0x97, 0xcd, 0xb0, 0xef, 0xcd, 0x9b, 0x37, 0x8f, 0xc5, + 0xaf, 0x52, 0x2a, 0x77, 0xd5, 0xd6, 0x8d, 0x58, 0xee, 0x45, 0xac, 0x90, 0x21, 0x2d, 0xa0, 0x8c, + 0xfb, 0x65, 0xc8, 0xa9, 0x27, 0xa0, 0xdc, 0xd3, 0x08, 0x84, 0x17, 0xd3, 0x24, 0x51, 0x87, 0xcb, + 0x4b, 0x26, 0x19, 0x99, 0xfe, 0x25, 0xba, 0xfb, 0xe7, 0xd6, 0xe3, 0x94, 0xa5, 0x4c, 0x21, 0x5e, + 0x5b, 0x75, 0x24, 0x6b, 0x96, 0x32, 0x96, 0x66, 0xe0, 0xa9, 0xaf, 0x6d, 0x95, 0x78, 0x90, 0x73, + 0x59, 0x6b, 0x70, 0x7e, 0x0e, 0x4a, 0x9a, 0x83, 0x90, 0x61, 0xce, 0x35, 0xe1, 0xe5, 0x55, 0x0e, + 0x65, 0xcd, 0x41, 0x78, 0x39, 0xab, 0x0a, 0xd9, 0x9d, 0xba, 0xfb, 0xdd, 0x0d, 0xdd, 0x31, 0x88, + 0xa8, 0xa4, 0x5c, 0xb2, 0xb2, 0x57, 0x76, 0x3a, 0xce, 0x17, 0x3c, 0x79, 0xc3, 0x79, 0x56, 0x07, + 0xf0, 0xb9, 0x02, 0x21, 0xc9, 0x0a, 0x0f, 0xda, 0x18, 0x4c, 0xb4, 0x40, 0xcb, 0xb1, 0x3f, 0x77, + 0xff, 0xc9, 0xc1, 0x55, 0x7a, 0xee, 0xe6, 0x8f, 0x48, 0xa0, 0xc8, 0xc4, 0xc7, 0xf7, 0xca, 0x9b, + 0x30, 0x1f, 0x2c, 0x8c, 0xe5, 0xd8, 0xb7, 0x2e, 0xb6, 0x7d, 0x68, 0x29, 0x81, 0x66, 0x3a, 0xef, + 0xf1, 0x54, 0x0f, 0x16, 0x9c, 0x15, 0x02, 0xc8, 0x0b, 0xfc, 0x30, 0xe4, 0x3c, 0xa3, 0x10, 0x5f, + 0x3b, 0xfc, 0xc4, 0x77, 0xbe, 0x23, 0x3c, 0xde, 0xd0, 0x24, 0x39, 0x2d, 0xe1, 0xe2, 0x41, 0x06, + 0x89, 0x34, 0xd1, 0x7f, 0xdd, 0x28, 0x1e, 0x79, 0x86, 0x87, 0x25, 0x4d, 0x77, 0xf2, 0x0a, 0xfb, + 0x1d, 0x91, 0x3c, 0xc5, 0x38, 0x87, 0x98, 0x86, 0x9f, 0x5a, 0xcc, 0x34, 0x16, 0x68, 0x39, 0x0a, + 0x46, 0xea, 0xe6, 0x63, 0xcd, 0x81, 0x3c, 0xc2, 0x46, 0x09, 0x89, 0x39, 0x54, 0xf7, 0x6d, 0xe9, + 0xbc, 0xc5, 0x93, 0xce, 0xa1, 0xde, 0xf6, 0x94, 0xb3, 0x71, 0x43, 0xce, 0xfe, 0x37, 0x84, 0x07, + 0xad, 0x0a, 0x59, 0xe3, 0xa1, 0x0a, 0x8f, 0xcc, 0xce, 0x1a, 0xfb, 0xff, 0xd2, 0x7a, 0x72, 0x19, + 0xd4, 0x0e, 0x5e, 0x6b, 0xad, 0xf3, 0x6d, 0x7b, 0x41, 0x5a, 0xb3, 0x8b, 0x58, 0x27, 0xb0, 0x36, + 0x0f, 0x47, 0xfb, 0xee, 0xe7, 0xd1, 0xbe, 0xfb, 0xda, 0xd8, 0xe8, 0xd0, 0xd8, 0xe8, 0x47, 0x63, + 0xa3, 0x5f, 0x8d, 0x8d, 0xb6, 0xf7, 0xea, 0x6d, 0xad, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x61, + 0x65, 0x17, 0x47, 0x85, 0x03, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/services/diff/diff.proto b/vendor/github.com/containerd/containerd/api/services/diff/diff.proto new file mode 100644 index 0000000000..757eb27cbd --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/diff/diff.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package containerd.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "github.com/containerd/containerd/api/types/mount/mount.proto"; +import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; + +// Diff service creates and applies diffs +service Diff { + // Apply applies the content associated with the provided digests onto + // the provided mounts. Archive content will be extracted and + // decompressed if necessary. + rpc Apply(ApplyRequest) returns (ApplyResponse); + + // Diff creates a diff between the given mounts and uploads the result + // to the content store. + rpc Diff(DiffRequest) returns (DiffResponse); +} + +message ApplyRequest { + // Diff is the descriptor of the diff to be extracted + containerd.v1.types.Descriptor diff = 1; + + repeated containerd.v1.types.Mount mounts = 2; +} + +message ApplyResponse { + // Applied is the descriptor for the object which was applied. + // If the input was a compressed blob then the result will be + // the descriptor for the uncompressed blob. + containerd.v1.types.Descriptor applied = 1; +} + +message DiffRequest { + // Left are the mounts which represent the older copy + // in which is the base of the computed changes. + repeated containerd.v1.types.Mount left = 1; + + // Right are the mounts which represents the newer copy + // in which changes from the left were made into. + repeated containerd.v1.types.Mount right = 2; + + // MediaType is the media type descriptor for the created diff + // object + string media_type = 3; + + // Ref identifies the pre-commit content store object. This + // reference can be used to get the status from the content store. + string ref = 5; +} + +message DiffResponse { + // Diff is the descriptor of the diff which can be applied + containerd.v1.types.Descriptor diff = 3; +} diff --git a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go new file mode 100644 index 0000000000..28a9e3db48 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go @@ -0,0 +1,2008 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/namespaces/namespace.proto +// DO NOT EDIT! + +/* + Package namespaces is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/namespaces/namespace.proto + + It has these top-level messages: + Namespace + GetNamespaceRequest + GetNamespaceResponse + ListNamespacesRequest + ListNamespacesResponse + CreateNamespaceRequest + CreateNamespaceResponse + UpdateNamespaceRequest + UpdateNamespaceResponse + DeleteNamespaceRequest +*/ +package namespaces + +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_protobuf2 "github.com/gogo/protobuf/types" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Namespace struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Labels provides an area to include arbitrary data on namespaces. + // + // Note that to add a new value to this field, read the existing set and + // include the entire result in the update call. + Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *Namespace) Reset() { *m = Namespace{} } +func (*Namespace) ProtoMessage() {} +func (*Namespace) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{0} } + +type GetNamespaceRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *GetNamespaceRequest) Reset() { *m = GetNamespaceRequest{} } +func (*GetNamespaceRequest) ProtoMessage() {} +func (*GetNamespaceRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{1} } + +type GetNamespaceResponse struct { + Namespace Namespace `protobuf:"bytes,1,opt,name=namespace" json:"namespace"` +} + +func (m *GetNamespaceResponse) Reset() { *m = GetNamespaceResponse{} } +func (*GetNamespaceResponse) ProtoMessage() {} +func (*GetNamespaceResponse) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{2} } + +type ListNamespacesRequest struct { + Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (m *ListNamespacesRequest) Reset() { *m = ListNamespacesRequest{} } +func (*ListNamespacesRequest) ProtoMessage() {} +func (*ListNamespacesRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{3} } + +type ListNamespacesResponse struct { + Namespaces []Namespace `protobuf:"bytes,1,rep,name=namespaces" json:"namespaces"` +} + +func (m *ListNamespacesResponse) Reset() { *m = ListNamespacesResponse{} } +func (*ListNamespacesResponse) ProtoMessage() {} +func (*ListNamespacesResponse) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{4} } + +type CreateNamespaceRequest struct { + Namespace Namespace `protobuf:"bytes,1,opt,name=namespace" json:"namespace"` +} + +func (m *CreateNamespaceRequest) Reset() { *m = CreateNamespaceRequest{} } +func (*CreateNamespaceRequest) ProtoMessage() {} +func (*CreateNamespaceRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{5} } + +type CreateNamespaceResponse struct { + Namespace Namespace `protobuf:"bytes,1,opt,name=namespace" json:"namespace"` +} + +func (m *CreateNamespaceResponse) Reset() { *m = CreateNamespaceResponse{} } +func (*CreateNamespaceResponse) ProtoMessage() {} +func (*CreateNamespaceResponse) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{6} } + +// UpdateNamespaceRequest updates the metadata for a namespace. +// +// The operation should follow semantics described in +// https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/field-mask, +// unless otherwise qualified. +type UpdateNamespaceRequest struct { + // Namespace provides the target value, as declared by the mask, for the update. + // + // The namespace field must be set. + Namespace Namespace `protobuf:"bytes,1,opt,name=namespace" json:"namespace"` + // UpdateMask specifies which fields to perform the update on. If empty, + // the operation applies to all fields. + // + // For the most part, this applies only to selectively updating labels on + // the namespace. While field masks are typically limited to ascii alphas + // and digits, we just take everything after the "labels." as the map key. + UpdateMask *google_protobuf2.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask" json:"update_mask,omitempty"` +} + +func (m *UpdateNamespaceRequest) Reset() { *m = UpdateNamespaceRequest{} } +func (*UpdateNamespaceRequest) ProtoMessage() {} +func (*UpdateNamespaceRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{7} } + +type UpdateNamespaceResponse struct { + Namespace Namespace `protobuf:"bytes,1,opt,name=namespace" json:"namespace"` +} + +func (m *UpdateNamespaceResponse) Reset() { *m = UpdateNamespaceResponse{} } +func (*UpdateNamespaceResponse) ProtoMessage() {} +func (*UpdateNamespaceResponse) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{8} } + +type DeleteNamespaceRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *DeleteNamespaceRequest) Reset() { *m = DeleteNamespaceRequest{} } +func (*DeleteNamespaceRequest) ProtoMessage() {} +func (*DeleteNamespaceRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{9} } + +func init() { + proto.RegisterType((*Namespace)(nil), "containerd.v1.namespaces.Namespace") + proto.RegisterType((*GetNamespaceRequest)(nil), "containerd.v1.namespaces.GetNamespaceRequest") + proto.RegisterType((*GetNamespaceResponse)(nil), "containerd.v1.namespaces.GetNamespaceResponse") + proto.RegisterType((*ListNamespacesRequest)(nil), "containerd.v1.namespaces.ListNamespacesRequest") + proto.RegisterType((*ListNamespacesResponse)(nil), "containerd.v1.namespaces.ListNamespacesResponse") + proto.RegisterType((*CreateNamespaceRequest)(nil), "containerd.v1.namespaces.CreateNamespaceRequest") + proto.RegisterType((*CreateNamespaceResponse)(nil), "containerd.v1.namespaces.CreateNamespaceResponse") + proto.RegisterType((*UpdateNamespaceRequest)(nil), "containerd.v1.namespaces.UpdateNamespaceRequest") + proto.RegisterType((*UpdateNamespaceResponse)(nil), "containerd.v1.namespaces.UpdateNamespaceResponse") + proto.RegisterType((*DeleteNamespaceRequest)(nil), "containerd.v1.namespaces.DeleteNamespaceRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Namespaces service + +type NamespacesClient interface { + Get(ctx context.Context, in *GetNamespaceRequest, opts ...grpc.CallOption) (*GetNamespaceResponse, error) + List(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error) + Create(ctx context.Context, in *CreateNamespaceRequest, opts ...grpc.CallOption) (*CreateNamespaceResponse, error) + Update(ctx context.Context, in *UpdateNamespaceRequest, opts ...grpc.CallOption) (*UpdateNamespaceResponse, error) + Delete(ctx context.Context, in *DeleteNamespaceRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) +} + +type namespacesClient struct { + cc *grpc.ClientConn +} + +func NewNamespacesClient(cc *grpc.ClientConn) NamespacesClient { + return &namespacesClient{cc} +} + +func (c *namespacesClient) Get(ctx context.Context, in *GetNamespaceRequest, opts ...grpc.CallOption) (*GetNamespaceResponse, error) { + out := new(GetNamespaceResponse) + err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Get", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *namespacesClient) List(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error) { + out := new(ListNamespacesResponse) + err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/List", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *namespacesClient) Create(ctx context.Context, in *CreateNamespaceRequest, opts ...grpc.CallOption) (*CreateNamespaceResponse, error) { + out := new(CreateNamespaceResponse) + err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Create", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *namespacesClient) Update(ctx context.Context, in *UpdateNamespaceRequest, opts ...grpc.CallOption) (*UpdateNamespaceResponse, error) { + out := new(UpdateNamespaceResponse) + err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Update", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *namespacesClient) Delete(ctx context.Context, in *DeleteNamespaceRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Delete", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Namespaces service + +type NamespacesServer interface { + Get(context.Context, *GetNamespaceRequest) (*GetNamespaceResponse, error) + List(context.Context, *ListNamespacesRequest) (*ListNamespacesResponse, error) + Create(context.Context, *CreateNamespaceRequest) (*CreateNamespaceResponse, error) + Update(context.Context, *UpdateNamespaceRequest) (*UpdateNamespaceResponse, error) + Delete(context.Context, *DeleteNamespaceRequest) (*google_protobuf1.Empty, error) +} + +func RegisterNamespacesServer(s *grpc.Server, srv NamespacesServer) { + s.RegisterService(&_Namespaces_serviceDesc, srv) +} + +func _Namespaces_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNamespaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NamespacesServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.namespaces.Namespaces/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NamespacesServer).Get(ctx, req.(*GetNamespaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Namespaces_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListNamespacesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NamespacesServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.namespaces.Namespaces/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NamespacesServer).List(ctx, req.(*ListNamespacesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Namespaces_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNamespaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NamespacesServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.namespaces.Namespaces/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NamespacesServer).Create(ctx, req.(*CreateNamespaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Namespaces_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNamespaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NamespacesServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.namespaces.Namespaces/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NamespacesServer).Update(ctx, req.(*UpdateNamespaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Namespaces_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNamespaceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NamespacesServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.namespaces.Namespaces/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NamespacesServer).Delete(ctx, req.(*DeleteNamespaceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Namespaces_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.namespaces.Namespaces", + HandlerType: (*NamespacesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get", + Handler: _Namespaces_Get_Handler, + }, + { + MethodName: "List", + Handler: _Namespaces_List_Handler, + }, + { + MethodName: "Create", + Handler: _Namespaces_Create_Handler, + }, + { + MethodName: "Update", + Handler: _Namespaces_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _Namespaces_Delete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/namespaces/namespace.proto", +} + +func (m *Namespace) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Namespace) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *GetNamespaceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + return i, nil +} + +func (m *GetNamespaceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) + n1, err := m.Namespace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + return i, nil +} + +func (m *ListNamespacesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListNamespacesRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filter) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Filter))) + i += copy(dAtA[i:], m.Filter) + } + return i, nil +} + +func (m *ListNamespacesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListNamespacesResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Namespaces) > 0 { + for _, msg := range m.Namespaces { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *CreateNamespaceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) + n2, err := m.Namespace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *CreateNamespaceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) + n3, err := m.Namespace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + +func (m *UpdateNamespaceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) + n4, err := m.Namespace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + if m.UpdateMask != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.UpdateMask.Size())) + n5, err := m.UpdateMask.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} + +func (m *UpdateNamespaceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateNamespaceResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(m.Namespace.Size())) + n6, err := m.Namespace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + return i, nil +} + +func (m *DeleteNamespaceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeleteNamespaceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + return i, nil +} + +func encodeFixed64Namespace(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Namespace(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Namespace) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + n += mapEntrySize + 1 + sovNamespace(uint64(mapEntrySize)) + } + } + return n +} + +func (m *GetNamespaceRequest) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + return n +} + +func (m *GetNamespaceResponse) Size() (n int) { + var l int + _ = l + l = m.Namespace.Size() + n += 1 + l + sovNamespace(uint64(l)) + return n +} + +func (m *ListNamespacesRequest) Size() (n int) { + var l int + _ = l + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + return n +} + +func (m *ListNamespacesResponse) Size() (n int) { + var l int + _ = l + if len(m.Namespaces) > 0 { + for _, e := range m.Namespaces { + l = e.Size() + n += 1 + l + sovNamespace(uint64(l)) + } + } + return n +} + +func (m *CreateNamespaceRequest) Size() (n int) { + var l int + _ = l + l = m.Namespace.Size() + n += 1 + l + sovNamespace(uint64(l)) + return n +} + +func (m *CreateNamespaceResponse) Size() (n int) { + var l int + _ = l + l = m.Namespace.Size() + n += 1 + l + sovNamespace(uint64(l)) + return n +} + +func (m *UpdateNamespaceRequest) Size() (n int) { + var l int + _ = l + l = m.Namespace.Size() + n += 1 + l + sovNamespace(uint64(l)) + if m.UpdateMask != nil { + l = m.UpdateMask.Size() + n += 1 + l + sovNamespace(uint64(l)) + } + return n +} + +func (m *UpdateNamespaceResponse) Size() (n int) { + var l int + _ = l + l = m.Namespace.Size() + n += 1 + l + sovNamespace(uint64(l)) + return n +} + +func (m *DeleteNamespaceRequest) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + return n +} + +func sovNamespace(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozNamespace(x uint64) (n int) { + return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Namespace) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + s := strings.Join([]string{`&Namespace{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Labels:` + mapStringForLabels + `,`, + `}`, + }, "") + return s +} +func (this *GetNamespaceRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNamespaceRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *GetNamespaceResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetNamespaceResponse{`, + `Namespace:` + strings.Replace(strings.Replace(this.Namespace.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ListNamespacesRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListNamespacesRequest{`, + `Filter:` + fmt.Sprintf("%v", this.Filter) + `,`, + `}`, + }, "") + return s +} +func (this *ListNamespacesResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListNamespacesResponse{`, + `Namespaces:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Namespaces), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CreateNamespaceRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateNamespaceRequest{`, + `Namespace:` + strings.Replace(strings.Replace(this.Namespace.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CreateNamespaceResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateNamespaceResponse{`, + `Namespace:` + strings.Replace(strings.Replace(this.Namespace.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateNamespaceRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateNamespaceRequest{`, + `Namespace:` + strings.Replace(strings.Replace(this.Namespace.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `UpdateMask:` + strings.Replace(fmt.Sprintf("%v", this.UpdateMask), "FieldMask", "google_protobuf2.FieldMask", 1) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateNamespaceResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateNamespaceResponse{`, + `Namespace:` + strings.Replace(strings.Replace(this.Namespace.String(), "Namespace", "Namespace", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteNamespaceRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteNamespaceRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func valueToStringNamespace(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Namespace) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Namespace: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Namespace: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNamespaceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNamespaceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNamespaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetNamespaceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetNamespaceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetNamespaceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListNamespacesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListNamespacesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListNamespacesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListNamespacesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListNamespacesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListNamespacesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespaces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Namespaces = append(m.Namespaces, Namespace{}) + if err := m.Namespaces[len(m.Namespaces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateNamespaceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateNamespaceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateNamespaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateNamespaceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateNamespaceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateNamespaceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateNamespaceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpdateNamespaceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateNamespaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateMask", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpdateMask == nil { + m.UpdateMask = &google_protobuf2.FieldMask{} + } + if err := m.UpdateMask.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateNamespaceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpdateNamespaceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateNamespaceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Namespace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeleteNamespaceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeleteNamespaceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteNamespaceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNamespace(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthNamespace + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipNamespace(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/namespaces/namespace.proto", fileDescriptorNamespace) +} + +var fileDescriptorNamespace = []byte{ + // 528 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xbd, 0x8e, 0xd3, 0x4c, + 0x14, 0xcd, 0x24, 0xf9, 0x2c, 0xe5, 0xba, 0xf9, 0x34, 0x04, 0x63, 0x19, 0xc9, 0x44, 0xa6, 0x59, + 0x24, 0x18, 0xb3, 0xa1, 0xe1, 0xa7, 0x5b, 0x58, 0x02, 0xd2, 0x42, 0x61, 0x89, 0x7a, 0x35, 0x4e, + 0x26, 0xc6, 0x8a, 0xff, 0xf0, 0x8c, 0x23, 0xa5, 0xe3, 0x0d, 0x78, 0x03, 0x1a, 0x5e, 0x26, 0x25, + 0x25, 0x15, 0x62, 0xf3, 0x24, 0xc8, 0x63, 0x27, 0xce, 0x6e, 0x1c, 0x2b, 0x2b, 0x85, 0xee, 0x8e, + 0x7d, 0x8e, 0xcf, 0xb9, 0xd7, 0xe7, 0x0e, 0xbc, 0xf3, 0x7c, 0xf1, 0x39, 0x73, 0xc9, 0x38, 0x0e, + 0xed, 0x71, 0x1c, 0x09, 0xea, 0x47, 0x2c, 0x9d, 0x6c, 0x97, 0x34, 0xf1, 0x6d, 0xce, 0xd2, 0xb9, + 0x3f, 0x66, 0xdc, 0x8e, 0x68, 0xc8, 0x78, 0x42, 0xaf, 0x95, 0x24, 0x49, 0x63, 0x11, 0x63, 0xbd, + 0xe2, 0x90, 0xf9, 0x29, 0xa9, 0x90, 0x46, 0xdf, 0x8b, 0xbd, 0x58, 0x82, 0xec, 0xbc, 0x2a, 0xf0, + 0xc6, 0x7d, 0x2f, 0x8e, 0xbd, 0x80, 0xd9, 0xf2, 0xe4, 0x66, 0x53, 0x9b, 0x85, 0x89, 0x58, 0x94, + 0x2f, 0x07, 0x37, 0x5f, 0x4e, 0x7d, 0x16, 0x4c, 0x2e, 0x43, 0xca, 0x67, 0x05, 0xc2, 0xfa, 0x81, + 0xa0, 0xf7, 0x71, 0xad, 0x81, 0x31, 0x74, 0x73, 0x41, 0x1d, 0x0d, 0xd0, 0x49, 0xcf, 0x91, 0x35, + 0x1e, 0x81, 0x12, 0x50, 0x97, 0x05, 0x5c, 0x6f, 0x0f, 0x3a, 0x27, 0xea, 0xd0, 0x26, 0xfb, 0x1c, + 0x92, 0xcd, 0x87, 0xc8, 0x85, 0x64, 0x9c, 0x47, 0x22, 0x5d, 0x38, 0x25, 0xdd, 0x78, 0x01, 0xea, + 0xd6, 0x63, 0xfc, 0x3f, 0x74, 0x66, 0x6c, 0x51, 0x4a, 0xe5, 0x25, 0xee, 0xc3, 0x7f, 0x73, 0x1a, + 0x64, 0x4c, 0x6f, 0xcb, 0x67, 0xc5, 0xe1, 0x65, 0xfb, 0x39, 0xb2, 0x1e, 0xc1, 0x9d, 0x11, 0x13, + 0x9b, 0xcf, 0x3b, 0xec, 0x4b, 0xc6, 0xb8, 0xa8, 0xb3, 0x6b, 0x5d, 0x42, 0xff, 0x3a, 0x94, 0x27, + 0x71, 0xc4, 0xf3, 0x36, 0x7a, 0x1b, 0xa7, 0x92, 0xa0, 0x0e, 0x1f, 0x1e, 0xd0, 0xc9, 0x59, 0x77, + 0xf9, 0xfb, 0x41, 0xcb, 0xa9, 0xb8, 0x96, 0x0d, 0x77, 0x2f, 0x7c, 0x5e, 0x29, 0xf0, 0xb5, 0x1b, + 0x0d, 0x94, 0xa9, 0x1f, 0x08, 0x96, 0x96, 0x7e, 0xca, 0x93, 0x35, 0x06, 0xed, 0x26, 0xa1, 0xf4, + 0xf4, 0x1e, 0xa0, 0xd2, 0xd4, 0x91, 0x1c, 0xef, 0x2d, 0x4c, 0x6d, 0x91, 0x2d, 0x0a, 0xda, 0xeb, + 0x94, 0x51, 0xc1, 0x76, 0x86, 0x74, 0xb4, 0xc6, 0x5d, 0xb8, 0xb7, 0x23, 0x71, 0xec, 0xe1, 0x7e, + 0x47, 0xa0, 0x7d, 0x4a, 0x26, 0xff, 0xb2, 0x0f, 0xfc, 0x0a, 0xd4, 0x4c, 0x4a, 0xc8, 0x3d, 0x90, + 0x61, 0x53, 0x87, 0x06, 0x29, 0x56, 0x85, 0xac, 0x57, 0x85, 0xbc, 0xcd, 0x57, 0xe5, 0x03, 0xe5, + 0x33, 0x07, 0x0a, 0x78, 0x5e, 0xe7, 0x43, 0xd8, 0xf1, 0x77, 0xec, 0x21, 0x3c, 0x06, 0xed, 0x0d, + 0x0b, 0x58, 0xcd, 0x0c, 0x6a, 0x02, 0x3f, 0xfc, 0xd6, 0x05, 0xa8, 0xb2, 0x85, 0x27, 0xd0, 0x19, + 0x31, 0x81, 0x9f, 0xec, 0x57, 0xae, 0xd9, 0x24, 0x83, 0x1c, 0x0a, 0x2f, 0x7b, 0xf5, 0xa1, 0x9b, + 0x67, 0x1a, 0x37, 0x5c, 0x06, 0xb5, 0x4b, 0x62, 0x3c, 0x3d, 0x9c, 0x50, 0x4a, 0x85, 0xa0, 0x14, + 0xb1, 0xc3, 0x0d, 0xdc, 0xfa, 0xec, 0x1b, 0xa7, 0xb7, 0x60, 0x54, 0x72, 0xc5, 0x0f, 0x6e, 0x92, + 0xab, 0x8f, 0x68, 0x93, 0xdc, 0xbe, 0xd0, 0x38, 0xa0, 0x14, 0xff, 0xba, 0x49, 0xae, 0x3e, 0x0d, + 0x86, 0xb6, 0x93, 0xd9, 0xf3, 0xfc, 0xee, 0x3f, 0xd3, 0x97, 0x57, 0x66, 0xeb, 0xd7, 0x95, 0xd9, + 0xfa, 0xba, 0x32, 0xd1, 0x72, 0x65, 0xa2, 0x9f, 0x2b, 0x13, 0xfd, 0x59, 0x99, 0xc8, 0x55, 0x24, + 0xf2, 0xd9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x2e, 0xc3, 0x29, 0xaf, 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto new file mode 100644 index 0000000000..4927cff852 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto @@ -0,0 +1,88 @@ +syntax = "proto3"; + +package containerd.v1.namespaces; + +import "gogoproto/gogo.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +// Namespaces provides the ability to manipulate containerd namespaces. +// +// All objects in the system are required to be a member of a namespace. If a +// namespace is deleted, all objects, including containers, images and +// snapshots, will be deleted, as well. +// +// Unless otherwise noted, operations in containerd apply only to the namespace +// supplied per request. +// +// I hope this goes without saying, but namespaces are themselves NOT +// namespaced. +service Namespaces { + rpc Get(GetNamespaceRequest) returns (GetNamespaceResponse); + rpc List(ListNamespacesRequest) returns (ListNamespacesResponse); + rpc Create(CreateNamespaceRequest) returns (CreateNamespaceResponse); + rpc Update(UpdateNamespaceRequest) returns (UpdateNamespaceResponse); + rpc Delete(DeleteNamespaceRequest) returns (google.protobuf.Empty); +} + +message Namespace { + string name = 1; + + // Labels provides an area to include arbitrary data on namespaces. + // + // Note that to add a new value to this field, read the existing set and + // include the entire result in the update call. + map labels = 2; +} + +message GetNamespaceRequest { + string name = 1; +} + +message GetNamespaceResponse { + Namespace namespace = 1 [(gogoproto.nullable) = false]; +} + +message ListNamespacesRequest { + string filter = 1; // TODO(stevvooe): Define a filtering syntax to make these queries. +} + +message ListNamespacesResponse { + repeated Namespace namespaces = 1 [(gogoproto.nullable) = false]; +} + +message CreateNamespaceRequest { + Namespace namespace = 1 [(gogoproto.nullable) = false]; +} + +message CreateNamespaceResponse { + Namespace namespace = 1 [(gogoproto.nullable) = false]; +} + +// UpdateNamespaceRequest updates the metadata for a namespace. +// +// The operation should follow semantics described in +// https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/field-mask, +// unless otherwise qualified. +message UpdateNamespaceRequest { + // Namespace provides the target value, as declared by the mask, for the update. + // + // The namespace field must be set. + Namespace namespace = 1 [(gogoproto.nullable) = false]; + + // UpdateMask specifies which fields to perform the update on. If empty, + // the operation applies to all fields. + // + // For the most part, this applies only to selectively updating labels on + // the namespace. While field masks are typically limited to ascii alphas + // and digits, we just take everything after the "labels." as the map key. + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateNamespaceResponse { + Namespace namespace = 1 [(gogoproto.nullable) = false]; +} + +message DeleteNamespaceRequest { + string name = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go new file mode 100644 index 0000000000..2ee996ba1b --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go @@ -0,0 +1,2379 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/snapshot/snapshots.proto +// DO NOT EDIT! + +/* + Package snapshot is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/snapshot/snapshots.proto + + It has these top-level messages: + PrepareRequest + MountsRequest + MountsResponse + RemoveRequest + CommitRequest + StatRequest + Info + StatResponse + ListRequest + ListResponse + UsageRequest + UsageResponse +*/ +package snapshot + +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 containerd_v1_types "github.com/containerd/containerd/api/types/mount" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Kind int32 + +const ( + KindActive Kind = 0 + KindCommitted Kind = 1 +) + +var Kind_name = map[int32]string{ + 0: "ACTIVE", + 1: "COMMITTED", +} +var Kind_value = map[string]int32{ + "ACTIVE": 0, + "COMMITTED": 1, +} + +func (x Kind) String() string { + return proto.EnumName(Kind_name, int32(x)) +} +func (Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{0} } + +type PrepareRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` +} + +func (m *PrepareRequest) Reset() { *m = PrepareRequest{} } +func (*PrepareRequest) ProtoMessage() {} +func (*PrepareRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{0} } + +type MountsRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *MountsRequest) Reset() { *m = MountsRequest{} } +func (*MountsRequest) ProtoMessage() {} +func (*MountsRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{1} } + +type MountsResponse struct { + Mounts []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=mounts" json:"mounts,omitempty"` +} + +func (m *MountsResponse) Reset() { *m = MountsResponse{} } +func (*MountsResponse) ProtoMessage() {} +func (*MountsResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{2} } + +type RemoveRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *RemoveRequest) Reset() { *m = RemoveRequest{} } +func (*RemoveRequest) ProtoMessage() {} +func (*RemoveRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{3} } + +type CommitRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *CommitRequest) Reset() { *m = CommitRequest{} } +func (*CommitRequest) ProtoMessage() {} +func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{4} } + +type StatRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *StatRequest) Reset() { *m = StatRequest{} } +func (*StatRequest) ProtoMessage() {} +func (*StatRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{5} } + +type Info struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` + Kind Kind `protobuf:"varint,3,opt,name=kind,proto3,enum=containerd.v1.snapshot.Kind" json:"kind,omitempty"` + Readonly bool `protobuf:"varint,4,opt,name=readonly,proto3" json:"readonly,omitempty"` +} + +func (m *Info) Reset() { *m = Info{} } +func (*Info) ProtoMessage() {} +func (*Info) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{6} } + +type StatResponse struct { + Info Info `protobuf:"bytes,1,opt,name=info" json:"info"` +} + +func (m *StatResponse) Reset() { *m = StatResponse{} } +func (*StatResponse) ProtoMessage() {} +func (*StatResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{7} } + +type ListRequest struct { +} + +func (m *ListRequest) Reset() { *m = ListRequest{} } +func (*ListRequest) ProtoMessage() {} +func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{8} } + +type ListResponse struct { + Info []Info `protobuf:"bytes,1,rep,name=info" json:"info"` +} + +func (m *ListResponse) Reset() { *m = ListResponse{} } +func (*ListResponse) ProtoMessage() {} +func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{9} } + +type UsageRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *UsageRequest) Reset() { *m = UsageRequest{} } +func (*UsageRequest) ProtoMessage() {} +func (*UsageRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{10} } + +type UsageResponse struct { + Inodes int64 `protobuf:"varint,2,opt,name=inodes,proto3" json:"inodes,omitempty"` + Size_ int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` +} + +func (m *UsageResponse) Reset() { *m = UsageResponse{} } +func (*UsageResponse) ProtoMessage() {} +func (*UsageResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{11} } + +func init() { + proto.RegisterType((*PrepareRequest)(nil), "containerd.v1.snapshot.PrepareRequest") + proto.RegisterType((*MountsRequest)(nil), "containerd.v1.snapshot.MountsRequest") + proto.RegisterType((*MountsResponse)(nil), "containerd.v1.snapshot.MountsResponse") + proto.RegisterType((*RemoveRequest)(nil), "containerd.v1.snapshot.RemoveRequest") + proto.RegisterType((*CommitRequest)(nil), "containerd.v1.snapshot.CommitRequest") + proto.RegisterType((*StatRequest)(nil), "containerd.v1.snapshot.StatRequest") + proto.RegisterType((*Info)(nil), "containerd.v1.snapshot.Info") + proto.RegisterType((*StatResponse)(nil), "containerd.v1.snapshot.StatResponse") + proto.RegisterType((*ListRequest)(nil), "containerd.v1.snapshot.ListRequest") + proto.RegisterType((*ListResponse)(nil), "containerd.v1.snapshot.ListResponse") + proto.RegisterType((*UsageRequest)(nil), "containerd.v1.snapshot.UsageRequest") + proto.RegisterType((*UsageResponse)(nil), "containerd.v1.snapshot.UsageResponse") + proto.RegisterEnum("containerd.v1.snapshot.Kind", Kind_name, Kind_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Snapshot service + +type SnapshotClient interface { + Prepare(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) + View(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) + Mounts(ctx context.Context, in *MountsRequest, opts ...grpc.CallOption) (*MountsResponse, error) + Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) + List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (Snapshot_ListClient, error) + Usage(ctx context.Context, in *UsageRequest, opts ...grpc.CallOption) (*UsageResponse, error) +} + +type snapshotClient struct { + cc *grpc.ClientConn +} + +func NewSnapshotClient(cc *grpc.ClientConn) SnapshotClient { + return &snapshotClient{cc} +} + +func (c *snapshotClient) Prepare(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) { + out := new(MountsResponse) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Prepare", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) View(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) { + out := new(MountsResponse) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/View", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) Mounts(ctx context.Context, in *MountsRequest, opts ...grpc.CallOption) (*MountsResponse, error) { + out := new(MountsResponse) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Mounts", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Commit", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { + out := new(google_protobuf1.Empty) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Remove", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { + out := new(StatResponse) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Stat", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (Snapshot_ListClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Snapshot_serviceDesc.Streams[0], c.cc, "/containerd.v1.snapshot.Snapshot/List", opts...) + if err != nil { + return nil, err + } + x := &snapshotListClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Snapshot_ListClient interface { + Recv() (*ListResponse, error) + grpc.ClientStream +} + +type snapshotListClient struct { + grpc.ClientStream +} + +func (x *snapshotListClient) Recv() (*ListResponse, error) { + m := new(ListResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *snapshotClient) Usage(ctx context.Context, in *UsageRequest, opts ...grpc.CallOption) (*UsageResponse, error) { + out := new(UsageResponse) + err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Usage", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Snapshot service + +type SnapshotServer interface { + Prepare(context.Context, *PrepareRequest) (*MountsResponse, error) + View(context.Context, *PrepareRequest) (*MountsResponse, error) + Mounts(context.Context, *MountsRequest) (*MountsResponse, error) + Commit(context.Context, *CommitRequest) (*google_protobuf1.Empty, error) + Remove(context.Context, *RemoveRequest) (*google_protobuf1.Empty, error) + Stat(context.Context, *StatRequest) (*StatResponse, error) + List(*ListRequest, Snapshot_ListServer) error + Usage(context.Context, *UsageRequest) (*UsageResponse, error) +} + +func RegisterSnapshotServer(s *grpc.Server, srv SnapshotServer) { + s.RegisterService(&_Snapshot_serviceDesc, srv) +} + +func _Snapshot_Prepare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Prepare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Prepare", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Prepare(ctx, req.(*PrepareRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_View_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).View(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/View", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).View(ctx, req.(*PrepareRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_Mounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MountsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Mounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Mounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Mounts(ctx, req.(*MountsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Commit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Commit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Commit(ctx, req.(*CommitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Remove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Remove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Remove(ctx, req.(*RemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Stat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Stat", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Stat(ctx, req.(*StatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_List_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SnapshotServer).List(m, &snapshotListServer{stream}) +} + +type Snapshot_ListServer interface { + Send(*ListResponse) error + grpc.ServerStream +} + +type snapshotListServer struct { + grpc.ServerStream +} + +func (x *snapshotListServer) Send(m *ListResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _Snapshot_Usage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UsageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).Usage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.snapshot.Snapshot/Usage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).Usage(ctx, req.(*UsageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Snapshot_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.snapshot.Snapshot", + HandlerType: (*SnapshotServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Prepare", + Handler: _Snapshot_Prepare_Handler, + }, + { + MethodName: "View", + Handler: _Snapshot_View_Handler, + }, + { + MethodName: "Mounts", + Handler: _Snapshot_Mounts_Handler, + }, + { + MethodName: "Commit", + Handler: _Snapshot_Commit_Handler, + }, + { + MethodName: "Remove", + Handler: _Snapshot_Remove_Handler, + }, + { + MethodName: "Stat", + Handler: _Snapshot_Stat_Handler, + }, + { + MethodName: "Usage", + Handler: _Snapshot_Usage_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "List", + Handler: _Snapshot_List_Handler, + ServerStreams: true, + }, + }, + Metadata: "github.com/containerd/containerd/api/services/snapshot/snapshots.proto", +} + +func (m *PrepareRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrepareRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Parent) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Parent))) + i += copy(dAtA[i:], m.Parent) + } + return i, nil +} + +func (m *MountsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MountsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *MountsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MountsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *RemoveRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RemoveRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *CommitRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommitRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Key) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *StatRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *Info) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Info) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Parent) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Parent))) + i += copy(dAtA[i:], m.Parent) + } + if m.Kind != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(m.Kind)) + } + if m.Readonly { + dAtA[i] = 0x20 + i++ + if m.Readonly { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *StatResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(m.Info.Size())) + n1, err := m.Info.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + return i, nil +} + +func (m *ListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *ListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Info) > 0 { + for _, msg := range m.Info { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *UsageRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UsageRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func (m *UsageResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UsageResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Size_ != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(m.Size_)) + } + if m.Inodes != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(m.Inodes)) + } + return i, nil +} + +func encodeFixed64Snapshots(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Snapshots(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintSnapshots(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *PrepareRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + l = len(m.Parent) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *MountsRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *MountsResponse) Size() (n int) { + var l int + _ = l + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovSnapshots(uint64(l)) + } + } + return n +} + +func (m *RemoveRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *CommitRequest) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *StatRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *Info) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + l = len(m.Parent) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + if m.Kind != 0 { + n += 1 + sovSnapshots(uint64(m.Kind)) + } + if m.Readonly { + n += 2 + } + return n +} + +func (m *StatResponse) Size() (n int) { + var l int + _ = l + l = m.Info.Size() + n += 1 + l + sovSnapshots(uint64(l)) + return n +} + +func (m *ListRequest) Size() (n int) { + var l int + _ = l + return n +} + +func (m *ListResponse) Size() (n int) { + var l int + _ = l + if len(m.Info) > 0 { + for _, e := range m.Info { + l = e.Size() + n += 1 + l + sovSnapshots(uint64(l)) + } + } + return n +} + +func (m *UsageRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *UsageResponse) Size() (n int) { + var l int + _ = l + if m.Size_ != 0 { + n += 1 + sovSnapshots(uint64(m.Size_)) + } + if m.Inodes != 0 { + n += 1 + sovSnapshots(uint64(m.Inodes)) + } + return n +} + +func sovSnapshots(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSnapshots(x uint64) (n int) { + return sovSnapshots(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *PrepareRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PrepareRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Parent:` + fmt.Sprintf("%v", this.Parent) + `,`, + `}`, + }, "") + return s +} +func (this *MountsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MountsRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *MountsResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MountsResponse{`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `}`, + }, "") + return s +} +func (this *RemoveRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RemoveRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *CommitRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CommitRequest{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *StatRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StatRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *Info) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Info{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Parent:` + fmt.Sprintf("%v", this.Parent) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Readonly:` + fmt.Sprintf("%v", this.Readonly) + `,`, + `}`, + }, "") + return s +} +func (this *StatResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StatResponse{`, + `Info:` + strings.Replace(strings.Replace(this.Info.String(), "Info", "Info", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ListRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListRequest{`, + `}`, + }, "") + return s +} +func (this *ListResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListResponse{`, + `Info:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Info), "Info", "Info", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *UsageRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UsageRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *UsageResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UsageResponse{`, + `Size_:` + fmt.Sprintf("%v", this.Size_) + `,`, + `Inodes:` + fmt.Sprintf("%v", this.Inodes) + `,`, + `}`, + }, "") + return s +} +func valueToStringSnapshots(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *PrepareRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrepareRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrepareRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MountsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MountsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MountsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MountsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MountsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MountsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &containerd_v1_types.Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RemoveRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RemoveRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoveRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommitRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Info) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Info: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Info: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + m.Kind = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Kind |= (Kind(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Readonly", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Readonly = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StatResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Info = append(m.Info, Info{}) + if err := m.Info[len(m.Info)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UsageRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UsageRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UsageRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UsageResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UsageResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UsageResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Inodes", wireType) + } + m.Inodes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Inodes |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSnapshots(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshots + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshots + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshots + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthSnapshots + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshots + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSnapshots(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSnapshots = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSnapshots = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/snapshot/snapshots.proto", fileDescriptorSnapshots) +} + +var fileDescriptorSnapshots = []byte{ + // 649 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcd, 0x6e, 0x13, 0x31, + 0x10, 0xc7, 0xb3, 0xcd, 0x36, 0xb4, 0x93, 0x26, 0x2a, 0x16, 0xaa, 0xa2, 0x05, 0x6d, 0x97, 0x40, + 0x51, 0xc4, 0x61, 0xb7, 0x04, 0xc1, 0x01, 0xb8, 0xf4, 0x13, 0x55, 0xa5, 0x02, 0xb6, 0xa1, 0x88, + 0xe3, 0x36, 0x71, 0x53, 0xab, 0x5d, 0x7b, 0x89, 0x9d, 0xa0, 0x70, 0xea, 0x11, 0xf5, 0x1d, 0x7a, + 0x02, 0xf1, 0x10, 0x3c, 0x41, 0x8f, 0x1c, 0x39, 0x21, 0x9a, 0x27, 0x41, 0xb6, 0x77, 0xdb, 0x04, + 0xea, 0x96, 0x4a, 0x5c, 0x56, 0x33, 0xf6, 0x7f, 0x7e, 0x1e, 0xcf, 0xce, 0x18, 0x56, 0xdb, 0x44, + 0xec, 0x76, 0xb7, 0xfd, 0x26, 0x8b, 0x83, 0x26, 0xa3, 0x22, 0x22, 0x14, 0x77, 0x5a, 0xc3, 0x66, + 0x94, 0x90, 0x80, 0xe3, 0x4e, 0x8f, 0x34, 0x31, 0x0f, 0x38, 0x8d, 0x12, 0xbe, 0xcb, 0xc4, 0xa9, + 0xc1, 0xfd, 0xa4, 0xc3, 0x04, 0x43, 0x33, 0x67, 0x11, 0x7e, 0xef, 0x81, 0x9f, 0x6d, 0x3b, 0x37, + 0xda, 0xac, 0xcd, 0x94, 0x24, 0x90, 0x96, 0x56, 0x3b, 0x37, 0xdb, 0x8c, 0xb5, 0xf7, 0x71, 0xa0, + 0xbc, 0xed, 0xee, 0x4e, 0x80, 0xe3, 0x44, 0xf4, 0xd3, 0xcd, 0x67, 0xff, 0x94, 0x92, 0xe8, 0x27, + 0x98, 0x07, 0x31, 0xeb, 0x52, 0xa1, 0xbf, 0x3a, 0xba, 0xfa, 0x04, 0xca, 0xaf, 0x3a, 0x38, 0x89, + 0x3a, 0x38, 0xc4, 0xef, 0xbb, 0x98, 0x0b, 0x34, 0x0d, 0xf9, 0x3d, 0xdc, 0xaf, 0x58, 0x9e, 0x55, + 0x9b, 0x0c, 0xa5, 0x89, 0x66, 0xa0, 0x20, 0x05, 0x54, 0x54, 0xc6, 0xd4, 0x62, 0xea, 0x55, 0x6f, + 0x43, 0x69, 0x43, 0xa2, 0xb8, 0x31, 0xb4, 0xba, 0x0c, 0xe5, 0x4c, 0xc2, 0x13, 0x46, 0x39, 0x46, + 0x75, 0x28, 0xa8, 0xf3, 0x79, 0xc5, 0xf2, 0xf2, 0xb5, 0x62, 0xdd, 0xf1, 0x47, 0x4b, 0xa1, 0x12, + 0xf5, 0x55, 0x50, 0x98, 0x2a, 0xe5, 0x41, 0x21, 0x8e, 0x59, 0xcf, 0x9c, 0x63, 0xf5, 0x11, 0x94, + 0x96, 0x58, 0x1c, 0x13, 0x91, 0x49, 0x10, 0xd8, 0x34, 0x8a, 0x71, 0xaa, 0x51, 0x76, 0x16, 0x36, + 0x76, 0x16, 0x36, 0x0b, 0xc5, 0x4d, 0x11, 0x09, 0x33, 0xf7, 0xc0, 0x02, 0x7b, 0x8d, 0xee, 0xb0, + 0x73, 0x79, 0x86, 0xc2, 0xa0, 0x79, 0xb0, 0xf7, 0x08, 0x6d, 0x55, 0xf2, 0x9e, 0x55, 0x2b, 0xd7, + 0x6f, 0xf9, 0xe7, 0xff, 0x6c, 0x7f, 0x9d, 0xd0, 0x56, 0xa8, 0x94, 0xc8, 0x81, 0x89, 0x0e, 0x8e, + 0x5a, 0x8c, 0xee, 0xf7, 0x2b, 0xb6, 0x67, 0xd5, 0x26, 0xc2, 0x53, 0xbf, 0xba, 0x0a, 0x53, 0x3a, + 0xc7, 0xb4, 0x82, 0x8f, 0xc1, 0x26, 0x74, 0x87, 0xa9, 0x4c, 0x8a, 0x66, 0xba, 0xcc, 0x7a, 0xd1, + 0x3e, 0xfe, 0x39, 0x9b, 0x0b, 0x95, 0xbe, 0x5a, 0x82, 0xe2, 0x0b, 0xc2, 0xb3, 0xbb, 0x4a, 0xac, + 0x76, 0xff, 0xc2, 0xe6, 0xaf, 0x84, 0xf5, 0x60, 0xea, 0x0d, 0x8f, 0xda, 0x17, 0xfc, 0x9b, 0xa7, + 0x50, 0x4a, 0x15, 0xe9, 0x51, 0x08, 0x6c, 0x4e, 0x3e, 0xea, 0x5a, 0xe6, 0x43, 0x65, 0xcb, 0x5a, + 0x12, 0xca, 0x5a, 0x98, 0xab, 0x5a, 0xe6, 0xc3, 0xd4, 0xbb, 0x1f, 0x82, 0xbd, 0xae, 0x2b, 0x54, + 0x58, 0x58, 0x6a, 0xac, 0x6d, 0xad, 0x4c, 0xe7, 0x9c, 0xf2, 0xe1, 0x91, 0x07, 0x72, 0x75, 0xa1, + 0x29, 0x48, 0x0f, 0x23, 0x0f, 0x26, 0x97, 0x5e, 0x6e, 0x6c, 0xac, 0x35, 0x1a, 0x2b, 0xcb, 0xd3, + 0x96, 0x73, 0xfd, 0xf0, 0xc8, 0x2b, 0xc9, 0x6d, 0xdd, 0x11, 0x02, 0xb7, 0x9c, 0xa9, 0x4f, 0x9f, + 0xdd, 0xdc, 0xb7, 0x2f, 0xae, 0x62, 0xd5, 0xbf, 0x8e, 0xc3, 0xc4, 0x66, 0x7a, 0x21, 0xf4, 0x0e, + 0xae, 0xa5, 0x13, 0x80, 0xee, 0x99, 0x2e, 0x3d, 0x3a, 0x22, 0x8e, 0x51, 0xf7, 0x47, 0xaf, 0x6f, + 0x81, 0xbd, 0x45, 0xf0, 0x87, 0xff, 0xce, 0x7d, 0x0b, 0x05, 0xbd, 0x82, 0xe6, 0x2e, 0x8b, 0xb8, + 0x1a, 0xf8, 0x39, 0x14, 0x74, 0xcd, 0xcc, 0xe0, 0x91, 0x29, 0x73, 0x66, 0x7c, 0xfd, 0x34, 0xf9, + 0xd9, 0xd3, 0xe4, 0xaf, 0xc8, 0xa7, 0x49, 0x82, 0xf4, 0xc4, 0x9a, 0x41, 0x23, 0x13, 0x6d, 0x04, + 0xbd, 0x06, 0x5b, 0x36, 0x3f, 0xba, 0x63, 0xc2, 0x0c, 0x8d, 0xaf, 0x73, 0xf7, 0x62, 0x51, 0x7a, + 0xc9, 0x4d, 0xb0, 0x65, 0xe3, 0x9b, 0x91, 0x43, 0x53, 0x62, 0x46, 0x0e, 0xcf, 0xce, 0xbc, 0x85, + 0x1a, 0x30, 0xae, 0x7a, 0x1c, 0x19, 0x03, 0x86, 0x87, 0xc4, 0x99, 0xbb, 0x44, 0xa5, 0xb9, 0x8b, + 0x95, 0xe3, 0x13, 0x37, 0xf7, 0xe3, 0xc4, 0xcd, 0x1d, 0x0c, 0x5c, 0xeb, 0x78, 0xe0, 0x5a, 0xdf, + 0x07, 0xae, 0xf5, 0x6b, 0xe0, 0x5a, 0xdb, 0x05, 0x55, 0xa7, 0x87, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xed, 0x08, 0xd9, 0xe9, 0x91, 0x06, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto new file mode 100644 index 0000000000..76c27e4b1a --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; + +package containerd.v1.snapshot; + +import "gogoproto/gogo.proto"; +import "google/protobuf/empty.proto"; +import "github.com/containerd/containerd/api/types/mount/mount.proto"; + +// Snapshot service manages snapshots +service Snapshot { + rpc Prepare(PrepareRequest) returns (MountsResponse); + rpc View(PrepareRequest) returns (MountsResponse); + rpc Mounts(MountsRequest) returns (MountsResponse); + rpc Commit(CommitRequest) returns (google.protobuf.Empty); + rpc Remove(RemoveRequest) returns (google.protobuf.Empty); + rpc Stat(StatRequest) returns (StatResponse); + rpc List(ListRequest) returns (stream ListResponse); + rpc Usage(UsageRequest) returns (UsageResponse); + // "Snapshot" prepares a new set of mounts from existing name +} + +message PrepareRequest { + string key = 1; + string parent = 2; +} + +message MountsRequest { + string key = 1; +} + +message MountsResponse { + repeated containerd.v1.types.Mount mounts = 1; +} + +message RemoveRequest { + string key = 1; +} + +message CommitRequest { + string name = 1; + string key = 2; +} + +message StatRequest { + string key = 1; +} + +enum Kind { + option (gogoproto.goproto_enum_prefix) = false; + option (gogoproto.enum_customname) = "Kind"; + + ACTIVE = 0 [(gogoproto.enumvalue_customname) = "KindActive"]; + + COMMITTED = 1 [(gogoproto.enumvalue_customname) = "KindCommitted"]; +} + +message Info { + string name = 1; + string parent = 2; + Kind kind = 3; + bool readonly = 4; +} + +message StatResponse { + Info info = 1 [(gogoproto.nullable) = false]; +} + +message ListRequest{} + +message ListResponse { + repeated Info info = 1 [(gogoproto.nullable) = false]; +} + +message UsageRequest { + string key = 1; +} + +message UsageResponse { + int64 inodes = 2; + int64 size = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/services/version/version.pb.go b/vendor/github.com/containerd/containerd/api/services/version/version.pb.go new file mode 100644 index 0000000000..5dc5fd697e --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/version/version.pb.go @@ -0,0 +1,465 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/version/version.proto +// DO NOT EDIT! + +/* + Package version is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/version/version.proto + + It has these top-level messages: + VersionResponse +*/ +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 _ "github.com/gogo/protobuf/gogoproto" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type VersionResponse struct { + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"` +} + +func (m *VersionResponse) Reset() { *m = VersionResponse{} } +func (*VersionResponse) ProtoMessage() {} +func (*VersionResponse) Descriptor() ([]byte, []int) { return fileDescriptorVersion, []int{0} } + +func init() { + proto.RegisterType((*VersionResponse)(nil), "containerd.v1.VersionResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Version service + +type VersionClient interface { + Version(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VersionResponse, error) +} + +type versionClient struct { + cc *grpc.ClientConn +} + +func NewVersionClient(cc *grpc.ClientConn) VersionClient { + return &versionClient{cc} +} + +func (c *versionClient) Version(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VersionResponse, error) { + out := new(VersionResponse) + err := grpc.Invoke(ctx, "/containerd.v1.Version/Version", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Version service + +type VersionServer interface { + Version(context.Context, *google_protobuf.Empty) (*VersionResponse, error) +} + +func RegisterVersionServer(s *grpc.Server, srv VersionServer) { + s.RegisterService(&_Version_serviceDesc, srv) +} + +func _Version_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(google_protobuf.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VersionServer).Version(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Version/Version", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VersionServer).Version(ctx, req.(*google_protobuf.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _Version_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.Version", + HandlerType: (*VersionServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Version", + Handler: _Version_Version_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/version/version.proto", +} + +func (m *VersionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VersionResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Version) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintVersion(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if len(m.Revision) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintVersion(dAtA, i, uint64(len(m.Revision))) + i += copy(dAtA[i:], m.Revision) + } + return i, nil +} + +func encodeFixed64Version(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Version(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintVersion(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *VersionResponse) Size() (n int) { + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovVersion(uint64(l)) + } + l = len(m.Revision) + if l > 0 { + n += 1 + l + sovVersion(uint64(l)) + } + return n +} + +func sovVersion(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozVersion(x uint64) (n int) { + return sovVersion(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *VersionResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VersionResponse{`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `Revision:` + fmt.Sprintf("%v", this.Revision) + `,`, + `}`, + }, "") + return s +} +func valueToStringVersion(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *VersionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVersion + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VersionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VersionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVersion + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVersion + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVersion + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVersion + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Revision = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVersion(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVersion + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVersion(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVersion + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVersion + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVersion + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthVersion + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowVersion + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipVersion(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthVersion = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVersion = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/version/version.proto", fileDescriptorVersion) +} + +var fileDescriptorVersion = []byte{ + // 225 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4e, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, + 0x97, 0xa5, 0x16, 0x15, 0x67, 0xe6, 0xe7, 0xc1, 0x68, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, + 0x5e, 0x84, 0x72, 0xbd, 0x32, 0x43, 0x29, 0xe9, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0xb0, + 0x64, 0x52, 0x69, 0x9a, 0x7e, 0x6a, 0x6e, 0x41, 0x49, 0x25, 0x44, 0xad, 0x94, 0x48, 0x7a, 0x7e, + 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0xdc, 0xb9, 0xf8, 0xc3, 0x20, 0x46, 0x06, + 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x49, 0x70, 0xb1, 0x43, 0x6d, 0x91, 0x60, 0x54, + 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0xa4, 0xb8, 0x38, 0x8a, 0x52, 0xcb, 0x32, 0xc1, 0x52, + 0x4c, 0x60, 0x29, 0x38, 0xdf, 0xc8, 0x87, 0x8b, 0x1d, 0x6a, 0x90, 0x90, 0x23, 0x82, 0x29, 0xa6, + 0x07, 0x71, 0x92, 0x1e, 0xcc, 0x49, 0x7a, 0xae, 0x20, 0x27, 0x49, 0xc9, 0xe9, 0xa1, 0xb8, 0x5c, + 0x0f, 0xcd, 0x0d, 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, 0x4c, 0x62, + 0x03, 0x9b, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x27, 0xa4, 0xd8, 0x40, 0x01, 0x00, + 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/services/version/version.proto b/vendor/github.com/containerd/containerd/api/services/version/version.proto new file mode 100644 index 0000000000..a2ed79fd7d --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/version/version.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package containerd.v1; + +import "google/protobuf/empty.proto"; +import "gogoproto/gogo.proto"; + +service Version { + rpc Version(google.protobuf.Empty) returns (VersionResponse); +} + +message VersionResponse { + string version = 1; + string revision = 2; +} diff --git a/vendor/github.com/containerd/containerd/client.go b/vendor/github.com/containerd/containerd/client.go new file mode 100644 index 0000000000..6036eab2a1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/client.go @@ -0,0 +1,486 @@ +package containerd + +import ( + "context" + "fmt" + "io/ioutil" + "log" + "net/http" + "runtime" + "sync" + "time" + + "github.com/containerd/containerd/api/services/containers" + contentapi "github.com/containerd/containerd/api/services/content" + diffapi "github.com/containerd/containerd/api/services/diff" + "github.com/containerd/containerd/api/services/execution" + imagesapi "github.com/containerd/containerd/api/services/images" + namespacesapi "github.com/containerd/containerd/api/services/namespaces" + snapshotapi "github.com/containerd/containerd/api/services/snapshot" + versionservice "github.com/containerd/containerd/api/services/version" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/remotes" + "github.com/containerd/containerd/remotes/docker" + "github.com/containerd/containerd/remotes/docker/schema1" + contentservice "github.com/containerd/containerd/services/content" + "github.com/containerd/containerd/services/diff" + diffservice "github.com/containerd/containerd/services/diff" + imagesservice "github.com/containerd/containerd/services/images" + snapshotservice "github.com/containerd/containerd/services/snapshot" + "github.com/containerd/containerd/snapshot" + pempty "github.com/golang/protobuf/ptypes/empty" + "github.com/opencontainers/image-spec/identity" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + "google.golang.org/grpc" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/health/grpc_health_v1" +) + +func init() { + // reset the grpc logger so that it does not output in the STDIO of the calling process + grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags)) +} + +type clientOpts struct { + defaultns string +} + +type ClientOpt func(c *clientOpts) error + +func WithDefaultNamespace(ns string) ClientOpt { + return func(c *clientOpts) error { + c.defaultns = ns + return nil + } +} + +// New returns a new containerd client that is connected to the containerd +// instance provided by address +func New(address string, opts ...ClientOpt) (*Client, error) { + var copts clientOpts + for _, o := range opts { + if err := o(&copts); err != nil { + return nil, err + } + } + + gopts := []grpc.DialOption{ + grpc.WithInsecure(), + grpc.WithTimeout(100 * time.Second), + grpc.WithDialer(dialer), + } + if copts.defaultns != "" { + unary, stream := newNSInterceptors(copts.defaultns) + gopts = append(gopts, + grpc.WithUnaryInterceptor(unary), + grpc.WithStreamInterceptor(stream), + ) + } + + conn, err := grpc.Dial(dialAddress(address), gopts...) + if err != nil { + return nil, errors.Wrapf(err, "failed to dial %q", address) + } + return &Client{ + conn: conn, + runtime: fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS), + }, nil +} + +// Client is the client to interact with containerd and its various services +// using a uniform interface +type Client struct { + conn *grpc.ClientConn + + defaultns string + runtime string +} + +func (c *Client) IsServing(ctx context.Context) (bool, error) { + r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}) + if err != nil { + return false, err + } + return r.Status == grpc_health_v1.HealthCheckResponse_SERVING, nil +} + +// Containers returns all containers created in containerd +func (c *Client) Containers(ctx context.Context) ([]Container, error) { + r, err := c.ContainerService().List(ctx, &containers.ListContainersRequest{}) + if err != nil { + return nil, err + } + var out []Container + for _, container := range r.Containers { + out = append(out, containerFromProto(c, container)) + } + return out, nil +} + +type NewContainerOpts func(ctx context.Context, client *Client, c *containers.Container) error + +// WithContainerLabels adds the provided labels to the container +func WithContainerLabels(labels map[string]string) NewContainerOpts { + return func(_ context.Context, _ *Client, c *containers.Container) error { + c.Labels = labels + return nil + } +} + +// WithExistingRootFS uses an existing root filesystem for the container +func WithExistingRootFS(id string) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + // check that the snapshot exists, if not, fail on creation + if _, err := client.SnapshotService().Mounts(ctx, id); err != nil { + return err + } + c.RootFS = id + return nil + } +} + +// WithNewRootFS allocates a new snapshot to be used by the container as the +// root filesystem in read-write mode +func WithNewRootFS(id string, i Image) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + diffIDs, err := i.(*image).i.RootFS(ctx, client.ContentStore()) + if err != nil { + return err + } + if _, err := client.SnapshotService().Prepare(ctx, id, identity.ChainID(diffIDs).String()); err != nil { + return err + } + c.RootFS = id + c.Image = i.Name() + return nil + } +} + +// WithNewReadonlyRootFS allocates a new snapshot to be used by the container as the +// root filesystem in read-only mode +func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + diffIDs, err := i.(*image).i.RootFS(ctx, client.ContentStore()) + if err != nil { + return err + } + if _, err := client.SnapshotService().View(ctx, id, identity.ChainID(diffIDs).String()); err != nil { + return err + } + c.RootFS = id + c.Image = i.Name() + return nil + } +} + +func WithRuntime(name string) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + c.Runtime = name + return nil + } +} + +func WithImage(i Image) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + c.Image = i.Name() + return nil + } +} + +// NewContainer will create a new container in container with the provided id +// the id must be unique within the namespace +func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { + container := containers.Container{ + ID: id, + Runtime: c.runtime, + } + for _, o := range opts { + if err := o(ctx, c, &container); err != nil { + return nil, err + } + } + r, err := c.ContainerService().Create(ctx, &containers.CreateContainerRequest{ + Container: container, + }) + if err != nil { + return nil, err + } + return containerFromProto(c, r.Container), nil +} + +func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error) { + response, err := c.ContainerService().Get(ctx, &containers.GetContainerRequest{ + ID: id, + }) + if err != nil { + return nil, err + } + return containerFromProto(c, response.Container), nil +} + +type RemoteOpts func(*Client, *RemoteContext) error + +// RemoteContext is used to configure object resolutions and transfers with +// remote content stores and image providers. +type RemoteContext struct { + // Resolver is used to resolve names to objects, fetchers, and pushers. + // If no resolver is provided, defaults to Docker registry resolver. + Resolver remotes.Resolver + + // Unpack is done after an image is pulled to extract into a snapshotter. + // If an image is not unpacked on pull, it can be unpacked any time + // afterwards. Unpacking is required to run an image. + Unpack bool + + // BaseHandlers are a set of handlers which get are called on dispatch. + // These handlers always get called before any operation specific + // handlers. + BaseHandlers []images.Handler + + // ConvertSchema1 is whether to convert Docker registry schema 1 + // manifests. If this option is false then any image which resolves + // to schema 1 will return an error since schema 1 is not supported. + ConvertSchema1 bool +} + +func defaultRemoteContext() *RemoteContext { + return &RemoteContext{ + Resolver: docker.NewResolver(docker.ResolverOptions{ + Client: http.DefaultClient, + }), + } +} + +// WithPullUnpack is used to unpack an image after pull. This +// uses the snapshotter, content store, and diff service +// configured for the client. +func WithPullUnpack(client *Client, c *RemoteContext) error { + c.Unpack = true + return nil +} + +// WithSchema1Conversion is used to convert Docker registry schema 1 +// manifests to oci manifests on pull. Without this option schema 1 +// manifests will return a not supported error. +func WithSchema1Conversion(client *Client, c *RemoteContext) error { + c.ConvertSchema1 = true + return nil +} + +// WithResolver specifies the resolver to use. +func WithResolver(resolver remotes.Resolver) RemoteOpts { + return func(client *Client, c *RemoteContext) error { + c.Resolver = resolver + return nil + } +} + +// WithImageHandler adds a base handler to be called on dispatch. +func WithImageHandler(h images.Handler) RemoteOpts { + return func(client *Client, c *RemoteContext) error { + c.BaseHandlers = append(c.BaseHandlers, h) + return nil + } +} + +func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpts) (Image, error) { + pullCtx := defaultRemoteContext() + for _, o := range opts { + if err := o(c, pullCtx); err != nil { + return nil, err + } + } + store := c.ContentStore() + + name, desc, err := pullCtx.Resolver.Resolve(ctx, ref) + if err != nil { + return nil, err + } + fetcher, err := pullCtx.Resolver.Fetcher(ctx, name) + if err != nil { + return nil, err + } + + var ( + schema1Converter *schema1.Converter + handler images.Handler + ) + if desc.MediaType == images.MediaTypeDockerSchema1Manifest && pullCtx.ConvertSchema1 { + schema1Converter = schema1.NewConverter(store, fetcher) + handler = images.Handlers(append(pullCtx.BaseHandlers, schema1Converter)...) + } else { + handler = images.Handlers(append(pullCtx.BaseHandlers, + remotes.FetchHandler(store, fetcher), + images.ChildrenHandler(store))..., + ) + } + + if err := images.Dispatch(ctx, handler, desc); err != nil { + return nil, err + } + if schema1Converter != nil { + desc, err = schema1Converter.Convert(ctx) + if err != nil { + return nil, err + } + } + + is := c.ImageService() + if err := is.Put(ctx, name, desc); err != nil { + return nil, err + } + i, err := is.Get(ctx, name) + if err != nil { + return nil, err + } + img := &image{ + client: c, + i: i, + } + if pullCtx.Unpack { + if err := img.Unpack(ctx); err != nil { + return nil, err + } + } + return img, nil +} + +func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpts) error { + pushCtx := defaultRemoteContext() + for _, o := range opts { + if err := o(c, pushCtx); err != nil { + return err + } + } + + pusher, err := pushCtx.Resolver.Pusher(ctx, ref) + if err != nil { + return err + } + + var m sync.Mutex + manifestStack := []ocispec.Descriptor{} + + filterHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case images.MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest, + images.MediaTypeDockerSchema2ManifestList, ocispec.MediaTypeImageIndex: + m.Lock() + manifestStack = append(manifestStack, desc) + m.Unlock() + return nil, images.StopHandler + default: + return nil, nil + } + }) + + cs := c.ContentStore() + pushHandler := remotes.PushHandler(cs, pusher) + + handlers := append(pushCtx.BaseHandlers, + images.ChildrenHandler(cs), + filterHandler, + pushHandler, + ) + + if err := images.Dispatch(ctx, images.Handlers(handlers...), desc); err != nil { + return err + } + + // Iterate in reverse order as seen, parent always uploaded after child + for i := len(manifestStack) - 1; i >= 0; i-- { + _, err := pushHandler(ctx, manifestStack[i]) + if err != nil { + return err + } + } + return nil +} + +// GetImage returns an existing image +func (c *Client) GetImage(ctx context.Context, ref string) (Image, error) { + i, err := c.ImageService().Get(ctx, ref) + if err != nil { + return nil, err + } + return &image{ + client: c, + i: i, + }, nil +} + +// ListImages returns all existing images +func (c *Client) ListImages(ctx context.Context) ([]Image, error) { + imgs, err := c.ImageService().List(ctx) + if err != nil { + return nil, err + } + images := make([]Image, len(imgs)) + for i, img := range imgs { + images[i] = &image{ + client: c, + i: img, + } + } + return images, nil +} + +// Close closes the clients connection to containerd +func (c *Client) Close() error { + return c.conn.Close() +} + +func (c *Client) NamespaceService() namespacesapi.NamespacesClient { + return namespacesapi.NewNamespacesClient(c.conn) +} + +func (c *Client) ContainerService() containers.ContainersClient { + return containers.NewContainersClient(c.conn) +} + +func (c *Client) ContentStore() content.Store { + return contentservice.NewStoreFromClient(contentapi.NewContentClient(c.conn)) +} + +func (c *Client) SnapshotService() snapshot.Snapshotter { + return snapshotservice.NewSnapshotterFromClient(snapshotapi.NewSnapshotClient(c.conn)) +} + +func (c *Client) TaskService() execution.TasksClient { + return execution.NewTasksClient(c.conn) +} + +func (c *Client) ImageService() images.Store { + return imagesservice.NewStoreFromClient(imagesapi.NewImagesClient(c.conn)) +} + +func (c *Client) DiffService() diff.DiffService { + return diffservice.NewDiffServiceFromClient(diffapi.NewDiffClient(c.conn)) +} + +func (c *Client) HealthService() grpc_health_v1.HealthClient { + return grpc_health_v1.NewHealthClient(c.conn) +} + +func (c *Client) VersionService() versionservice.VersionClient { + return versionservice.NewVersionClient(c.conn) +} + +type Version struct { + Version string + Revision string +} + +func (c *Client) Version(ctx context.Context) (Version, error) { + response, err := c.VersionService().Version(ctx, &pempty.Empty{}) + if err != nil { + return Version{}, err + } + return Version{ + Version: response.Version, + Revision: response.Revision, + }, nil +} diff --git a/vendor/github.com/containerd/containerd/client_unix.go b/vendor/github.com/containerd/containerd/client_unix.go new file mode 100644 index 0000000000..d5a9f63ec3 --- /dev/null +++ b/vendor/github.com/containerd/containerd/client_unix.go @@ -0,0 +1,19 @@ +// +build !windows + +package containerd + +import ( + "fmt" + "net" + "strings" + "time" +) + +func dialer(address string, timeout time.Duration) (net.Conn, error) { + address = strings.TrimPrefix(address, "unix://") + return net.DialTimeout("unix", address, timeout) +} + +func dialAddress(address string) string { + return fmt.Sprintf("unix://%s", address) +} diff --git a/vendor/github.com/containerd/containerd/client_windows.go b/vendor/github.com/containerd/containerd/client_windows.go new file mode 100644 index 0000000000..548024e5bd --- /dev/null +++ b/vendor/github.com/containerd/containerd/client_windows.go @@ -0,0 +1,16 @@ +package containerd + +import ( + "net" + "time" + + winio "github.com/Microsoft/go-winio" +) + +func dialer(address string, timeout time.Duration) (net.Conn, error) { + return winio.DialPipe(address, &timeout) +} + +func dialAddress(address string) string { + return address +} diff --git a/vendor/github.com/containerd/containerd/container.go b/vendor/github.com/containerd/containerd/container.go new file mode 100644 index 0000000000..70efc8c0f4 --- /dev/null +++ b/vendor/github.com/containerd/containerd/container.go @@ -0,0 +1,222 @@ +package containerd + +import ( + "context" + "encoding/json" + "path/filepath" + "sync" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + + "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/types/mount" + specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/pkg/errors" +) + +var ( + ErrNoImage = errors.New("container does not have an image") + ErrNoRunningTask = errors.New("no running task") +) + +type Container interface { + ID() string + Proto() containers.Container + Delete(context.Context) error + NewTask(context.Context, IOCreation, ...NewTaskOpts) (Task, error) + Spec() (*specs.Spec, error) + Task(context.Context, IOAttach) (Task, error) + Image(context.Context) (Image, error) +} + +func containerFromProto(client *Client, c containers.Container) *container { + return &container{ + client: client, + c: c, + } +} + +var _ = (Container)(&container{}) + +type container struct { + mu sync.Mutex + + client *Client + c containers.Container + task *task +} + +// ID returns the container's unique id +func (c *container) ID() string { + return c.c.ID +} + +func (c *container) Proto() containers.Container { + return c.c +} + +// Spec returns the current OCI specification for the container +func (c *container) Spec() (*specs.Spec, error) { + var s specs.Spec + if err := json.Unmarshal(c.c.Spec.Value, &s); err != nil { + return nil, err + } + return &s, nil +} + +// Delete deletes an existing container +// an error is returned if the container has running tasks +func (c *container) Delete(ctx context.Context) (err error) { + // TODO: should the client be the one removing resources attached + // to the container at the moment before we have GC? + if c.c.RootFS != "" { + err = c.client.SnapshotService().Remove(ctx, c.c.RootFS) + } + if _, cerr := c.client.ContainerService().Delete(ctx, &containers.DeleteContainerRequest{ + ID: c.c.ID, + }); err == nil { + err = cerr + } + return err +} + +func (c *container) Task(ctx context.Context, attach IOAttach) (Task, error) { + c.mu.Lock() + defer c.mu.Unlock() + if c.task == nil { + t, err := c.loadTask(ctx, attach) + if err != nil { + return nil, err + } + c.task = t.(*task) + } + return c.task, nil +} + +// Image returns the image that the container is based on +func (c *container) Image(ctx context.Context) (Image, error) { + if c.c.Image == "" { + return nil, ErrNoImage + } + i, err := c.client.ImageService().Get(ctx, c.c.Image) + if err != nil { + return nil, err + } + return &image{ + client: c.client, + i: i, + }, nil +} + +type NewTaskOpts func(context.Context, *Client, *execution.CreateRequest) error + +func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...NewTaskOpts) (Task, error) { + c.mu.Lock() + defer c.mu.Unlock() + i, err := ioCreate() + if err != nil { + return nil, err + } + request := &execution.CreateRequest{ + ContainerID: c.c.ID, + Terminal: i.Terminal, + Stdin: i.Stdin, + Stdout: i.Stdout, + Stderr: i.Stderr, + } + if c.c.RootFS != "" { + // get the rootfs from the snapshotter and add it to the request + mounts, err := c.client.SnapshotService().Mounts(ctx, c.c.RootFS) + if err != nil { + return nil, err + } + for _, m := range mounts { + request.Rootfs = append(request.Rootfs, &mount.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + }) + } + } + for _, o := range opts { + if err := o(ctx, c.client, request); err != nil { + return nil, err + } + } + t := &task{ + client: c.client, + io: i, + containerID: c.ID(), + pidSync: make(chan struct{}), + } + + if request.Checkpoint != nil { + // we need to defer the create call to start + t.deferred = request + } else { + response, err := c.client.TaskService().Create(ctx, request) + if err != nil { + return nil, err + } + t.pid = response.Pid + close(t.pidSync) + } + c.task = t + return t, nil +} + +func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, error) { + response, err := c.client.TaskService().Info(ctx, &execution.InfoRequest{ + ContainerID: c.c.ID, + }) + if err != nil { + if grpc.Code(errors.Cause(err)) == codes.NotFound { + return nil, ErrNoRunningTask + } + return nil, err + } + var i *IO + if ioAttach != nil { + // get the existing fifo paths from the task information stored by the daemon + paths := &FifoSet{ + Dir: getFifoDir([]string{ + response.Task.Stdin, + response.Task.Stdout, + response.Task.Stderr, + }), + In: response.Task.Stdin, + Out: response.Task.Stdout, + Err: response.Task.Stderr, + Terminal: response.Task.Terminal, + } + if i, err = ioAttach(paths); err != nil { + return nil, err + } + } + // create and close a channel on load as we already have the pid + // and don't want to block calls to Wait(), etc... + ps := make(chan struct{}) + close(ps) + t := &task{ + client: c.client, + io: i, + containerID: response.Task.ContainerID, + pid: response.Task.Pid, + pidSync: ps, + } + c.task = t + return t, nil +} + +// getFifoDir looks for any non-empty path for a stdio fifo +// and returns the dir for where it is located +func getFifoDir(paths []string) string { + for _, p := range paths { + if p != "" { + return filepath.Dir(p) + } + } + return "" +} diff --git a/vendor/github.com/containerd/containerd/container_unix.go b/vendor/github.com/containerd/containerd/container_unix.go new file mode 100644 index 0000000000..8a97daa892 --- /dev/null +++ b/vendor/github.com/containerd/containerd/container_unix.go @@ -0,0 +1,115 @@ +// +build !windows + +package containerd + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + + "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/types/descriptor" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/snapshot" + protobuf "github.com/gogo/protobuf/types" + digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/image-spec/identity" + "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts { + // set image and rw, and spec + return func(ctx context.Context, client *Client, c *containers.Container) error { + id := desc.Digest + store := client.ContentStore() + index, err := decodeIndex(ctx, store, id) + if err != nil { + return err + } + var rw *v1.Descriptor + for _, m := range index.Manifests { + switch m.MediaType { + case v1.MediaTypeImageLayer: + fk := m + rw = &fk + case images.MediaTypeDockerSchema2Manifest: + config, err := images.Config(ctx, store, m) + if err != nil { + return err + } + diffIDs, err := images.RootFS(ctx, store, config) + if err != nil { + return err + } + if _, err := client.SnapshotService().Prepare(ctx, rootfsID, identity.ChainID(diffIDs).String()); err != nil { + if !snapshot.IsExist(err) { + return err + } + } + c.Image = index.Annotations["image.name"] + case images.MediaTypeContainerd1CheckpointConfig: + r, err := store.Reader(ctx, m.Digest) + if err != nil { + return err + } + data, err := ioutil.ReadAll(r) + r.Close() + if err != nil { + return err + } + c.Spec = &protobuf.Any{ + TypeUrl: specs.Version, + Value: data, + } + } + } + if rw != nil { + // apply the rw snapshot to the new rw layer + mounts, err := client.SnapshotService().Mounts(ctx, rootfsID) + if err != nil { + return err + } + if _, err := client.DiffService().Apply(ctx, *rw, mounts); err != nil { + return err + } + } + c.RootFS = rootfsID + return nil + } +} + +func WithTaskCheckpoint(desc v1.Descriptor) NewTaskOpts { + return func(ctx context.Context, c *Client, r *execution.CreateRequest) error { + id := desc.Digest + index, err := decodeIndex(ctx, c.ContentStore(), id) + if err != nil { + return err + } + for _, m := range index.Manifests { + if m.MediaType == images.MediaTypeContainerd1Checkpoint { + r.Checkpoint = &descriptor.Descriptor{ + MediaType: m.MediaType, + Size_: m.Size, + Digest: m.Digest, + } + return nil + } + } + return fmt.Errorf("checkpoint not found in index %s", id) + } +} + +func decodeIndex(ctx context.Context, store content.Store, id digest.Digest) (*v1.Index, error) { + var index v1.Index + r, err := store.Reader(ctx, id) + if err != nil { + return nil, err + } + err = json.NewDecoder(r).Decode(&index) + r.Close() + return &index, err +} diff --git a/vendor/github.com/containerd/containerd/grpc.go b/vendor/github.com/containerd/containerd/grpc.go new file mode 100644 index 0000000000..c56eeada34 --- /dev/null +++ b/vendor/github.com/containerd/containerd/grpc.go @@ -0,0 +1,35 @@ +package containerd + +import ( + "github.com/containerd/containerd/namespaces" + "golang.org/x/net/context" + "google.golang.org/grpc" +) + +type namespaceInterceptor struct { + namespace string +} + +func (ni namespaceInterceptor) unary(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + _, ok := namespaces.Namespace(ctx) + if !ok { + ctx = namespaces.WithNamespace(ctx, ni.namespace) + } + return invoker(ctx, method, req, reply, cc, opts...) +} + +func (ni namespaceInterceptor) stream(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + _, ok := namespaces.Namespace(ctx) + if !ok { + ctx = namespaces.WithNamespace(ctx, ni.namespace) + } + + return streamer(ctx, desc, cc, method, opts...) +} + +func newNSInterceptors(ns string) (grpc.UnaryClientInterceptor, grpc.StreamClientInterceptor) { + ni := namespaceInterceptor{ + namespace: ns, + } + return grpc.UnaryClientInterceptor(ni.unary), grpc.StreamClientInterceptor(ni.stream) +} diff --git a/vendor/github.com/containerd/containerd/image.go b/vendor/github.com/containerd/containerd/image.go new file mode 100644 index 0000000000..ee703432cd --- /dev/null +++ b/vendor/github.com/containerd/containerd/image.go @@ -0,0 +1,76 @@ +package containerd + +import ( + "context" + "encoding/json" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/rootfs" + "github.com/opencontainers/image-spec/specs-go/v1" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +type Image interface { + Name() string + Target() ocispec.Descriptor + + Unpack(context.Context) error +} + +var _ = (Image)(&image{}) + +type image struct { + client *Client + + i images.Image +} + +func (i *image) Name() string { + return i.i.Name +} + +func (i *image) Target() ocispec.Descriptor { + return i.i.Target +} + +func (i *image) Unpack(ctx context.Context) error { + layers, err := i.getLayers(ctx) + if err != nil { + return err + } + if _, err := rootfs.ApplyLayers(ctx, layers, i.client.SnapshotService(), i.client.DiffService()); err != nil { + return err + } + return nil +} + +func (i *image) getLayers(ctx context.Context) ([]rootfs.Layer, error) { + cs := i.client.ContentStore() + p, err := content.ReadBlob(ctx, cs, i.i.Target.Digest) + if err != nil { + return nil, errors.Wrapf(err, "failed to read manifest blob") + } + var manifest v1.Manifest + if err := json.Unmarshal(p, &manifest); err != nil { + return nil, errors.Wrap(err, "failed to unmarshal manifest") + } + diffIDs, err := i.i.RootFS(ctx, cs) + if err != nil { + return nil, errors.Wrap(err, "failed to resolve rootfs") + } + if len(diffIDs) != len(manifest.Layers) { + return nil, errors.Errorf("mismatched image rootfs and manifest layers") + } + layers := make([]rootfs.Layer, len(diffIDs)) + for i := range diffIDs { + layers[i].Diff = v1.Descriptor{ + // TODO: derive media type from compressed type + MediaType: v1.MediaTypeImageLayer, + Digest: diffIDs[i], + } + layers[i].Blob = manifest.Layers[i] + } + return layers, nil +} diff --git a/vendor/github.com/containerd/containerd/io.go b/vendor/github.com/containerd/containerd/io.go new file mode 100644 index 0000000000..e3c56d909f --- /dev/null +++ b/vendor/github.com/containerd/containerd/io.go @@ -0,0 +1,140 @@ +package containerd + +import ( + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "sync" +) + +type IO struct { + Terminal bool + Stdin string + Stdout string + Stderr string + + closer io.Closer +} + +func (i *IO) Close() error { + if i.closer == nil { + return nil + } + return i.closer.Close() +} + +type IOCreation func() (*IO, error) + +type IOAttach func(*FifoSet) (*IO, error) + +func NewIO(stdin io.Reader, stdout, stderr io.Writer) IOCreation { + return NewIOWithTerminal(stdin, stdout, stderr, false) +} + +func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) IOCreation { + return func() (*IO, error) { + paths, err := NewFifos() + if err != nil { + return nil, err + } + i := &IO{ + Terminal: terminal, + Stdout: paths.Out, + Stderr: paths.Err, + Stdin: paths.In, + } + set := &ioSet{ + in: stdin, + out: stdout, + err: stderr, + } + closer, err := copyIO(paths, set, i.Terminal) + if err != nil { + return nil, err + } + i.closer = closer + return i, nil + } + +} + +func WithAttach(stdin io.Reader, stdout, stderr io.Writer) IOAttach { + return func(paths *FifoSet) (*IO, error) { + if paths == nil { + return nil, fmt.Errorf("cannot attach to existing fifos") + } + i := &IO{ + Terminal: paths.Terminal, + Stdout: paths.Out, + Stderr: paths.Err, + Stdin: paths.In, + } + set := &ioSet{ + in: stdin, + out: stdout, + err: stderr, + } + closer, err := copyIO(paths, set, i.Terminal) + if err != nil { + return nil, err + } + i.closer = closer + return i, nil + } +} + +// Stdio returns an IO implementation to be used for a task +// that outputs the container's IO as the current processes Stdio +func Stdio() (*IO, error) { + return NewIO(os.Stdin, os.Stdout, os.Stderr)() +} + +// StdioTerminal will setup the IO for the task to use a terminal +func StdioTerminal() (*IO, error) { + return NewIOWithTerminal(os.Stdin, os.Stdout, os.Stderr, true)() +} + +// NewFifos returns a new set of fifos for the task +func NewFifos() (*FifoSet, error) { + root := filepath.Join(os.TempDir(), "containerd") + if err := os.MkdirAll(root, 0700); err != nil { + return nil, err + } + dir, err := ioutil.TempDir(root, "") + if err != nil { + return nil, err + } + return &FifoSet{ + Dir: dir, + In: filepath.Join(dir, "stdin"), + Out: filepath.Join(dir, "stdout"), + Err: filepath.Join(dir, "stderr"), + }, nil +} + +type FifoSet struct { + // Dir is the directory holding the task fifos + Dir string + In, Out, Err string + Terminal bool +} + +type ioSet struct { + in io.Reader + out, err io.Writer +} + +type wgCloser struct { + wg *sync.WaitGroup + dir string +} + +func (g *wgCloser) Close() error { + g.wg.Wait() + if g.dir != "" { + return os.RemoveAll(g.dir) + } + return nil +} diff --git a/vendor/github.com/containerd/containerd/io_unix.go b/vendor/github.com/containerd/containerd/io_unix.go new file mode 100644 index 0000000000..5c0cf0091b --- /dev/null +++ b/vendor/github.com/containerd/containerd/io_unix.go @@ -0,0 +1,71 @@ +// +build !windows + +package containerd + +import ( + "context" + "io" + "sync" + "syscall" + + "github.com/containerd/fifo" +) + +func copyIO(fifos *FifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) { + var ( + f io.ReadWriteCloser + ctx = context.Background() + wg = &sync.WaitGroup{} + ) + + if f, err = fifo.OpenFifo(ctx, fifos.In, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil { + return nil, err + } + defer func(c io.Closer) { + if err != nil { + c.Close() + } + }(f) + go func(w io.WriteCloser) { + io.Copy(w, ioset.in) + w.Close() + }(f) + + if f, err = fifo.OpenFifo(ctx, fifos.Out, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil { + return nil, err + } + defer func(c io.Closer) { + if err != nil { + c.Close() + } + }(f) + wg.Add(1) + go func(r io.ReadCloser) { + io.Copy(ioset.out, r) + r.Close() + wg.Done() + }(f) + + if f, err = fifo.OpenFifo(ctx, fifos.Err, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); err != nil { + return nil, err + } + defer func(c io.Closer) { + if err != nil { + c.Close() + } + }(f) + + if !tty { + wg.Add(1) + go func(r io.ReadCloser) { + io.Copy(ioset.err, r) + r.Close() + wg.Done() + }(f) + } + + return &wgCloser{ + wg: wg, + dir: fifos.Dir, + }, nil +} diff --git a/vendor/github.com/containerd/containerd/io_windows.go b/vendor/github.com/containerd/containerd/io_windows.go new file mode 100644 index 0000000000..2fb97566ca --- /dev/null +++ b/vendor/github.com/containerd/containerd/io_windows.go @@ -0,0 +1,93 @@ +package containerd + +import ( + "io" + "net" + "sync" + + winio "github.com/Microsoft/go-winio" + "github.com/containerd/containerd/log" + "github.com/pkg/errors" +) + +func copyIO(fifos *FifoSet, ioset *ioSet, tty bool) (closer io.Closer, err error) { + var wg sync.WaitGroup + + if fifos.In != "" { + l, err := winio.ListenPipe(fifos.In, nil) + if err != nil { + return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.In) + } + defer func(l net.Listener) { + if err != nil { + l.Close() + } + }(l) + + go func() { + c, err := l.Accept() + if err != nil { + log.L.WithError(err).Errorf("failed to accept stdin connection on %s", fifos.In) + return + } + io.Copy(c, ioset.in) + c.Close() + l.Close() + }() + } + + if fifos.Out != "" { + l, err := winio.ListenPipe(fifos.Out, nil) + if err != nil { + return nil, errors.Wrapf(err, "failed to create stdin pipe %s", fifos.Out) + } + defer func(l net.Listener) { + if err != nil { + l.Close() + } + }(l) + + wg.Add(1) + go func() { + defer wg.Done() + c, err := l.Accept() + if err != nil { + log.L.WithError(err).Errorf("failed to accept stdout connection on %s", fifos.Out) + return + } + io.Copy(ioset.out, c) + c.Close() + l.Close() + }() + } + + if !tty && fifos.Err != "" { + l, err := winio.ListenPipe(fifos.Err, nil) + if err != nil { + return nil, errors.Wrapf(err, "failed to create stderr pipe %s", fifos.Err) + } + defer func(l net.Listener) { + if err != nil { + l.Close() + } + }(l) + + wg.Add(1) + go func() { + defer wg.Done() + c, err := l.Accept() + if err != nil { + log.L.WithError(err).Errorf("failed to accept stderr connection on %s", fifos.Err) + return + } + io.Copy(ioset.err, c) + c.Close() + l.Close() + }() + } + + return &wgCloser{ + wg: &wg, + dir: fifos.Dir, + }, nil +} diff --git a/vendor/github.com/containerd/containerd/process.go b/vendor/github.com/containerd/containerd/process.go new file mode 100644 index 0000000000..e4f3e092a5 --- /dev/null +++ b/vendor/github.com/containerd/containerd/process.go @@ -0,0 +1,124 @@ +package containerd + +import ( + "context" + "encoding/json" + "syscall" + + "github.com/containerd/containerd/api/services/execution" + taskapi "github.com/containerd/containerd/api/types/task" + protobuf "github.com/gogo/protobuf/types" + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +type process struct { + task *task + + // this is a hack to make a blocking Wait work + // exec does not have a create/start split so if a quick exiting process like `exit 1` + // run, the wait does not have enough time to get the pid catch the event. So we need + // to lock this on process struct create and only unlock it after the pid is set + // this allow the wait to be called before calling process start and not race with the exit event + pidSync chan struct{} + + io *IO + pid uint32 + spec *specs.Process +} + +// Pid returns the pid of the process +// The pid is not set until start is called and returns +func (p *process) Pid() uint32 { + return p.pid +} + +// Start starts the exec process +func (p *process) Start(ctx context.Context) error { + data, err := json.Marshal(p.spec) + if err != nil { + return err + } + request := &execution.ExecRequest{ + ContainerID: p.task.containerID, + Terminal: p.io.Terminal, + Stdin: p.io.Stdin, + Stdout: p.io.Stdout, + Stderr: p.io.Stderr, + Spec: &protobuf.Any{ + TypeUrl: specs.Version, + Value: data, + }, + } + response, err := p.task.client.TaskService().Exec(ctx, request) + if err != nil { + return err + } + p.pid = response.Pid + close(p.pidSync) + return nil +} + +func (p *process) Kill(ctx context.Context, s syscall.Signal) error { + _, err := p.task.client.TaskService().Kill(ctx, &execution.KillRequest{ + Signal: uint32(s), + ContainerID: p.task.containerID, + PidOrAll: &execution.KillRequest_Pid{ + Pid: p.pid, + }, + }) + return err +} + +func (p *process) Wait(ctx context.Context) (uint32, error) { + events, err := p.task.client.TaskService().Events(ctx, &execution.EventsRequest{}) + if err != nil { + return UnknownExitStatus, err + } + <-p.pidSync + for { + e, err := events.Recv() + if err != nil { + return UnknownExitStatus, err + } + if e.Type != taskapi.Event_EXIT { + continue + } + if e.ID == p.task.containerID && e.Pid == p.pid { + return e.ExitStatus, nil + } + } +} + +func (p *process) CloseStdin(ctx context.Context) error { + _, err := p.task.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{ + ContainerID: p.task.containerID, + Pid: p.pid, + }) + return err +} + +func (p *process) IO() *IO { + return p.io +} + +func (p *process) Resize(ctx context.Context, w, h uint32) error { + _, err := p.task.client.TaskService().Pty(ctx, &execution.PtyRequest{ + ContainerID: p.task.containerID, + Width: w, + Height: h, + Pid: p.pid, + }) + return err +} + +func (p *process) Delete(ctx context.Context) (uint32, error) { + cerr := p.io.Close() + r, err := p.task.client.TaskService().DeleteProcess(ctx, &execution.DeleteProcessRequest{ + ContainerID: p.task.containerID, + Pid: p.pid, + }) + if err != nil { + return UnknownExitStatus, err + } + return r.ExitStatus, cerr +} diff --git a/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go b/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go new file mode 100644 index 0000000000..cc36c647c7 --- /dev/null +++ b/vendor/github.com/containerd/containerd/remotes/docker/schema1/converter.go @@ -0,0 +1,449 @@ +package schema1 + +import ( + "bytes" + "compress/gzip" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "strings" + "sync" + "time" + + "golang.org/x/sync/errgroup" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/images" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/remotes" + digest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +var ( + mediaTypeManifest = "application/vnd.docker.distribution.manifest.v1+json" +) + +type blobState struct { + diffID digest.Digest + empty bool +} + +// Converter converts schema1 manifests to schema2 on fetch +type Converter struct { + contentStore content.Store + fetcher remotes.Fetcher + + pulledManifest *manifest + + mu sync.Mutex + blobMap map[digest.Digest]blobState + layerBlobs map[digest.Digest]ocispec.Descriptor +} + +func NewConverter(contentStore content.Store, fetcher remotes.Fetcher) *Converter { + return &Converter{ + contentStore: contentStore, + fetcher: fetcher, + blobMap: map[digest.Digest]blobState{}, + layerBlobs: map[digest.Digest]ocispec.Descriptor{}, + } +} + +func (c *Converter) Handle(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + switch desc.MediaType { + case images.MediaTypeDockerSchema1Manifest: + if err := c.fetchManifest(ctx, desc); err != nil { + return nil, err + } + + m := c.pulledManifest + if len(m.FSLayers) != len(m.History) { + return nil, errors.New("invalid schema 1 manifest, history and layer mismatch") + } + descs := make([]ocispec.Descriptor, 0, len(c.pulledManifest.FSLayers)) + + for i := range m.FSLayers { + if _, ok := c.blobMap[c.pulledManifest.FSLayers[i].BlobSum]; !ok { + empty, err := isEmptyLayer([]byte(m.History[i].V1Compatibility)) + if err != nil { + return nil, err + } + + // Do no attempt to download a known empty blob + if !empty { + descs = append([]ocispec.Descriptor{ + { + MediaType: images.MediaTypeDockerSchema2LayerGzip, + Digest: c.pulledManifest.FSLayers[i].BlobSum, + }, + }, descs...) + } + c.blobMap[c.pulledManifest.FSLayers[i].BlobSum] = blobState{ + empty: empty, + } + } + } + return descs, nil + case images.MediaTypeDockerSchema2LayerGzip: + if c.pulledManifest == nil { + return nil, errors.New("manifest required for schema 1 blob pull") + } + return nil, c.fetchBlob(ctx, desc) + default: + return nil, fmt.Errorf("%v not support for schema 1 manifests", desc.MediaType) + } +} + +func (c *Converter) Convert(ctx context.Context) (ocispec.Descriptor, error) { + history, diffIDs, err := c.schema1ManifestHistory() + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "schema 1 conversion failed") + } + + var img ocispec.Image + if err := json.Unmarshal([]byte(c.pulledManifest.History[0].V1Compatibility), &img); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to unmarshal image from schema 1 history") + } + + img.History = history + img.RootFS = ocispec.RootFS{ + Type: "layers", + DiffIDs: diffIDs, + } + + b, err := json.Marshal(img) + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image") + } + + config := ocispec.Descriptor{ + MediaType: ocispec.MediaTypeImageConfig, + Digest: digest.Canonical.FromBytes(b), + Size: int64(len(b)), + } + + ref := remotes.MakeRefKey(ctx, config) + if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(b), config.Size, config.Digest); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to write config") + } + + layers := make([]ocispec.Descriptor, len(diffIDs)) + for i, diffID := range diffIDs { + layers[i] = c.layerBlobs[diffID] + } + + manifest := ocispec.Manifest{ + Versioned: specs.Versioned{ + SchemaVersion: 2, + }, + Config: config, + Layers: layers, + } + + b, err = json.Marshal(manifest) + if err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to marshal image") + } + + desc := ocispec.Descriptor{ + MediaType: ocispec.MediaTypeImageManifest, + Digest: digest.Canonical.FromBytes(b), + Size: int64(len(b)), + } + + ref = remotes.MakeRefKey(ctx, desc) + if err := content.WriteBlob(ctx, c.contentStore, ref, bytes.NewReader(b), desc.Size, desc.Digest); err != nil { + return ocispec.Descriptor{}, errors.Wrap(err, "failed to write config") + } + + return desc, nil +} + +func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor) error { + log.G(ctx).Debug("fetch schema 1") + + rc, err := c.fetcher.Fetch(ctx, desc) + if err != nil { + return err + } + + b, err := ioutil.ReadAll(rc) + rc.Close() + if err != nil { + return err + } + + b, err = stripSignature(b) + if err != nil { + return err + } + + var m manifest + if err := json.Unmarshal(b, &m); err != nil { + return err + } + c.pulledManifest = &m + + return nil +} + +func (c *Converter) fetchBlob(ctx context.Context, desc ocispec.Descriptor) error { + log.G(ctx).Debug("fetch blob") + + ref := remotes.MakeRefKey(ctx, desc) + + calc := newBlobStateCalculator() + + cw, err := c.contentStore.Writer(ctx, ref, desc.Size, desc.Digest) + if err != nil { + if !content.IsExists(err) { + return err + } + + // TODO: Check if blob -> diff id mapping already exists + // TODO: Check if blob empty label exists + + r, err := c.contentStore.Reader(ctx, desc.Digest) + if err != nil { + return err + } + defer r.Close() + + gr, err := gzip.NewReader(r) + defer gr.Close() + + _, err = io.Copy(calc, gr) + if err != nil { + return err + } + } else { + defer cw.Close() + + rc, err := c.fetcher.Fetch(ctx, desc) + if err != nil { + return err + } + defer rc.Close() + + eg, _ := errgroup.WithContext(ctx) + pr, pw := io.Pipe() + + eg.Go(func() error { + gr, err := gzip.NewReader(pr) + defer gr.Close() + + _, err = io.Copy(calc, gr) + pr.CloseWithError(err) + return err + }) + + eg.Go(func() error { + defer pw.Close() + return content.Copy(cw, io.TeeReader(rc, pw), desc.Size, desc.Digest) + }) + + if err := eg.Wait(); err != nil { + return err + } + + // TODO: Label blob + } + + if desc.Size == 0 { + info, err := c.contentStore.Info(ctx, desc.Digest) + if err != nil { + return errors.Wrap(err, "failed to get blob info") + } + desc.Size = info.Size + } + + state := calc.State() + + c.mu.Lock() + c.blobMap[desc.Digest] = state + c.layerBlobs[state.diffID] = desc + c.mu.Unlock() + + return nil +} +func (c *Converter) schema1ManifestHistory() ([]ocispec.History, []digest.Digest, error) { + if c.pulledManifest == nil { + return nil, nil, errors.New("missing schema 1 manifest for conversion") + } + m := *c.pulledManifest + + if len(m.History) == 0 { + return nil, nil, errors.New("no history") + } + + history := make([]ocispec.History, len(m.History)) + diffIDs := []digest.Digest{} + for i := range m.History { + var h v1History + if err := json.Unmarshal([]byte(m.History[i].V1Compatibility), &h); err != nil { + return nil, nil, errors.Wrap(err, "failed to unmarshal history") + } + + blobSum := m.FSLayers[i].BlobSum + + state := c.blobMap[blobSum] + + history[len(history)-i-1] = ocispec.History{ + Author: h.Author, + Comment: h.Comment, + Created: &h.Created, + CreatedBy: strings.Join(h.ContainerConfig.Cmd, " "), + EmptyLayer: state.empty, + } + + if !state.empty { + diffIDs = append([]digest.Digest{state.diffID}, diffIDs...) + + } + } + + return history, diffIDs, nil +} + +type fsLayer struct { + BlobSum digest.Digest `json:"blobSum"` +} + +type history struct { + V1Compatibility string `json:"v1Compatibility"` +} + +type manifest struct { + FSLayers []fsLayer `json:"fsLayers"` + History []history `json:"history"` +} + +type v1History struct { + Author string `json:"author,omitempty"` + Created time.Time `json:"created"` + Comment string `json:"comment,omitempty"` + ThrowAway *bool `json:"throwaway,omitempty"` + Size *int `json:"Size,omitempty"` // used before ThrowAway field + ContainerConfig struct { + Cmd []string `json:"Cmd,omitempty"` + } `json:"container_config,omitempty"` +} + +// isEmptyLayer returns whether the v1 compability history describes an +// empty layer. A return value of true indicates the layer is empty, +// however false does not indicate non-empty. +func isEmptyLayer(compatHistory []byte) (bool, error) { + var h v1History + if err := json.Unmarshal(compatHistory, &h); err != nil { + return false, err + } + + if h.ThrowAway != nil { + return *h.ThrowAway, nil + } + if h.Size != nil { + return *h.Size == 0, nil + } + + // If no `Size` or `throwaway` field is given, then + // it cannot be determined whether the layer is empty + // from the history, return false + return false, nil +} + +type signature struct { + Signatures []jsParsedSignature `json:"signatures"` +} + +type jsParsedSignature struct { + Protected string `json:"protected"` +} + +type protectedBlock struct { + Length int `json:"formatLength"` + Tail string `json:"formatTail"` +} + +// joseBase64UrlDecode decodes the given string using the standard base64 url +// decoder but first adds the appropriate number of trailing '=' characters in +// accordance with the jose specification. +// http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-31#section-2 +func joseBase64UrlDecode(s string) ([]byte, error) { + switch len(s) % 4 { + case 0: + case 2: + s += "==" + case 3: + s += "=" + default: + return nil, errors.New("illegal base64url string") + } + return base64.URLEncoding.DecodeString(s) +} + +func stripSignature(b []byte) ([]byte, error) { + var sig signature + if err := json.Unmarshal(b, &sig); err != nil { + return nil, err + } + if len(sig.Signatures) == 0 { + return nil, errors.New("no signatures") + } + pb, err := joseBase64UrlDecode(sig.Signatures[0].Protected) + if err != nil { + return nil, errors.Wrapf(err, "could not decode %s", sig.Signatures[0].Protected) + } + + var protected protectedBlock + if err := json.Unmarshal(pb, &protected); err != nil { + return nil, err + } + + if protected.Length > len(b) { + return nil, errors.New("invalid protected length block") + } + + tail, err := joseBase64UrlDecode(protected.Tail) + if err != nil { + return nil, errors.Wrap(err, "invalid tail base 64 value") + } + + return append(b[:protected.Length], tail...), nil +} + +type blobStateCalculator struct { + empty bool + digester digest.Digester +} + +func newBlobStateCalculator() *blobStateCalculator { + return &blobStateCalculator{ + empty: true, + digester: digest.Canonical.Digester(), + } +} + +func (c *blobStateCalculator) Write(p []byte) (int, error) { + if c.empty { + for _, b := range p { + if b != 0x00 { + c.empty = false + break + } + } + } + return c.digester.Hash().Write(p) +} + +func (c *blobStateCalculator) State() blobState { + return blobState{ + empty: c.empty, + diffID: c.digester.Digest(), + } +} diff --git a/vendor/github.com/containerd/containerd/rootfs/apply.go b/vendor/github.com/containerd/containerd/rootfs/apply.go new file mode 100644 index 0000000000..59b27442ce --- /dev/null +++ b/vendor/github.com/containerd/containerd/rootfs/apply.go @@ -0,0 +1,84 @@ +package rootfs + +import ( + "fmt" + + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/snapshot" + "github.com/opencontainers/go-digest" + "github.com/opencontainers/image-spec/identity" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" + "golang.org/x/net/context" +) + +type Applier interface { + Apply(context.Context, ocispec.Descriptor, []mount.Mount) (ocispec.Descriptor, error) +} + +type Layer struct { + Diff ocispec.Descriptor + Blob ocispec.Descriptor +} + +func ApplyLayers(ctx context.Context, layers []Layer, sn snapshot.Snapshotter, a Applier) (digest.Digest, error) { + var chain []digest.Digest + for _, layer := range layers { + if err := applyLayer(ctx, layer, chain, sn, a); err != nil { + // TODO: possibly wait and retry if extraction of same chain id was in progress + return "", err + } + + chain = append(chain, layer.Diff.Digest) + } + return identity.ChainID(chain), nil +} + +func applyLayer(ctx context.Context, layer Layer, chain []digest.Digest, sn snapshot.Snapshotter, a Applier) error { + var ( + parent = identity.ChainID(chain) + chainID = identity.ChainID(append(chain, layer.Diff.Digest)) + diff ocispec.Descriptor + ) + + _, err := sn.Stat(ctx, chainID.String()) + if err == nil { + log.G(ctx).Debugf("Extraction not needed, layer snapshot exists") + return nil + } else if !snapshot.IsNotExist(err) { + return errors.Wrap(err, "failed to stat snapshot") + } + + key := fmt.Sprintf("extract %s", chainID) + + // Prepare snapshot with from parent + mounts, err := sn.Prepare(ctx, key, parent.String()) + if err != nil { + //TODO: If is snapshot exists error, retry + return errors.Wrap(err, "failed to prepare extraction layer") + } + defer func() { + if err != nil { + log.G(ctx).WithError(err).WithField("key", key).Infof("Apply failure, attempting cleanup") + if rerr := sn.Remove(ctx, key); rerr != nil { + log.G(ctx).WithError(rerr).Warnf("Extraction snapshot %q removal failed: %v", key) + } + } + }() + + diff, err = a.Apply(ctx, layer.Blob, mounts) + if err != nil { + return errors.Wrapf(err, "failed to extract layer %s", layer.Diff.Digest) + } + if diff.Digest != layer.Diff.Digest { + err = errors.Errorf("wrong diff id calculated on extraction %q", diff.Digest) + return err + } + + if err = sn.Commit(ctx, chainID.String(), key); err != nil { + return errors.Wrapf(err, "failed to commit snapshot %s", parent) + } + + return nil +} diff --git a/vendor/github.com/containerd/containerd/rootfs/diff.go b/vendor/github.com/containerd/containerd/rootfs/diff.go new file mode 100644 index 0000000000..05d02c90b2 --- /dev/null +++ b/vendor/github.com/containerd/containerd/rootfs/diff.go @@ -0,0 +1,52 @@ +package rootfs + +import ( + "fmt" + + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/snapshot" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "golang.org/x/net/context" +) + +type MountDiffer interface { + DiffMounts(ctx context.Context, lower, upper []mount.Mount, media, ref string) (ocispec.Descriptor, error) +} + +type DiffOptions struct { + MountDiffer + content.Store + snapshot.Snapshotter +} + +func Diff(ctx context.Context, snapshotID, contentRef string, sn snapshot.Snapshotter, md MountDiffer) (ocispec.Descriptor, error) { + info, err := sn.Stat(ctx, snapshotID) + if err != nil { + return ocispec.Descriptor{}, err + } + + lowerKey := fmt.Sprintf("%s-parent-view", info.Parent) + lower, err := sn.View(ctx, lowerKey, info.Parent) + if err != nil { + return ocispec.Descriptor{}, err + } + defer sn.Remove(ctx, lowerKey) + + var upper []mount.Mount + if info.Kind == snapshot.KindActive { + upper, err = sn.Mounts(ctx, snapshotID) + if err != nil { + return ocispec.Descriptor{}, err + } + } else { + upperKey := fmt.Sprintf("%s-view", snapshotID) + upper, err = sn.View(ctx, upperKey, snapshotID) + if err != nil { + return ocispec.Descriptor{}, err + } + defer sn.Remove(ctx, lowerKey) + } + + return md.DiffMounts(ctx, lower, upper, ocispec.MediaTypeImageLayer, contentRef) +} diff --git a/vendor/github.com/containerd/containerd/rootfs/init.go b/vendor/github.com/containerd/containerd/rootfs/init.go new file mode 100644 index 0000000000..ae3870efed --- /dev/null +++ b/vendor/github.com/containerd/containerd/rootfs/init.go @@ -0,0 +1,99 @@ +package rootfs + +import ( + "context" + "fmt" + "io/ioutil" + "os" + + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/snapshot" + digest "github.com/opencontainers/go-digest" + "github.com/pkg/errors" +) + +var ( + initializers = map[string]initializerFunc{} +) + +type initializerFunc func(string) error + +type Mounter interface { + Mount(target string, mounts ...mount.Mount) error + Unmount(target string) error +} + +func InitRootFS(ctx context.Context, name string, parent digest.Digest, readonly bool, snapshotter snapshot.Snapshotter, mounter Mounter) ([]mount.Mount, error) { + _, err := snapshotter.Stat(ctx, name) + if err == nil { + return nil, errors.Errorf("rootfs already exists") + } + // TODO: ensure not exist error once added to snapshot package + + parentS := parent.String() + + initName := defaultInitializer + initFn := initializers[initName] + if initFn != nil { + parentS, err = createInitLayer(ctx, parentS, initName, initFn, snapshotter, mounter) + if err != nil { + return nil, err + } + } + + if readonly { + return snapshotter.View(ctx, name, parentS) + } + + return snapshotter.Prepare(ctx, name, parentS) +} + +func createInitLayer(ctx context.Context, parent, initName string, initFn func(string) error, snapshotter snapshot.Snapshotter, mounter Mounter) (string, error) { + initS := fmt.Sprintf("%s %s", parent, initName) + if _, err := snapshotter.Stat(ctx, initS); err == nil { + return initS, nil + } + // TODO: ensure not exist error once added to snapshot package + + // Create tempdir + td, err := ioutil.TempDir("", "create-init-") + if err != nil { + return "", err + } + defer os.RemoveAll(td) + + mounts, err := snapshotter.Prepare(ctx, td, parent) + if err != nil { + return "", err + } + defer func() { + if err != nil { + // TODO: once implemented uncomment + //if rerr := snapshotter.Remove(ctx, td); rerr != nil { + // log.G(ctx).Errorf("Failed to remove snapshot %s: %v", td, merr) + //} + } + }() + + if err = mounter.Mount(td, mounts...); err != nil { + return "", err + } + + if err = initFn(td); err != nil { + if merr := mounter.Unmount(td); merr != nil { + log.G(ctx).Errorf("Failed to unmount %s: %v", td, merr) + } + return "", err + } + + if err = mounter.Unmount(td); err != nil { + return "", err + } + + if err := snapshotter.Commit(ctx, initS, td); err != nil { + return "", err + } + + return initS, nil +} diff --git a/vendor/github.com/containerd/containerd/rootfs/init_linux.go b/vendor/github.com/containerd/containerd/rootfs/init_linux.go new file mode 100644 index 0000000000..cabc4577e0 --- /dev/null +++ b/vendor/github.com/containerd/containerd/rootfs/init_linux.go @@ -0,0 +1,114 @@ +package rootfs + +import ( + "os" + "path/filepath" + "syscall" +) + +const ( + defaultInitializer = "linux-init" +) + +func init() { + initializers[defaultInitializer] = initFS +} + +func createDirectory(name string, uid, gid int) initializerFunc { + return func(root string) error { + dname := filepath.Join(root, name) + st, err := os.Stat(dname) + if err != nil && !os.IsNotExist(err) { + return err + } else if err == nil { + if st.IsDir() { + stat := st.Sys().(*syscall.Stat_t) + if int(stat.Gid) == gid && int(stat.Uid) == uid { + return nil + } + } else { + if err := os.Remove(dname); err != nil { + return err + } + if err := os.Mkdir(dname, 0755); err != nil { + return err + } + } + } else { + if err := os.Mkdir(dname, 0755); err != nil { + return err + } + } + + return os.Chown(dname, uid, gid) + } +} + +func touchFile(name string, uid, gid int) initializerFunc { + return func(root string) error { + fname := filepath.Join(root, name) + + st, err := os.Stat(fname) + if err != nil && !os.IsNotExist(err) { + return err + } else if err == nil { + stat := st.Sys().(*syscall.Stat_t) + if int(stat.Gid) == gid && int(stat.Uid) == uid { + return nil + } + return os.Chown(fname, uid, gid) + } + + f, err := os.OpenFile(fname, os.O_CREATE, 0644) + if err != nil { + return err + } + defer f.Close() + + return f.Chown(uid, gid) + } +} + +func symlink(oldname, newname string) initializerFunc { + return func(root string) error { + linkName := filepath.Join(root, newname) + if _, err := os.Stat(linkName); err != nil && !os.IsNotExist(err) { + return err + } else if err == nil { + return nil + } + return os.Symlink(oldname, linkName) + } +} + +func initFS(root string) error { + st, err := os.Stat(root) + if err != nil { + return err + } + stat := st.Sys().(*syscall.Stat_t) + uid := int(stat.Uid) + gid := int(stat.Gid) + + initFuncs := []initializerFunc{ + createDirectory("/dev", uid, gid), + createDirectory("/dev/pts", uid, gid), + createDirectory("/dev/shm", uid, gid), + touchFile("/dev/console", uid, gid), + createDirectory("/proc", uid, gid), + createDirectory("/sys", uid, gid), + createDirectory("/etc", uid, gid), + touchFile("/etc/resolv.conf", uid, gid), + touchFile("/etc/hosts", uid, gid), + touchFile("/etc/hostname", uid, gid), + symlink("/proc/mounts", "/etc/mtab"), + } + + for _, fn := range initFuncs { + if err := fn(root); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/containerd/containerd/rootfs/init_other.go b/vendor/github.com/containerd/containerd/rootfs/init_other.go new file mode 100644 index 0000000000..b5e04e2e60 --- /dev/null +++ b/vendor/github.com/containerd/containerd/rootfs/init_other.go @@ -0,0 +1,7 @@ +// +build !linux + +package rootfs + +const ( + defaultInitializer = "" +) diff --git a/vendor/github.com/containerd/containerd/services/diff/client.go b/vendor/github.com/containerd/containerd/services/diff/client.go new file mode 100644 index 0000000000..da79e905fc --- /dev/null +++ b/vendor/github.com/containerd/containerd/services/diff/client.go @@ -0,0 +1,82 @@ +package diff + +import ( + diffapi "github.com/containerd/containerd/api/services/diff" + "github.com/containerd/containerd/api/types/descriptor" + mounttypes "github.com/containerd/containerd/api/types/mount" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/rootfs" + ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "golang.org/x/net/context" +) + +type DiffService interface { + rootfs.Applier + rootfs.MountDiffer +} + +// NewApplierFromClient returns a new Applier which communicates +// over a GRPC connection. +func NewDiffServiceFromClient(client diffapi.DiffClient) DiffService { + return &remote{ + client: client, + } +} + +type remote struct { + client diffapi.DiffClient +} + +func (r *remote) Apply(ctx context.Context, diff ocispec.Descriptor, mounts []mount.Mount) (ocispec.Descriptor, error) { + req := &diffapi.ApplyRequest{ + Diff: fromDescriptor(diff), + Mounts: fromMounts(mounts), + } + resp, err := r.client.Apply(ctx, req) + if err != nil { + return ocispec.Descriptor{}, err + } + return toDescriptor(resp.Applied), nil +} + +func (r *remote) DiffMounts(ctx context.Context, a, b []mount.Mount, media, ref string) (ocispec.Descriptor, error) { + req := &diffapi.DiffRequest{ + Left: fromMounts(a), + Right: fromMounts(b), + MediaType: media, + Ref: ref, + } + resp, err := r.client.Diff(ctx, req) + if err != nil { + return ocispec.Descriptor{}, err + } + return toDescriptor(resp.Diff), nil +} + +func toDescriptor(d *descriptor.Descriptor) ocispec.Descriptor { + return ocispec.Descriptor{ + MediaType: d.MediaType, + Digest: d.Digest, + Size: d.Size_, + } +} + +func fromDescriptor(d ocispec.Descriptor) *descriptor.Descriptor { + return &descriptor.Descriptor{ + MediaType: d.MediaType, + Digest: d.Digest, + Size_: d.Size, + } +} + +func fromMounts(mounts []mount.Mount) []*mounttypes.Mount { + apiMounts := make([]*mounttypes.Mount, len(mounts)) + for i, m := range mounts { + apiMounts[i] = &mounttypes.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + } + } + return apiMounts +} diff --git a/vendor/github.com/containerd/containerd/services/diff/service.go b/vendor/github.com/containerd/containerd/services/diff/service.go new file mode 100644 index 0000000000..c132575e9d --- /dev/null +++ b/vendor/github.com/containerd/containerd/services/diff/service.go @@ -0,0 +1,81 @@ +package diff + +import ( + diffapi "github.com/containerd/containerd/api/services/diff" + mounttypes "github.com/containerd/containerd/api/types/mount" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/plugin" + "golang.org/x/net/context" + "google.golang.org/grpc" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "diff", + Requires: []plugin.PluginType{ + plugin.DiffPlugin, + }, + Init: func(ic *plugin.InitContext) (interface{}, error) { + d, err := ic.Get(plugin.DiffPlugin) + if err != nil { + return nil, err + } + return &service{ + diff: d.(plugin.Differ), + }, nil + }, + }) +} + +type service struct { + diff plugin.Differ +} + +func (s *service) Register(gs *grpc.Server) error { + diffapi.RegisterDiffServer(gs, s) + return nil +} + +func (s *service) Apply(ctx context.Context, er *diffapi.ApplyRequest) (*diffapi.ApplyResponse, error) { + desc := toDescriptor(er.Diff) + // TODO: Check for supported media types + + mounts := toMounts(er.Mounts) + + ocidesc, err := s.diff.Apply(ctx, desc, mounts) + if err != nil { + return nil, err + } + + return &diffapi.ApplyResponse{ + Applied: fromDescriptor(ocidesc), + }, nil + +} + +func (s *service) Diff(ctx context.Context, dr *diffapi.DiffRequest) (*diffapi.DiffResponse, error) { + aMounts := toMounts(dr.Left) + bMounts := toMounts(dr.Right) + + ocidesc, err := s.diff.DiffMounts(ctx, aMounts, bMounts, dr.MediaType, dr.Ref) + if err != nil { + return nil, err + } + + return &diffapi.DiffResponse{ + Diff: fromDescriptor(ocidesc), + }, nil +} + +func toMounts(apim []*mounttypes.Mount) []mount.Mount { + mounts := make([]mount.Mount, len(apim)) + for i, m := range apim { + mounts[i] = mount.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + } + } + return mounts +} diff --git a/vendor/github.com/containerd/containerd/services/snapshot/client.go b/vendor/github.com/containerd/containerd/services/snapshot/client.go new file mode 100644 index 0000000000..747aeb6ee1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/services/snapshot/client.go @@ -0,0 +1,158 @@ +package snapshot + +import ( + "context" + "io" + "strings" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + + snapshotapi "github.com/containerd/containerd/api/services/snapshot" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/snapshot" + "github.com/pkg/errors" +) + +// NewSnapshotterFromClient returns a new Snapshotter which communicates +// over a GRPC connection. +func NewSnapshotterFromClient(client snapshotapi.SnapshotClient) snapshot.Snapshotter { + return &remoteSnapshotter{ + client: client, + } +} + +type remoteSnapshotter struct { + client snapshotapi.SnapshotClient +} + +func (r *remoteSnapshotter) Stat(ctx context.Context, key string) (snapshot.Info, error) { + resp, err := r.client.Stat(ctx, &snapshotapi.StatRequest{Key: key}) + if err != nil { + return snapshot.Info{}, rewriteGRPCError(err) + } + return toInfo(resp.Info), nil +} + +func (r *remoteSnapshotter) Usage(ctx context.Context, key string) (snapshot.Usage, error) { + resp, err := r.client.Usage(ctx, &snapshotapi.UsageRequest{Key: key}) + if err != nil { + return snapshot.Usage{}, rewriteGRPCError(err) + } + return toUsage(resp), nil +} + +func (r *remoteSnapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) { + resp, err := r.client.Mounts(ctx, &snapshotapi.MountsRequest{Key: key}) + if err != nil { + return nil, rewriteGRPCError(err) + } + return toMounts(resp), nil +} + +func (r *remoteSnapshotter) Prepare(ctx context.Context, key, parent string) ([]mount.Mount, error) { + resp, err := r.client.Prepare(ctx, &snapshotapi.PrepareRequest{Key: key, Parent: parent}) + if err != nil { + return nil, rewriteGRPCError(err) + } + return toMounts(resp), nil +} + +func (r *remoteSnapshotter) View(ctx context.Context, key, parent string) ([]mount.Mount, error) { + resp, err := r.client.View(ctx, &snapshotapi.PrepareRequest{Key: key, Parent: parent}) + if err != nil { + return nil, rewriteGRPCError(err) + } + return toMounts(resp), nil +} + +func (r *remoteSnapshotter) Commit(ctx context.Context, name, key string) error { + _, err := r.client.Commit(ctx, &snapshotapi.CommitRequest{ + Name: name, + Key: key, + }) + return rewriteGRPCError(err) +} + +func (r *remoteSnapshotter) Remove(ctx context.Context, key string) error { + _, err := r.client.Remove(ctx, &snapshotapi.RemoveRequest{Key: key}) + return rewriteGRPCError(err) +} + +func (r *remoteSnapshotter) Walk(ctx context.Context, fn func(context.Context, snapshot.Info) error) error { + sc, err := r.client.List(ctx, &snapshotapi.ListRequest{}) + if err != nil { + rewriteGRPCError(err) + } + for { + resp, err := sc.Recv() + if err != nil { + if err == io.EOF { + return nil + } + return rewriteGRPCError(err) + } + if resp == nil { + return nil + } + for _, info := range resp.Info { + if err := fn(ctx, toInfo(info)); err != nil { + return err + } + } + } +} + +func rewriteGRPCError(err error) error { + switch grpc.Code(errors.Cause(err)) { + case codes.AlreadyExists: + return snapshot.ErrSnapshotExist + case codes.NotFound: + return snapshot.ErrSnapshotNotExist + case codes.FailedPrecondition: + desc := grpc.ErrorDesc(errors.Cause(err)) + if strings.Contains(desc, snapshot.ErrSnapshotNotActive.Error()) { + return snapshot.ErrSnapshotNotActive + } + if strings.Contains(desc, snapshot.ErrSnapshotNotCommitted.Error()) { + return snapshot.ErrSnapshotNotCommitted + } + } + + return err +} + +func toKind(kind snapshotapi.Kind) snapshot.Kind { + if kind == snapshotapi.KindActive { + return snapshot.KindActive + } + return snapshot.KindCommitted +} + +func toInfo(info snapshotapi.Info) snapshot.Info { + return snapshot.Info{ + Name: info.Name, + Parent: info.Parent, + Kind: toKind(info.Kind), + Readonly: info.Readonly, + } +} + +func toUsage(resp *snapshotapi.UsageResponse) snapshot.Usage { + return snapshot.Usage{ + Inodes: resp.Inodes, + Size: resp.Size_, + } +} + +func toMounts(resp *snapshotapi.MountsResponse) []mount.Mount { + mounts := make([]mount.Mount, len(resp.Mounts)) + for i, m := range resp.Mounts { + mounts[i] = mount.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + } + } + return mounts +} diff --git a/vendor/github.com/containerd/containerd/services/snapshot/service.go b/vendor/github.com/containerd/containerd/services/snapshot/service.go new file mode 100644 index 0000000000..f4baf72577 --- /dev/null +++ b/vendor/github.com/containerd/containerd/services/snapshot/service.go @@ -0,0 +1,212 @@ +package snapshot + +import ( + gocontext "context" + + snapshotapi "github.com/containerd/containerd/api/services/snapshot" + mounttypes "github.com/containerd/containerd/api/types/mount" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/mount" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/snapshot" + protoempty "github.com/golang/protobuf/ptypes/empty" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "snapshots", + Requires: []plugin.PluginType{ + plugin.SnapshotPlugin, + }, + Init: func(ic *plugin.InitContext) (interface{}, error) { + s, err := ic.Get(plugin.SnapshotPlugin) + if err != nil { + return nil, err + } + return newService(s.(snapshot.Snapshotter)) + }, + }) +} + +var empty = &protoempty.Empty{} + +type service struct { + snapshotter snapshot.Snapshotter +} + +func newService(snapshotter snapshot.Snapshotter) (*service, error) { + return &service{ + snapshotter: snapshotter, + }, nil +} + +func (s *service) Register(gs *grpc.Server) error { + snapshotapi.RegisterSnapshotServer(gs, s) + return nil +} + +func (s *service) Prepare(ctx context.Context, pr *snapshotapi.PrepareRequest) (*snapshotapi.MountsResponse, error) { + log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing snapshot") + // TODO: Apply namespace + // TODO: Lookup snapshot id from metadata store + mounts, err := s.snapshotter.Prepare(ctx, pr.Key, pr.Parent) + if err != nil { + return nil, grpcError(err) + } + return fromMounts(mounts), nil +} + +func (s *service) View(ctx context.Context, pr *snapshotapi.PrepareRequest) (*snapshotapi.MountsResponse, error) { + log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing view snapshot") + // TODO: Apply namespace + // TODO: Lookup snapshot id from metadata store + mounts, err := s.snapshotter.View(ctx, pr.Key, pr.Parent) + if err != nil { + return nil, grpcError(err) + } + return fromMounts(mounts), nil +} + +func (s *service) Mounts(ctx context.Context, mr *snapshotapi.MountsRequest) (*snapshotapi.MountsResponse, error) { + log.G(ctx).WithField("key", mr.Key).Debugf("Getting snapshot mounts") + // TODO: Apply namespace + // TODO: Lookup snapshot id from metadata store + mounts, err := s.snapshotter.Mounts(ctx, mr.Key) + if err != nil { + return nil, grpcError(err) + } + return fromMounts(mounts), nil +} + +func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitRequest) (*protoempty.Empty, error) { + log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("Committing snapshot") + // TODO: Apply namespace + // TODO: Lookup snapshot id from metadata store + if err := s.snapshotter.Commit(ctx, cr.Name, cr.Key); err != nil { + return nil, grpcError(err) + } + return empty, nil +} + +func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveRequest) (*protoempty.Empty, error) { + log.G(ctx).WithField("key", rr.Key).Debugf("Removing snapshot") + // TODO: Apply namespace + // TODO: Lookup snapshot id from metadata store + if err := s.snapshotter.Remove(ctx, rr.Key); err != nil { + return nil, grpcError(err) + } + return empty, nil +} + +func (s *service) Stat(ctx context.Context, sr *snapshotapi.StatRequest) (*snapshotapi.StatResponse, error) { + log.G(ctx).WithField("key", sr.Key).Debugf("Statting snapshot") + // TODO: Apply namespace + info, err := s.snapshotter.Stat(ctx, sr.Key) + if err != nil { + return nil, grpcError(err) + } + + return &snapshotapi.StatResponse{Info: fromInfo(info)}, nil +} + +func (s *service) List(sr *snapshotapi.ListRequest, ss snapshotapi.Snapshot_ListServer) error { + // TODO: Apply namespace + + var ( + buffer []snapshotapi.Info + sendBlock = func(block []snapshotapi.Info) error { + return ss.Send(&snapshotapi.ListResponse{ + Info: block, + }) + } + ) + err := s.snapshotter.Walk(ss.Context(), func(ctx gocontext.Context, info snapshot.Info) error { + buffer = append(buffer, fromInfo(info)) + + if len(buffer) >= 100 { + if err := sendBlock(buffer); err != nil { + return err + } + + buffer = buffer[:0] + } + + return nil + }) + if err != nil { + return err + } + if len(buffer) > 0 { + // Send remaining infos + if err := sendBlock(buffer); err != nil { + return err + } + } + + return nil +} + +func (s *service) Usage(ctx context.Context, ur *snapshotapi.UsageRequest) (*snapshotapi.UsageResponse, error) { + // TODO: Apply namespace + usage, err := s.snapshotter.Usage(ctx, ur.Key) + if err != nil { + return nil, grpcError(err) + } + + return fromUsage(usage), nil +} + +func grpcError(err error) error { + if snapshot.IsNotExist(err) { + return grpc.Errorf(codes.NotFound, err.Error()) + } + if snapshot.IsExist(err) { + return grpc.Errorf(codes.AlreadyExists, err.Error()) + } + if snapshot.IsNotActive(err) || snapshot.IsNotCommitted(err) { + return grpc.Errorf(codes.FailedPrecondition, err.Error()) + } + + return err +} + +func fromKind(kind snapshot.Kind) snapshotapi.Kind { + if kind == snapshot.KindActive { + return snapshotapi.KindActive + } + return snapshotapi.KindCommitted +} + +func fromInfo(info snapshot.Info) snapshotapi.Info { + return snapshotapi.Info{ + Name: info.Name, + Parent: info.Parent, + Kind: fromKind(info.Kind), + Readonly: info.Readonly, + } +} + +func fromUsage(usage snapshot.Usage) *snapshotapi.UsageResponse { + return &snapshotapi.UsageResponse{ + Inodes: usage.Inodes, + Size_: usage.Size, + } +} + +func fromMounts(mounts []mount.Mount) *snapshotapi.MountsResponse { + resp := &snapshotapi.MountsResponse{ + Mounts: make([]*mounttypes.Mount, len(mounts)), + } + for i, m := range mounts { + resp.Mounts[i] = &mounttypes.Mount{ + Type: m.Type, + Source: m.Source, + Options: m.Options, + } + } + return resp +} diff --git a/vendor/github.com/containerd/containerd/snapshot/errors.go b/vendor/github.com/containerd/containerd/snapshot/errors.go new file mode 100644 index 0000000000..0b6e5174b1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/snapshot/errors.go @@ -0,0 +1,44 @@ +package snapshot + +import "github.com/pkg/errors" + +var ( + // ErrSnapshotNotExist is returned when a snapshot cannot be found + ErrSnapshotNotExist = errors.New("snapshot does not exist") + + // ErrSnapshotExist is returned when an operation to create a snapshot + // encounters a snapshot with the same key + ErrSnapshotExist = errors.New("snapshot already exists") + + // ErrSnapshotNotActive is returned when a request which requires an + // active snapshot encounters a non-active snapshot. + ErrSnapshotNotActive = errors.New("snapshot is not active") + + // ErrSnapshotNotCommitted is returned when a request which requires a + // committed snapshot encounters a non-committed snapshot. + ErrSnapshotNotCommitted = errors.New("snapshot is not committed") +) + +// IsNotExist returns whether the error represents that a snapshot +// was not found. +func IsNotExist(err error) bool { + return errors.Cause(err) == ErrSnapshotNotExist +} + +// IsExist returns whether the error represents whether a snapshot +// already exists using a provided key. +func IsExist(err error) bool { + return errors.Cause(err) == ErrSnapshotExist +} + +// IsNotActive returns whether the error represents a request +// for a non active snapshot when an active snapshot is expected. +func IsNotActive(err error) bool { + return errors.Cause(err) == ErrSnapshotNotActive +} + +// IsNotCommitted returns whether the error represents a request +// for a non committed snapshot when a committed snapshot is expected. +func IsNotCommitted(err error) bool { + return errors.Cause(err) == ErrSnapshotNotCommitted +} diff --git a/vendor/github.com/containerd/containerd/snapshot/snapshotter.go b/vendor/github.com/containerd/containerd/snapshot/snapshotter.go new file mode 100644 index 0000000000..a0e956d792 --- /dev/null +++ b/vendor/github.com/containerd/containerd/snapshot/snapshotter.go @@ -0,0 +1,238 @@ +package snapshot + +import ( + "context" + + "github.com/containerd/containerd/mount" +) + +// Kind identifies the kind of snapshot. +type Kind int + +// definitions of snapshot kinds +const ( + KindActive Kind = iota + KindCommitted +) + +// Info provides information about a particular snapshot. +type Info struct { + Name string // name or key of snapshot + Parent string // name of parent snapshot + Kind Kind // active or committed snapshot + Readonly bool // true if readonly, only valid for active +} + +// Usage defines statistics for disk resources consumed by the snapshot. +// +// These resources only include the resources consumed by the snapshot itself +// and does not include resources usage by the parent. +type Usage struct { + Inodes int64 // number of inodes in use. + Size int64 // provides usage, in bytes, of snapshot +} + +func (u *Usage) Add(other Usage) { + u.Size += other.Size + + // TODO(stevvooe): assumes independent inodes, but provides and upper + // bound. This should be pretty close, assumming the inodes for a + // snapshot are roughly unique to it. Don't trust this assumption. + u.Inodes += other.Inodes +} + +// Snapshotter defines the methods required to implement a snapshot snapshotter for +// allocating, snapshotting and mounting filesystem changesets. The model works +// by building up sets of changes with parent-child relationships. +// +// A snapshot represents a filesystem state. Every snapshot has a parent, where +// the empty parent is represented by the empty string. A diff can be taken +// between a parent and its snapshot to generate a classic layer. +// +// An active snapshot is created by calling `Prepare`. After mounting, changes +// can be made to the snapshot. The act of commiting creates a committed +// snapshot. The committed snapshot will get the parent of active snapshot. The +// committed snapshot can then be used as a parent. Active snapshots can never +// act as a parent. +// +// Snapshots are best understood by their lifecycle. Active snapshots are +// always created with Prepare or View. Committed snapshots are always created +// with Commit. Active snapshots never become committed snapshots and vice +// versa. All snapshots may be removed. +// +// For consistency, we define the following terms to be used throughout this +// interface for snapshotter implementations: +// +// `ctx` - refers to a context.Context +// `key` - refers to an active snapshot +// `name` - refers to a committed snapshot +// `parent` - refers to the parent in relation +// +// Most methods take various combinations of these identifiers. Typically, +// `name` and `parent` will be used in cases where a method *only* takes +// committed snapshots. `key` will be used to refer to active snapshots in most +// cases, except where noted. All variables used to access snapshots use the +// same key space. For example, an active snapshot may not share the same key +// with a committed snapshot. +// +// We cover several examples below to demonstrate the utility of a snapshot +// snapshotter. +// +// Importing a Layer +// +// To import a layer, we simply have the Snapshotter provide a list of +// mounts to be applied such that our dst will capture a changeset. We start +// out by getting a path to the layer tar file and creating a temp location to +// unpack it to: +// +// layerPath, tmpDir := getLayerPath(), mkTmpDir() // just a path to layer tar file. +// +// We start by using a Snapshotter to Prepare a new snapshot transaction, using a +// key and descending from the empty parent "": +// +// mounts, err := snapshotter.Prepare(ctx, key, "") +// if err != nil { ... } +// +// We get back a list of mounts from Snapshotter.Prepare, with the key identifying +// the active snapshot. Mount this to the temporary location with the +// following: +// +// if err := containerd.MountAll(mounts, tmpDir); err != nil { ... } +// +// Once the mounts are performed, our temporary location is ready to capture +// a diff. In practice, this works similar to a filesystem transaction. The +// next step is to unpack the layer. We have a special function unpackLayer +// that applies the contents of the layer to target location and calculates the +// DiffID of the unpacked layer (this is a requirement for docker +// implementation): +// +// layer, err := os.Open(layerPath) +// if err != nil { ... } +// digest, err := unpackLayer(tmpLocation, layer) // unpack into layer location +// if err != nil { ... } +// +// When the above completes, we should have a filesystem the represents the +// contents of the layer. Careful implementations should verify that digest +// matches the expected DiffID. When completed, we unmount the mounts: +// +// unmount(mounts) // optional, for now +// +// Now that we've verified and unpacked our layer, we commit the active +// snapshot to a name. For this example, we are just going to use the layer +// digest, but in practice, this will probably be the ChainID: +// +// if err := snapshotter.Commit(ctx, digest.String(), key); err != nil { ... } +// +// Now, we have a layer in the Snapshotter that can be accessed with the digest +// provided during commit. Once you have committed the snapshot, the active +// snapshot can be removed with the following: +// +// snapshotter.Remove(ctx, key) +// +// Importing the Next Layer +// +// Making a layer depend on the above is identical to the process described +// above except that the parent is provided as parent when calling +// Manager.Prepare, assuming a clean, unique key identifier: +// +// mounts, err := snapshotter.Prepare(ctx, key, parentDigest) +// +// We then mount, apply and commit, as we did above. The new snapshot will be +// based on the content of the previous one. +// +// Running a Container +// +// To run a container, we simply provide Snapshotter.Prepare the committed image +// snapshot as the parent. After mounting, the prepared path can +// be used directly as the container's filesystem: +// +// mounts, err := snapshotter.Prepare(ctx, containerKey, imageRootFSChainID) +// +// The returned mounts can then be passed directly to the container runtime. If +// one would like to create a new image from the filesystem, Manager.Commit is +// called: +// +// if err := snapshotter.Commit(ctx, newImageSnapshot, containerKey); err != nil { ... } +// +// Alternatively, for most container runs, Snapshotter.Remove will be called to +// signal the Snapshotter to abandon the changes. +type Snapshotter interface { + // Stat returns the info for an active or committed snapshot by name or + // key. + // + // Should be used for parent resolution, existence checks and to discern + // the kind of snapshot. + Stat(ctx context.Context, key string) (Info, error) + + // Usage returns the resource usage of an active or committed snapshot + // excluding the usage of parent snapshots. + // + // The running time of this call for active snapshots is dependent on + // implementation, but may be proportional to the size of the resource. + // Callers should take this into consideration. Implementations should + // attempt to honer context cancellation and avoid taking locks when making + // the calculation. + Usage(ctx context.Context, key string) (Usage, error) + + // Mounts returns the mounts for the active snapshot transaction identified + // by key. Can be called on an read-write or readonly transaction. This is + // available only for active snapshots. + // + // This can be used to recover mounts after calling View or Prepare. + Mounts(ctx context.Context, key string) ([]mount.Mount, error) + + // Prepare creates an active snapshot identified by key descending from the + // provided parent. The returned mounts can be used to mount the snapshot + // to capture changes. + // + // If a parent is provided, after performing the mounts, the destination + // will start with the content of the parent. The parent must be a + // committed snapshot. Changes to the mounted destination will be captured + // in relation to the parent. The default parent, "", is an empty + // directory. + // + // The changes may be saved to a committed snapshot by calling Commit. When + // one is done with the transaction, Remove should be called on the key. + // + // Multiple calls to Prepare or View with the same key should fail. + Prepare(ctx context.Context, key, parent string) ([]mount.Mount, error) + + // View behaves identically to Prepare except the result may not be + // committed back to the snapshot snapshotter. View returns a readonly view on + // the parent, with the active snapshot being tracked by the given key. + // + // This method operates identically to Prepare, except that Mounts returned + // may have the readonly flag set. Any modifications to the underlying + // filesystem will be ignored. Implementations may perform this in a more + // efficient manner that differs from what would be attempted with + // `Prepare`. + // + // Commit may not be called on the provided key and will return an error. + // To collect the resources associated with key, Remove must be called with + // key as the argument. + View(ctx context.Context, key, parent string) ([]mount.Mount, error) + + // Commit captures the changes between key and its parent into a snapshot + // identified by name. The name can then be used with the snapshotter's other + // methods to create subsequent snapshots. + // + // A committed snapshot will be created under name with the parent of the + // active snapshot. + // + // Commit may be called multiple times on the same key. Snapshots created + // in this manner will all reference the parent used to start the + // transaction. + Commit(ctx context.Context, name, key string) error + + // Remove the committed or active snapshot by the provided key. + // + // All resources associated with the key will be removed. + // + // If the snapshot is a parent of another snapshot, its children must be + // removed before proceeding. + Remove(ctx context.Context, key string) error + + // Walk all snapshots in the snapshotter. For each snapshot in the + // snapshotter, the function will be called. + Walk(ctx context.Context, fn func(context.Context, Info) error) error +} diff --git a/vendor/github.com/containerd/containerd/spec.go b/vendor/github.com/containerd/containerd/spec.go new file mode 100644 index 0000000000..53e1fd5f5c --- /dev/null +++ b/vendor/github.com/containerd/containerd/spec.go @@ -0,0 +1,27 @@ +package containerd + +import specs "github.com/opencontainers/runtime-spec/specs-go" + +type SpecOpts func(s *specs.Spec) error + +func WithProcessArgs(args ...string) SpecOpts { + return func(s *specs.Spec) error { + s.Process.Args = args + return nil + } +} + +// GenerateSpec will generate a default spec from the provided image +// for use as a containerd container +func GenerateSpec(opts ...SpecOpts) (*specs.Spec, error) { + s, err := createDefaultSpec() + if err != nil { + return nil, err + } + for _, o := range opts { + if err := o(s); err != nil { + return nil, err + } + } + return s, nil +} diff --git a/vendor/github.com/containerd/containerd/spec_unix.go b/vendor/github.com/containerd/containerd/spec_unix.go new file mode 100644 index 0000000000..c74d88e5fc --- /dev/null +++ b/vendor/github.com/containerd/containerd/spec_unix.go @@ -0,0 +1,274 @@ +// +build !windows + +package containerd + +import ( + "context" + "encoding/json" + "fmt" + "runtime" + "strconv" + "strings" + + "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/images" + protobuf "github.com/gogo/protobuf/types" + "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +const ( + rwm = "rwm" + defaultRootfsPath = "rootfs" +) + +func defaltCaps() []string { + return []string{ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_FSETID", + "CAP_FOWNER", + "CAP_MKNOD", + "CAP_NET_RAW", + "CAP_SETGID", + "CAP_SETUID", + "CAP_SETFCAP", + "CAP_SETPCAP", + "CAP_NET_BIND_SERVICE", + "CAP_SYS_CHROOT", + "CAP_KILL", + "CAP_AUDIT_WRITE", + } +} + +func defaultNamespaces() []specs.LinuxNamespace { + return []specs.LinuxNamespace{ + { + Type: specs.PIDNamespace, + }, + { + Type: specs.IPCNamespace, + }, + { + Type: specs.UTSNamespace, + }, + { + Type: specs.MountNamespace, + }, + { + Type: specs.NetworkNamespace, + }, + } +} + +func createDefaultSpec() (*specs.Spec, error) { + s := &specs.Spec{ + Version: specs.Version, + Platform: specs.Platform{ + OS: runtime.GOOS, + Arch: runtime.GOARCH, + }, + Root: specs.Root{ + Path: defaultRootfsPath, + }, + Process: specs.Process{ + Cwd: "/", + NoNewPrivileges: true, + User: specs.User{ + UID: 0, + GID: 0, + }, + Capabilities: &specs.LinuxCapabilities{ + Bounding: defaltCaps(), + Permitted: defaltCaps(), + Inheritable: defaltCaps(), + Effective: defaltCaps(), + Ambient: defaltCaps(), + }, + Rlimits: []specs.LinuxRlimit{ + { + Type: "RLIMIT_NOFILE", + Hard: uint64(1024), + Soft: uint64(1024), + }, + }, + }, + Mounts: []specs.Mount{ + { + Destination: "/proc", + Type: "proc", + Source: "proc", + }, + { + Destination: "/dev", + Type: "tmpfs", + Source: "tmpfs", + Options: []string{"nosuid", "strictatime", "mode=755", "size=65536k"}, + }, + { + Destination: "/dev/pts", + Type: "devpts", + Source: "devpts", + Options: []string{"nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5"}, + }, + { + Destination: "/dev/shm", + Type: "tmpfs", + Source: "shm", + Options: []string{"nosuid", "noexec", "nodev", "mode=1777", "size=65536k"}, + }, + { + Destination: "/dev/mqueue", + Type: "mqueue", + Source: "mqueue", + Options: []string{"nosuid", "noexec", "nodev"}, + }, + { + Destination: "/sys", + Type: "sysfs", + Source: "sysfs", + Options: []string{"nosuid", "noexec", "nodev", "ro"}, + }, + { + Destination: "/run", + Type: "tmpfs", + Source: "tmpfs", + Options: []string{"nosuid", "strictatime", "mode=755", "size=65536k"}, + }, + { + Destination: "/etc/resolv.conf", + Type: "bind", + Source: "/etc/resolv.conf", + Options: []string{"rbind", "ro"}, + }, + { + Destination: "/etc/hosts", + Type: "bind", + Source: "/etc/hosts", + Options: []string{"rbind", "ro"}, + }, + { + Destination: "/etc/localtime", + Type: "bind", + Source: "/etc/localtime", + Options: []string{"rbind", "ro"}, + }, + }, + Linux: &specs.Linux{ + // TODO (@crosbymichael) make sure we don't have have two containers in the same cgroup + Resources: &specs.LinuxResources{ + Devices: []specs.LinuxDeviceCgroup{ + { + Allow: false, + Access: rwm, + }, + }, + }, + Namespaces: defaultNamespaces(), + }, + } + return s, nil +} + +func WithTTY(s *specs.Spec) error { + s.Process.Terminal = true + s.Process.Env = append(s.Process.Env, "TERM=xterm") + return nil +} + +func WithHostNamespace(ns specs.LinuxNamespaceType) SpecOpts { + return func(s *specs.Spec) error { + for i, n := range s.Linux.Namespaces { + if n.Type == ns { + s.Linux.Namespaces = append(s.Linux.Namespaces[:i], s.Linux.Namespaces[i+1:]...) + return nil + } + } + return nil + } +} + +func WithImageConfig(ctx context.Context, i Image) SpecOpts { + return func(s *specs.Spec) error { + var ( + image = i.(*image) + store = image.client.ContentStore() + ) + ic, err := image.i.Config(ctx, store) + if err != nil { + return err + } + var ( + ociimage v1.Image + config v1.ImageConfig + ) + switch ic.MediaType { + case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config: + r, err := store.Reader(ctx, ic.Digest) + if err != nil { + return err + } + if err := json.NewDecoder(r).Decode(&ociimage); err != nil { + r.Close() + return err + } + r.Close() + config = ociimage.Config + default: + return fmt.Errorf("unknown image config media type %s", ic.MediaType) + } + env := []string{ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + } + s.Process.Env = append(env, config.Env...) + var ( + uid, gid uint32 + ) + cmd := config.Cmd + s.Process.Args = append(config.Entrypoint, cmd...) + if config.User != "" { + parts := strings.Split(config.User, ":") + switch len(parts) { + case 1: + v, err := strconv.ParseUint(parts[0], 0, 10) + if err != nil { + return err + } + uid, gid = uint32(v), uint32(v) + case 2: + v, err := strconv.ParseUint(parts[0], 0, 10) + if err != nil { + return err + } + uid = uint32(v) + if v, err = strconv.ParseUint(parts[1], 0, 10); err != nil { + return err + } + gid = uint32(v) + default: + return fmt.Errorf("invalid USER value %s", config.User) + } + } + s.Process.User.UID, s.Process.User.GID = uid, gid + cwd := config.WorkingDir + if cwd == "" { + cwd = "/" + } + s.Process.Cwd = cwd + return nil + } +} + +func WithSpec(spec *specs.Spec) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + data, err := json.Marshal(spec) + if err != nil { + return err + } + c.Spec = &protobuf.Any{ + TypeUrl: spec.Version, + Value: data, + } + return nil + } +} diff --git a/vendor/github.com/containerd/containerd/spec_windows.go b/vendor/github.com/containerd/containerd/spec_windows.go new file mode 100644 index 0000000000..4af108ada6 --- /dev/null +++ b/vendor/github.com/containerd/containerd/spec_windows.go @@ -0,0 +1,94 @@ +package containerd + +import ( + "context" + "encoding/json" + "fmt" + "runtime" + + "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/images" + protobuf "github.com/gogo/protobuf/types" + "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +const pipeRoot = `\\.\pipe` + +func createDefaultSpec() (*specs.Spec, error) { + return &specs.Spec{ + Version: specs.Version, + Platform: specs.Platform{ + OS: runtime.GOOS, + Arch: runtime.GOARCH, + }, + Root: specs.Root{}, + Process: specs.Process{ + ConsoleSize: specs.Box{ + Width: 80, + Height: 20, + }, + }, + }, nil +} + +func WithImageConfig(ctx context.Context, i Image) SpecOpts { + return func(s *specs.Spec) error { + var ( + image = i.(*image) + store = image.client.ContentStore() + ) + ic, err := image.i.Config(ctx, store) + if err != nil { + return err + } + var ( + ociimage v1.Image + config v1.ImageConfig + ) + switch ic.MediaType { + case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config: + r, err := store.Reader(ctx, ic.Digest) + if err != nil { + return err + } + if err := json.NewDecoder(r).Decode(&ociimage); err != nil { + r.Close() + return err + } + r.Close() + config = ociimage.Config + default: + return fmt.Errorf("unknown image config media type %s", ic.MediaType) + } + s.Process.Env = config.Env + s.Process.Args = append(config.Entrypoint, config.Cmd...) + s.Process.User = specs.User{ + Username: config.User, + } + return nil + } +} + +func WithTTY(width, height int) SpecOpts { + return func(s *specs.Spec) error { + s.Process.Terminal = true + s.Process.ConsoleSize.Width = uint(width) + s.Process.ConsoleSize.Height = uint(height) + return nil + } +} + +func WithSpec(spec *specs.Spec) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + data, err := json.Marshal(spec) + if err != nil { + return err + } + c.Spec = &protobuf.Any{ + TypeUrl: spec.Version, + Value: data, + } + return nil + } +} diff --git a/vendor/github.com/containerd/containerd/task.go b/vendor/github.com/containerd/containerd/task.go new file mode 100644 index 0000000000..77570ad1df --- /dev/null +++ b/vendor/github.com/containerd/containerd/task.go @@ -0,0 +1,335 @@ +package containerd + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "runtime" + "strings" + "syscall" + + "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/api/services/execution" + taskapi "github.com/containerd/containerd/api/types/task" + "github.com/containerd/containerd/content" + "github.com/containerd/containerd/rootfs" + "github.com/opencontainers/image-spec/specs-go/v1" + specs "github.com/opencontainers/runtime-spec/specs-go" +) + +const UnknownExitStatus = 255 + +type TaskStatus string + +const ( + Running TaskStatus = "running" + Created TaskStatus = "created" + Stopped TaskStatus = "stopped" + Paused TaskStatus = "paused" + Pausing TaskStatus = "pausing" +) + +type CheckpointOpts func(*execution.CheckpointRequest) error + +type Task interface { + Pid() uint32 + Delete(context.Context) (uint32, error) + Kill(context.Context, syscall.Signal) error + Pause(context.Context) error + Resume(context.Context) error + Start(context.Context) error + Status(context.Context) (TaskStatus, error) + Wait(context.Context) (uint32, error) + Exec(context.Context, *specs.Process, IOCreation) (Process, error) + Processes(context.Context) ([]uint32, error) + CloseStdin(context.Context) error + Resize(ctx context.Context, w, h uint32) error + IO() *IO + Checkpoint(context.Context, ...CheckpointOpts) (v1.Descriptor, error) +} + +type Process interface { + Pid() uint32 + Start(context.Context) error + Delete(context.Context) (uint32, error) + Kill(context.Context, syscall.Signal) error + Wait(context.Context) (uint32, error) + CloseStdin(context.Context) error + Resize(ctx context.Context, w, h uint32) error + IO() *IO +} + +var _ = (Task)(&task{}) + +type task struct { + client *Client + + io *IO + containerID string + pid uint32 + + deferred *execution.CreateRequest + pidSync chan struct{} +} + +// Pid returns the pid or process id for the task +func (t *task) Pid() uint32 { + return t.pid +} + +func (t *task) Start(ctx context.Context) error { + if t.deferred != nil { + response, err := t.client.TaskService().Create(ctx, t.deferred) + t.deferred = nil + if err != nil { + return err + } + t.pid = response.Pid + close(t.pidSync) + return nil + } + _, err := t.client.TaskService().Start(ctx, &execution.StartRequest{ + ContainerID: t.containerID, + }) + return err +} + +func (t *task) Kill(ctx context.Context, s syscall.Signal) error { + _, err := t.client.TaskService().Kill(ctx, &execution.KillRequest{ + Signal: uint32(s), + ContainerID: t.containerID, + PidOrAll: &execution.KillRequest_All{ + All: true, + }, + }) + return err +} + +func (t *task) Pause(ctx context.Context) error { + _, err := t.client.TaskService().Pause(ctx, &execution.PauseRequest{ + ContainerID: t.containerID, + }) + return err +} + +func (t *task) Resume(ctx context.Context) error { + _, err := t.client.TaskService().Resume(ctx, &execution.ResumeRequest{ + ContainerID: t.containerID, + }) + return err +} + +func (t *task) Status(ctx context.Context) (TaskStatus, error) { + r, err := t.client.TaskService().Info(ctx, &execution.InfoRequest{ + ContainerID: t.containerID, + }) + if err != nil { + return "", err + } + return TaskStatus(strings.ToLower(r.Task.Status.String())), nil +} + +// Wait is a blocking call that will wait for the task to exit and return the exit status +func (t *task) Wait(ctx context.Context) (uint32, error) { + events, err := t.client.TaskService().Events(ctx, &execution.EventsRequest{}) + if err != nil { + return UnknownExitStatus, err + } + <-t.pidSync + for { + e, err := events.Recv() + if err != nil { + return UnknownExitStatus, err + } + if e.Type != taskapi.Event_EXIT { + continue + } + if e.ID == t.containerID && e.Pid == t.pid { + return e.ExitStatus, nil + } + } +} + +// Delete deletes the task and its runtime state +// it returns the exit status of the task and any errors that were encountered +// during cleanup +func (t *task) Delete(ctx context.Context) (uint32, error) { + var cerr error + if t.io != nil { + cerr = t.io.Close() + } + r, err := t.client.TaskService().Delete(ctx, &execution.DeleteRequest{ + ContainerID: t.containerID, + }) + if err != nil { + return UnknownExitStatus, err + } + return r.ExitStatus, cerr +} + +func (t *task) Exec(ctx context.Context, spec *specs.Process, ioCreate IOCreation) (Process, error) { + i, err := ioCreate() + if err != nil { + return nil, err + } + return &process{ + task: t, + io: i, + spec: spec, + pidSync: make(chan struct{}), + }, nil +} + +func (t *task) Processes(ctx context.Context) ([]uint32, error) { + response, err := t.client.TaskService().Processes(ctx, &execution.ProcessesRequest{ + ContainerID: t.containerID, + }) + if err != nil { + return nil, err + } + var out []uint32 + for _, p := range response.Processes { + out = append(out, p.Pid) + } + return out, nil +} + +func (t *task) CloseStdin(ctx context.Context) error { + _, err := t.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{ + ContainerID: t.containerID, + Pid: t.pid, + }) + return err +} + +func (t *task) IO() *IO { + return t.io +} + +func (t *task) Resize(ctx context.Context, w, h uint32) error { + _, err := t.client.TaskService().Pty(ctx, &execution.PtyRequest{ + ContainerID: t.containerID, + Width: w, + Height: h, + Pid: t.pid, + }) + return err +} + +func WithExit(r *execution.CheckpointRequest) error { + r.Exit = true + return nil +} + +func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) { + request := &execution.CheckpointRequest{ + ContainerID: t.containerID, + } + for _, o := range opts { + if err := o(request); err != nil { + return d, err + } + } + // if we are not exiting the container after the checkpoint, make sure we pause it and resume after + // all other filesystem operations are completed + if !request.Exit { + if err := t.Pause(ctx); err != nil { + return d, err + } + defer t.Resume(ctx) + } + cr, err := t.client.ContainerService().Get(ctx, &containers.GetContainerRequest{ + ID: t.containerID, + }) + if err != nil { + return d, err + } + var index v1.Index + if err := t.checkpointTask(ctx, &index, request); err != nil { + return d, err + } + if err := t.checkpointImage(ctx, &index, cr.Container.Image); err != nil { + return d, err + } + if err := t.checkpointRWSnapshot(ctx, &index, cr.Container.RootFS); err != nil { + return d, err + } + index.Annotations = make(map[string]string) + index.Annotations["image.name"] = cr.Container.Image + return t.writeIndex(ctx, &index) +} + +func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *execution.CheckpointRequest) error { + response, err := t.client.TaskService().Checkpoint(ctx, request) + if err != nil { + return err + } + // add the checkpoint descriptors to the index + for _, d := range response.Descriptors { + index.Manifests = append(index.Manifests, v1.Descriptor{ + MediaType: d.MediaType, + Size: d.Size_, + Digest: d.Digest, + Platform: &v1.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + }, + }) + } + return nil +} + +func (t *task) checkpointRWSnapshot(ctx context.Context, index *v1.Index, id string) error { + rw, err := rootfs.Diff(ctx, id, fmt.Sprintf("checkpoint-rw-%s", id), t.client.SnapshotService(), t.client.DiffService()) + if err != nil { + return err + } + rw.Platform = &v1.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + } + index.Manifests = append(index.Manifests, rw) + return nil +} + +func (t *task) checkpointImage(ctx context.Context, index *v1.Index, image string) error { + if image == "" { + return fmt.Errorf("cannot checkpoint image with empty name") + } + ir, err := t.client.ImageService().Get(ctx, image) + if err != nil { + return err + } + index.Manifests = append(index.Manifests, ir.Target) + return nil +} + +func (t *task) writeIndex(ctx context.Context, index *v1.Index) (v1.Descriptor, error) { + buf := bytes.NewBuffer(nil) + if err := json.NewEncoder(buf).Encode(index); err != nil { + return v1.Descriptor{}, err + } + return writeContent(ctx, t.client.ContentStore(), v1.MediaTypeImageIndex, t.containerID, buf) +} + +func writeContent(ctx context.Context, store content.Store, mediaType, ref string, r io.Reader) (d v1.Descriptor, err error) { + writer, err := store.Writer(ctx, ref, 0, "") + if err != nil { + return d, err + } + defer writer.Close() + size, err := io.Copy(writer, r) + if err != nil { + return d, err + } + if err := writer.Commit(0, ""); err != nil { + return d, err + } + return v1.Descriptor{ + MediaType: mediaType, + Digest: writer.Digest(), + Size: size, + }, nil +} diff --git a/vendor/github.com/opencontainers/image-spec/identity/chainid.go b/vendor/github.com/opencontainers/image-spec/identity/chainid.go new file mode 100644 index 0000000000..0bb2853573 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/identity/chainid.go @@ -0,0 +1,67 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package identity provides implementations of subtle calculations pertaining +// to image and layer identity. The primary item present here is the ChainID +// calculation used in identifying the result of subsequent layer applications. +// +// Helpers are also provided here to ease transition to the +// github.com/opencontainers/go-digest package, but that package may be used +// directly. +package identity + +import "github.com/opencontainers/go-digest" + +// ChainID takes a slice of digests and returns the ChainID corresponding to +// the last entry. Typically, these are a list of layer DiffIDs, with the +// result providing the ChainID identifying the result of sequential +// application of the preceding layers. +func ChainID(dgsts []digest.Digest) digest.Digest { + chainIDs := make([]digest.Digest, len(dgsts)) + copy(chainIDs, dgsts) + ChainIDs(chainIDs) + + if len(chainIDs) == 0 { + return "" + } + return chainIDs[len(chainIDs)-1] +} + +// ChainIDs calculates the recursively applied chain id for each identifier in +// the slice. The result is written direcly back into the slice such that the +// ChainID for each item will be in the respective position. +// +// By definition of ChainID, the zeroth element will always be the same before +// and after the call. +// +// As an example, given the chain of ids `[A, B, C]`, the result `[A, +// ChainID(A|B), ChainID(A|B|C)]` will be written back to the slice. +// +// The input is provided as a return value for convenience. +// +// Typically, these are a list of layer DiffIDs, with the +// result providing the ChainID for each the result of each layer application +// sequentially. +func ChainIDs(dgsts []digest.Digest) []digest.Digest { + if len(dgsts) < 2 { + return dgsts + } + + parent := digest.FromBytes([]byte(dgsts[0] + " " + dgsts[1])) + next := dgsts[1:] + next[0] = parent + ChainIDs(next) + + return dgsts +} diff --git a/vendor/github.com/opencontainers/image-spec/identity/helpers.go b/vendor/github.com/opencontainers/image-spec/identity/helpers.go new file mode 100644 index 0000000000..9d96eaa981 --- /dev/null +++ b/vendor/github.com/opencontainers/image-spec/identity/helpers.go @@ -0,0 +1,40 @@ +// Copyright 2016 The Linux Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package identity + +import ( + _ "crypto/sha256" // side-effect to install impls, sha256 + _ "crypto/sha512" // side-effect to install impls, sha384/sh512 + + "io" + + digest "github.com/opencontainers/go-digest" +) + +// FromReader consumes the content of rd until io.EOF, returning canonical +// digest. +func FromReader(rd io.Reader) (digest.Digest, error) { + return digest.Canonical.FromReader(rd) +} + +// FromBytes digests the input and returns a Digest. +func FromBytes(p []byte) digest.Digest { + return digest.Canonical.FromBytes(p) +} + +// FromString digests the input and returns a Digest. +func FromString(s string) digest.Digest { + return digest.Canonical.FromString(s) +} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go new file mode 100644 index 0000000000..89c4d459f0 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-go. +// source: health.proto +// DO NOT EDIT! + +/* +Package grpc_health_v1 is a generated protocol buffer package. + +It is generated from these files: + health.proto + +It has these top-level messages: + HealthCheckRequest + HealthCheckResponse +*/ +package grpc_health_v1 + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type HealthCheckResponse_ServingStatus int32 + +const ( + HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 + HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 + HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 +) + +var HealthCheckResponse_ServingStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SERVING", + 2: "NOT_SERVING", +} +var HealthCheckResponse_ServingStatus_value = map[string]int32{ + "UNKNOWN": 0, + "SERVING": 1, + "NOT_SERVING": 2, +} + +func (x HealthCheckResponse_ServingStatus) String() string { + return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) +} +func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{1, 0} +} + +type HealthCheckRequest struct { + Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` +} + +func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } +func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } +func (*HealthCheckRequest) ProtoMessage() {} +func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type HealthCheckResponse struct { + Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` +} + +func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } +func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } +func (*HealthCheckResponse) ProtoMessage() {} +func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func init() { + proto.RegisterType((*HealthCheckRequest)(nil), "grpc.health.v1.HealthCheckRequest") + proto.RegisterType((*HealthCheckResponse)(nil), "grpc.health.v1.HealthCheckResponse") + proto.RegisterEnum("grpc.health.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Health service + +type HealthClient interface { + Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) +} + +type healthClient struct { + cc *grpc.ClientConn +} + +func NewHealthClient(cc *grpc.ClientConn) HealthClient { + return &healthClient{cc} +} + +func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + out := new(HealthCheckResponse) + err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Health service + +type HealthServer interface { + Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) +} + +func RegisterHealthServer(s *grpc.Server, srv HealthServer) { + s.RegisterService(&_Health_serviceDesc, srv) +} + +func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HealthServer).Check(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.health.v1.Health/Check", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Health_serviceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.health.v1.Health", + HandlerType: (*HealthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Check", + Handler: _Health_Check_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "health.proto", +} + +func init() { proto.RegisterFile("health.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 204 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0x48, 0x4d, 0xcc, + 0x29, 0xc9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4b, 0x2f, 0x2a, 0x48, 0xd6, 0x83, + 0x0a, 0x95, 0x19, 0x2a, 0xe9, 0x71, 0x09, 0x79, 0x80, 0x39, 0xce, 0x19, 0xa9, 0xc9, 0xd9, 0x41, + 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0x45, 0x65, 0x99, 0xc9, + 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x30, 0xae, 0xd2, 0x1c, 0x46, 0x2e, 0x61, 0x14, + 0x0d, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x9e, 0x5c, 0x6c, 0xc5, 0x25, 0x89, 0x25, 0xa5, + 0xc5, 0x60, 0x0d, 0x7c, 0x46, 0x86, 0x7a, 0xa8, 0x16, 0xe9, 0x61, 0xd1, 0xa4, 0x17, 0x0c, 0x32, + 0x34, 0x2f, 0x3d, 0x18, 0xac, 0x31, 0x08, 0x6a, 0x80, 0x92, 0x15, 0x17, 0x2f, 0x8a, 0x84, 0x10, + 0x37, 0x17, 0x7b, 0xa8, 0x9f, 0xb7, 0x9f, 0x7f, 0xb8, 0x9f, 0x00, 0x03, 0x88, 0x13, 0xec, 0x1a, + 0x14, 0xe6, 0xe9, 0xe7, 0x2e, 0xc0, 0x28, 0xc4, 0xcf, 0xc5, 0xed, 0xe7, 0x1f, 0x12, 0x0f, 0x13, + 0x60, 0x32, 0x8a, 0xe2, 0x62, 0x83, 0x58, 0x24, 0x14, 0xc0, 0xc5, 0x0a, 0xb6, 0x4c, 0x48, 0x09, + 0xaf, 0x4b, 0xc0, 0xfe, 0x95, 0x52, 0x26, 0xc2, 0xb5, 0x49, 0x6c, 0xe0, 0x10, 0x34, 0x06, 0x04, + 0x00, 0x00, 0xff, 0xff, 0xac, 0x56, 0x2a, 0xcb, 0x51, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto new file mode 100644 index 0000000000..e2dc088925 --- /dev/null +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package grpc.health.v1; + +message HealthCheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + ServingStatus status = 1; +} + +service Health{ + rpc Check(HealthCheckRequest) returns (HealthCheckResponse); +} From 6cbf81bff6fac121e789dabc99285d7b31a5f3f3 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 13:42:54 +0100 Subject: [PATCH 08/35] containerd: Use containerd.GenerateSpec Rootfs and Mounts handling is not converted yet and will follow. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 134 ++++++------------------------- 1 file changed, 26 insertions(+), 108 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index ff1fe4e97e..a7c6628a3a 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -6,7 +6,6 @@ import ( "io" "os" "path/filepath" - "runtime" "sort" "strings" "sync" @@ -279,120 +278,39 @@ func (c *containerAdapter) setMounts(ctx context.Context, s *specs.Spec, mounts return nil } -func (c *containerAdapter) makeSpec(ctx context.Context, config *ocispec.ImageConfig, rootfs string) (*specs.Spec, error) { - caps := []string{ - "CAP_CHOWN", - "CAP_DAC_OVERRIDE", - "CAP_FSETID", - "CAP_FOWNER", - "CAP_MKNOD", - "CAP_NET_RAW", - "CAP_SETGID", - "CAP_SETUID", - "CAP_SETFCAP", - "CAP_SETPCAP", - "CAP_NET_BIND_SERVICE", - "CAP_SYS_CHROOT", - "CAP_KILL", - "CAP_AUDIT_WRITE", - } - - // Need github.com/docker/docker/oci.DefaultSpec() - spec := specs.Spec{ - Version: "1.0.0-rc2-dev", - Root: specs.Root{ - Path: rootfs, - }, - Mounts: []specs.Mount{ - { - Destination: "/proc", - Type: "proc", - Source: "proc", - Options: []string{"nosuid", "noexec", "nodev"}, - }, - { - Destination: "/dev", - Type: "tmpfs", - Source: "tmpfs", - Options: []string{"nosuid", "strictatime", "mode=755"}, - }, - { - Destination: "/dev/pts", - Type: "devpts", - Source: "devpts", - Options: []string{"nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5"}, - }, - { - Destination: "/sys", - Type: "sysfs", - Source: "sysfs", - Options: []string{"nosuid", "noexec", "nodev", "ro"}, - }, - { - Destination: "/sys/fs/cgroup", - Type: "cgroup", - Source: "cgroup", - Options: []string{"ro", "nosuid", "noexec", "nodev"}, - }, - { - Destination: "/dev/mqueue", - Type: "mqueue", - Source: "mqueue", - Options: []string{"nosuid", "noexec", "nodev"}, - }, - }, - Process: specs.Process{ - Cwd: "/", - Capabilities: &specs.LinuxCapabilities{ - Bounding: caps, - Effective: caps, - Inheritable: caps, - Permitted: caps, - Ambient: caps, - }, - NoNewPrivileges: true, - Terminal: false, +func (c *containerAdapter) specOpts(ctx context.Context, config *ocispec.ImageConfig, rootfs string) []containerd.SpecOpts { + opts := []containerd.SpecOpts{ + containerd.WithImageConfig(ctx, c.image), + func(s *specs.Spec) error { + s.Root.Path = rootfs + return nil }, - Linux: &specs.Linux{ - Namespaces: []specs.LinuxNamespace{ - {Type: "mount"}, - {Type: "network"}, - {Type: "uts"}, - {Type: "pid"}, - {Type: "ipc"}, - }, + func(s *specs.Spec) error { + if err := c.setMounts(ctx, s, c.spec.Mounts, config.Volumes); err != nil { + return errors.Wrap(err, "failed to set mounts") + } + sort.Sort(mounts(s.Mounts)) + return nil }, } - spec.Platform = specs.Platform{ - OS: runtime.GOOS, - Arch: runtime.GOARCH, - } - if config.WorkingDir != "" { - spec.Process.Cwd = config.WorkingDir - } - spec.Process.Env = config.Env - - var args []string - if len(c.spec.Args) > 0 { - args = c.spec.Args - } else { - args = config.Cmd - } - + // spec.Process.Args is config.Entrypoint + config.Cmd at this + // point from WithImageConfig above. If the ContainerSpec + // specifies a Command then we can completely override. If it + // does not then all we can do is append our Args and hope + // they do not conflict. + // TODO(ijc) Improve this if len(c.spec.Command) > 0 { - spec.Process.Args = append(c.spec.Command, args...) + args := append(c.spec.Command, c.spec.Args...) + opts = append(opts, containerd.WithProcessArgs(args...)) } else { - spec.Process.Args = append(config.Entrypoint, args...) - } - - log.G(ctx).Debugf("Process args: %v", spec.Process.Args) - if err := c.setMounts(ctx, &spec, c.spec.Mounts, config.Volumes); err != nil { - return nil, errors.Wrap(err, "failed to set mounts") + opts = append(opts, func(s *specs.Spec) error { + s.Process.Args = append(s.Process.Args, c.spec.Args...) + return nil + }) } - sort.Sort(mounts(spec.Mounts)) - return &spec, nil + return opts } func (c *containerAdapter) create(ctx context.Context) error { @@ -445,7 +363,7 @@ func (c *containerAdapter) create(ctx context.Context) error { } } - spec, err := c.makeSpec(ctx, &config.Config, rootfs) + spec, err := containerd.GenerateSpec(c.specOpts(ctx, &config.Config, rootfs)...) if err != nil { return err } From 88a62bf6125dbd6677fb4f38a44cdae485b8f0f0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 8 Jun 2017 17:48:45 +0100 Subject: [PATCH 09/35] containerd: Use containerd.WithPullUnpack and containerd.WithNewRootFS This means we no longer need to unpack the rootfs manually. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 50 +- vendor.conf | 1 - .../archive/compression/compression.go | 125 ----- .../containerd/containerd/archive/tar.go | 528 ------------------ .../containerd/containerd/archive/tar_unix.go | 133 ----- .../containerd/archive/tar_windows.go | 104 ---- .../containerd/containerd/archive/time.go | 38 -- .../containerd/archive/time_darwin.go | 14 - .../containerd/archive/time_unix.go | 23 - .../containerd/archive/time_windows.go | 25 - .../containerd/containerd/fs/copy.go | 120 ---- .../containerd/containerd/fs/copy_linux.go | 82 --- .../containerd/containerd/fs/copy_unix.go | 65 --- .../containerd/containerd/fs/copy_windows.go | 33 -- .../containerd/containerd/fs/diff.go | 310 ---------- .../containerd/containerd/fs/diff_unix.go | 102 ---- .../containerd/containerd/fs/diff_windows.go | 21 - .../containerd/containerd/fs/dtype_linux.go | 87 --- .../github.com/containerd/containerd/fs/du.go | 12 - .../containerd/containerd/fs/du_unix.go | 42 -- .../containerd/containerd/fs/du_windows.go | 33 -- .../containerd/containerd/fs/hardlink.go | 27 - .../containerd/containerd/fs/hardlink_unix.go | 17 - .../containerd/fs/hardlink_windows.go | 7 - .../containerd/containerd/fs/path.go | 162 ------ .../containerd/containerd/fs/time.go | 13 - .../containerd/containerd/sys/epoll.go | 20 - .../containerd/containerd/sys/fds.go | 18 - .../containerd/sys/filesys_windows.go | 236 -------- .../containerd/containerd/sys/oom_unix.go | 31 - .../containerd/containerd/sys/oom_windows.go | 5 - .../containerd/containerd/sys/prctl.go | 49 -- .../containerd/sys/prctl_solaris.go | 19 - .../containerd/containerd/sys/proc.go | 64 --- .../containerd/containerd/sys/reaper.go | 51 -- .../containerd/containerd/sys/socket_unix.go | 42 -- .../containerd/sys/socket_windows.go | 16 - .../github.com/containerd/continuity/LICENSE | 202 ------- .../containerd/continuity/README.md | 19 - .../containerd/continuity/sysx/asm.s | 10 - .../continuity/sysx/chmod_darwin.go | 18 - .../continuity/sysx/chmod_darwin_386.go | 25 - .../continuity/sysx/chmod_darwin_amd64.go | 25 - .../continuity/sysx/chmod_freebsd.go | 17 - .../continuity/sysx/chmod_freebsd_amd64.go | 25 - .../containerd/continuity/sysx/chmod_linux.go | 12 - .../containerd/continuity/sysx/copy_linux.go | 9 - .../continuity/sysx/copy_linux_386.go | 20 - .../continuity/sysx/copy_linux_amd64.go | 20 - .../continuity/sysx/copy_linux_arm.go | 20 - .../continuity/sysx/copy_linux_arm64.go | 20 - .../continuity/sysx/nodata_linux.go | 7 - .../containerd/continuity/sysx/nodata_unix.go | 9 - .../containerd/continuity/sysx/sys.go | 37 -- .../continuity/sysx/sysnum_linux_386.go | 7 - .../continuity/sysx/sysnum_linux_amd64.go | 7 - .../continuity/sysx/sysnum_linux_arm.go | 7 - .../continuity/sysx/sysnum_linux_arm64.go | 7 - .../containerd/continuity/sysx/xattr.go | 67 --- .../continuity/sysx/xattr_darwin.go | 71 --- .../continuity/sysx/xattr_darwin_386.go | 111 ---- .../continuity/sysx/xattr_darwin_amd64.go | 111 ---- .../continuity/sysx/xattr_freebsd.go | 53 -- .../containerd/continuity/sysx/xattr_linux.go | 61 -- .../continuity/sysx/xattr_linux_386.go | 111 ---- .../continuity/sysx/xattr_linux_amd64.go | 111 ---- .../continuity/sysx/xattr_linux_arm.go | 111 ---- .../continuity/sysx/xattr_linux_arm64.go | 111 ---- .../continuity/sysx/xattr_linux_ppc64.go | 111 ---- .../continuity/sysx/xattr_linux_ppc64le.go | 111 ---- .../continuity/sysx/xattr_linux_s390x.go | 111 ---- .../runc/libcontainer/system/linux.go | 143 ----- .../runc/libcontainer/system/proc.go | 43 -- .../runc/libcontainer/system/setns_linux.go | 40 -- .../libcontainer/system/syscall_linux_386.go | 25 - .../libcontainer/system/syscall_linux_64.go | 25 - .../libcontainer/system/syscall_linux_arm.go | 25 - .../runc/libcontainer/system/sysconfig.go | 12 - .../libcontainer/system/sysconfig_notcgo.go | 15 - .../runc/libcontainer/system/unsupported.go | 9 - .../runc/libcontainer/system/xattrs_linux.go | 99 ---- 81 files changed, 11 insertions(+), 4924 deletions(-) delete mode 100644 vendor/github.com/containerd/containerd/archive/compression/compression.go delete mode 100644 vendor/github.com/containerd/containerd/archive/tar.go delete mode 100644 vendor/github.com/containerd/containerd/archive/tar_unix.go delete mode 100644 vendor/github.com/containerd/containerd/archive/tar_windows.go delete mode 100644 vendor/github.com/containerd/containerd/archive/time.go delete mode 100644 vendor/github.com/containerd/containerd/archive/time_darwin.go delete mode 100644 vendor/github.com/containerd/containerd/archive/time_unix.go delete mode 100644 vendor/github.com/containerd/containerd/archive/time_windows.go delete mode 100644 vendor/github.com/containerd/containerd/fs/copy.go delete mode 100644 vendor/github.com/containerd/containerd/fs/copy_linux.go delete mode 100644 vendor/github.com/containerd/containerd/fs/copy_unix.go delete mode 100644 vendor/github.com/containerd/containerd/fs/copy_windows.go delete mode 100644 vendor/github.com/containerd/containerd/fs/diff.go delete mode 100644 vendor/github.com/containerd/containerd/fs/diff_unix.go delete mode 100644 vendor/github.com/containerd/containerd/fs/diff_windows.go delete mode 100644 vendor/github.com/containerd/containerd/fs/dtype_linux.go delete mode 100644 vendor/github.com/containerd/containerd/fs/du.go delete mode 100644 vendor/github.com/containerd/containerd/fs/du_unix.go delete mode 100644 vendor/github.com/containerd/containerd/fs/du_windows.go delete mode 100644 vendor/github.com/containerd/containerd/fs/hardlink.go delete mode 100644 vendor/github.com/containerd/containerd/fs/hardlink_unix.go delete mode 100644 vendor/github.com/containerd/containerd/fs/hardlink_windows.go delete mode 100644 vendor/github.com/containerd/containerd/fs/path.go delete mode 100644 vendor/github.com/containerd/containerd/fs/time.go delete mode 100644 vendor/github.com/containerd/containerd/sys/epoll.go delete mode 100644 vendor/github.com/containerd/containerd/sys/fds.go delete mode 100644 vendor/github.com/containerd/containerd/sys/filesys_windows.go delete mode 100644 vendor/github.com/containerd/containerd/sys/oom_unix.go delete mode 100644 vendor/github.com/containerd/containerd/sys/oom_windows.go delete mode 100644 vendor/github.com/containerd/containerd/sys/prctl.go delete mode 100644 vendor/github.com/containerd/containerd/sys/prctl_solaris.go delete mode 100644 vendor/github.com/containerd/containerd/sys/proc.go delete mode 100644 vendor/github.com/containerd/containerd/sys/reaper.go delete mode 100644 vendor/github.com/containerd/containerd/sys/socket_unix.go delete mode 100644 vendor/github.com/containerd/containerd/sys/socket_windows.go delete mode 100644 vendor/github.com/containerd/continuity/LICENSE delete mode 100644 vendor/github.com/containerd/continuity/README.md delete mode 100644 vendor/github.com/containerd/continuity/sysx/asm.s delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_darwin.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_darwin_386.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_darwin_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_freebsd.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_freebsd_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/chmod_linux.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_386.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_arm.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/copy_linux_arm64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/nodata_linux.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/nodata_unix.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/sys.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_386.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_darwin.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_darwin_386.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_darwin_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go delete mode 100644 vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/linux.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/proc.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go delete mode 100644 vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index a7c6628a3a..ed8c170a22 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -16,8 +16,6 @@ import ( containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/task" - "github.com/containerd/containerd/archive" - "github.com/containerd/containerd/archive/compression" "github.com/containerd/containerd/content" "github.com/containerd/fifo" dockermount "github.com/docker/docker/pkg/mount" @@ -25,7 +23,6 @@ import ( "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/api/naming" "github.com/docker/swarmkit/log" - "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" @@ -76,23 +73,6 @@ func newContainerAdapter(client *containerd.Client, containerDir string, task *a }, nil } -func (c *containerAdapter) applyLayer(ctx context.Context, cs content.Store, rootfs string, layer digest.Digest) error { - blob, err := cs.Reader(ctx, layer) - if err != nil { - return err - } - - rd, err := compression.DecompressStream(blob) - if err != nil { - return err - } - - _, err = archive.Apply(ctx, rootfs, rd) - - blob.Close() - return err -} - // github.com/containerd/containerd cmd/ctr/utils.go, dropped stdin handling func prepareStdio(stdout, stderr string, console bool) (wg *sync.WaitGroup, err error) { wg = &sync.WaitGroup{} @@ -136,7 +116,7 @@ func prepareStdio(stdout, stderr string, console bool) (wg *sync.WaitGroup, err } func (c *containerAdapter) pullImage(ctx context.Context) error { - image, err := c.client.Pull(ctx, c.spec.Image) + image, err := c.client.Pull(ctx, c.spec.Image, containerd.WithPullUnpack) if err != nil { return errors.Wrap(err, "pulling container image") } @@ -275,16 +255,13 @@ func (c *containerAdapter) setMounts(ctx context.Context, s *specs.Spec, mounts s.Mounts = append(s.Mounts, mt) } + return nil } -func (c *containerAdapter) specOpts(ctx context.Context, config *ocispec.ImageConfig, rootfs string) []containerd.SpecOpts { +func (c *containerAdapter) specOpts(ctx context.Context, config *ocispec.ImageConfig) []containerd.SpecOpts { opts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), - func(s *specs.Spec) error { - s.Root.Path = rootfs - return nil - }, func(s *specs.Spec) error { if err := c.setMounts(ctx, s, c.spec.Mounts, config.Volumes); err != nil { return errors.Wrap(err, "failed to set mounts") @@ -331,16 +308,15 @@ func (c *containerAdapter) create(ctx context.Context) error { return err } - rootfs := filepath.Join(c.dir, "rootfs") + if err := os.MkdirAll(c.dir, 0755); err != nil { + return err + } + // TODO(ijc) support ControllerLogs interface stdin := "/dev/null" stdout := filepath.Join(c.dir, "stdout") stderr := filepath.Join(c.dir, "stderr") - if err := os.MkdirAll(rootfs, 0755); err != nil { - return err - } - var config ocispec.Image var manifest ocispec.Manifest @@ -357,13 +333,7 @@ func (c *containerAdapter) create(ctx context.Context) error { return errors.Wrap(err, "unmarshalling image config") } - for _, layer := range manifest.Layers { - if err := c.applyLayer(ctx, cs, rootfs, layer.Digest); err != nil { - return errors.Wrapf(err, "failed to apply layer %s", layer.Digest.String()) - } - } - - spec, err := containerd.GenerateSpec(c.specOpts(ctx, &config.Config, rootfs)...) + spec, err := containerd.GenerateSpec(c.specOpts(ctx, &config.Config)...) if err != nil { return err } @@ -373,7 +343,9 @@ func (c *containerAdapter) create(ctx context.Context) error { return err } - c.container, err = c.client.NewContainer(ctx, c.name, containerd.WithSpec(spec)) + c.container, err = c.client.NewContainer(ctx, c.name, + containerd.WithSpec(spec), + containerd.WithNewRootFS(c.name, c.image)) if err != nil { return errors.Wrap(err, "creating container") } diff --git a/vendor.conf b/vendor.conf index 449bd194f3..a3b17d6f5d 100644 --- a/vendor.conf +++ b/vendor.conf @@ -32,7 +32,6 @@ github.com/opencontainers/image-spec 372ad780f63454fbbbbcc7cf80e5b90245c13e13 # containerd executor github.com/containerd/containerd 7e3b7dead60d96e9a7b13b8813d1712c7761e327 -github.com/containerd/continuity 86cec1535a968310e7532819f699ff2830ed7463 github.com/containerd/fifo 69b99525e472735860a5269b75af1970142b3062 github.com/opencontainers/runtime-spec v1.0.0-rc5 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c diff --git a/vendor/github.com/containerd/containerd/archive/compression/compression.go b/vendor/github.com/containerd/containerd/archive/compression/compression.go deleted file mode 100644 index ac4bf148c6..0000000000 --- a/vendor/github.com/containerd/containerd/archive/compression/compression.go +++ /dev/null @@ -1,125 +0,0 @@ -package compression - -import ( - "bufio" - "bytes" - "compress/gzip" - "fmt" - "io" - "sync" -) - -type ( - // Compression is the state represents if compressed or not. - Compression int -) - -const ( - // Uncompressed represents the uncompressed. - Uncompressed Compression = iota - // Gzip is gzip compression algorithm. - Gzip -) - -var ( - bufioReader32KPool = &sync.Pool{ - New: func() interface{} { return bufio.NewReaderSize(nil, 32*1024) }, - } -) - -type readCloserWrapper struct { - io.Reader - closer func() error -} - -func (r *readCloserWrapper) Close() error { - if r.closer != nil { - return r.closer() - } - return nil -} - -type writeCloserWrapper struct { - io.Writer - closer func() error -} - -func (w *writeCloserWrapper) Close() error { - if w.closer != nil { - w.closer() - } - return nil -} - -// DetectCompression detects the compression algorithm of the source. -func DetectCompression(source []byte) Compression { - for compression, m := range map[Compression][]byte{ - Gzip: {0x1F, 0x8B, 0x08}, - } { - if len(source) < len(m) { - // Len too short - continue - } - if bytes.Equal(m, source[:len(m)]) { - return compression - } - } - return Uncompressed -} - -// DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. -func DecompressStream(archive io.Reader) (io.ReadCloser, error) { - buf := bufioReader32KPool.Get().(*bufio.Reader) - buf.Reset(archive) - bs, err := buf.Peek(10) - if err != nil && err != io.EOF { - // Note: we'll ignore any io.EOF error because there are some odd - // cases where the layer.tar file will be empty (zero bytes) and - // that results in an io.EOF from the Peek() call. So, in those - // cases we'll just treat it as a non-compressed stream and - // that means just create an empty layer. - // See Issue docker/docker#18170 - return nil, err - } - - closer := func() error { - buf.Reset(nil) - bufioReader32KPool.Put(buf) - return nil - } - switch compression := DetectCompression(bs); compression { - case Uncompressed: - readBufWrapper := &readCloserWrapper{buf, closer} - return readBufWrapper, nil - case Gzip: - gzReader, err := gzip.NewReader(buf) - if err != nil { - return nil, err - } - readBufWrapper := &readCloserWrapper{gzReader, closer} - return readBufWrapper, nil - default: - return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension()) - } -} - -// CompressStream compresseses the dest with specified compression algorithm. -func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { - switch compression { - case Uncompressed: - return &writeCloserWrapper{dest, nil}, nil - case Gzip: - return gzip.NewWriter(dest), nil - default: - return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension()) - } -} - -// Extension returns the extension of a file that uses the specified compression algorithm. -func (compression *Compression) Extension() string { - switch *compression { - case Gzip: - return "gz" - } - return "" -} diff --git a/vendor/github.com/containerd/containerd/archive/tar.go b/vendor/github.com/containerd/containerd/archive/tar.go deleted file mode 100644 index e98b3fb574..0000000000 --- a/vendor/github.com/containerd/containerd/archive/tar.go +++ /dev/null @@ -1,528 +0,0 @@ -package archive - -import ( - "archive/tar" - "context" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "runtime" - "strings" - "sync" - "syscall" - "time" - - "github.com/containerd/containerd/fs" - "github.com/containerd/containerd/log" - "github.com/pkg/errors" -) - -var ( - bufferPool = &sync.Pool{ - New: func() interface{} { - return make([]byte, 32*1024) - }, - } - - breakoutError = errors.New("file name outside of root") -) - -// Diff returns a tar stream of the computed filesystem -// difference between the provided directories. -// -// Produces a tar using OCI style file markers for deletions. Deleted -// files will be prepended with the prefix ".wh.". This style is -// based off AUFS whiteouts. -// See https://github.com/opencontainers/image-spec/blob/master/layer.md -func Diff(ctx context.Context, a, b string) io.ReadCloser { - r, w := io.Pipe() - - go func() { - err := WriteDiff(ctx, w, a, b) - if err = w.CloseWithError(err); err != nil { - log.G(ctx).WithError(err).Debugf("closing tar pipe failed") - } - }() - - return r -} - -// WriteDiff writes a tar stream of the computed difference between the -// provided directories. -// -// Produces a tar using OCI style file markers for deletions. Deleted -// files will be prepended with the prefix ".wh.". This style is -// based off AUFS whiteouts. -// See https://github.com/opencontainers/image-spec/blob/master/layer.md -func WriteDiff(ctx context.Context, w io.Writer, a, b string) error { - cw := newChangeWriter(w, b) - err := fs.Changes(ctx, a, b, cw.HandleChange) - if err != nil { - return errors.Wrap(err, "failed to create diff tar stream") - } - return cw.Close() -} - -const ( - // whiteoutPrefix prefix means file is a whiteout. If this is followed by a - // filename this means that file has been removed from the base layer. - // See https://github.com/opencontainers/image-spec/blob/master/layer.md#whiteouts - whiteoutPrefix = ".wh." - - // whiteoutMetaPrefix prefix means whiteout has a special meaning and is not - // for removing an actual file. Normally these files are excluded from exported - // archives. - whiteoutMetaPrefix = whiteoutPrefix + whiteoutPrefix - - // whiteoutLinkDir is a directory AUFS uses for storing hardlink links to other - // layers. Normally these should not go into exported archives and all changed - // hardlinks should be copied to the top layer. - whiteoutLinkDir = whiteoutMetaPrefix + "plnk" - - // whiteoutOpaqueDir file means directory has been made opaque - meaning - // readdir calls to this directory do not follow to lower layers. - whiteoutOpaqueDir = whiteoutMetaPrefix + ".opq" -) - -// Apply applies a tar stream of an OCI style diff tar. -// See https://github.com/opencontainers/image-spec/blob/master/layer.md#applying-changesets -func Apply(ctx context.Context, root string, r io.Reader) (int64, error) { - root = filepath.Clean(root) - fn := prepareApply() - defer fn() - - var ( - tr = tar.NewReader(r) - size int64 - dirs []*tar.Header - - // Used for handling opaque directory markers which - // may occur out of order - unpackedPaths = make(map[string]struct{}) - - // Used for aufs plink directory - aufsTempdir = "" - aufsHardlinks = make(map[string]*tar.Header) - ) - - // Iterate through the files in the archive. - for { - hdr, err := tr.Next() - if err == io.EOF { - // end of tar archive - break - } - if err != nil { - return 0, err - } - - size += hdr.Size - - // Normalize name, for safety and for a simple is-root check - hdr.Name = filepath.Clean(hdr.Name) - - if skipFile(hdr) { - log.G(ctx).Warnf("file %q ignored: archive may not be supported on system", hdr.Name) - continue - } - - // Note as these operations are platform specific, so must the slash be. - if !strings.HasSuffix(hdr.Name, string(os.PathSeparator)) { - // Not the root directory, ensure that the parent directory exists. - // This happened in some tests where an image had a tarfile without any - // parent directories. - parent := filepath.Dir(hdr.Name) - parentPath := filepath.Join(root, parent) - - if _, err := os.Lstat(parentPath); err != nil && os.IsNotExist(err) { - err = mkdirAll(parentPath, 0600) - if err != nil { - return 0, err - } - } - } - - // Skip AUFS metadata dirs - if strings.HasPrefix(hdr.Name, whiteoutMetaPrefix) { - // Regular files inside /.wh..wh.plnk can be used as hardlink targets - // We don't want this directory, but we need the files in them so that - // such hardlinks can be resolved. - if strings.HasPrefix(hdr.Name, whiteoutLinkDir) && hdr.Typeflag == tar.TypeReg { - basename := filepath.Base(hdr.Name) - aufsHardlinks[basename] = hdr - if aufsTempdir == "" { - if aufsTempdir, err = ioutil.TempDir("", "dockerplnk"); err != nil { - return 0, err - } - defer os.RemoveAll(aufsTempdir) - } - if err := createTarFile(ctx, filepath.Join(aufsTempdir, basename), root, hdr, tr); err != nil { - return 0, err - } - } - - if hdr.Name != whiteoutOpaqueDir { - continue - } - } - - path := filepath.Join(root, hdr.Name) - rel, err := filepath.Rel(root, path) - if err != nil { - return 0, err - } - - // Note as these operations are platform specific, so must the slash be. - if strings.HasPrefix(rel, ".."+string(os.PathSeparator)) { - return 0, errors.Wrapf(breakoutError, "%q is outside of %q", hdr.Name, root) - } - base := filepath.Base(path) - - if strings.HasPrefix(base, whiteoutPrefix) { - dir := filepath.Dir(path) - if base == whiteoutOpaqueDir { - _, err := os.Lstat(dir) - if err != nil { - return 0, err - } - err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if err != nil { - if os.IsNotExist(err) { - err = nil // parent was deleted - } - return err - } - if path == dir { - return nil - } - if _, exists := unpackedPaths[path]; !exists { - err := os.RemoveAll(path) - return err - } - return nil - }) - if err != nil { - return 0, err - } - continue - } - - originalBase := base[len(whiteoutPrefix):] - originalPath := filepath.Join(dir, originalBase) - if err := os.RemoveAll(originalPath); err != nil { - return 0, err - } - continue - } - // If path exits we almost always just want to remove and replace it. - // The only exception is when it is a directory *and* the file from - // the layer is also a directory. Then we want to merge them (i.e. - // just apply the metadata from the layer). - if fi, err := os.Lstat(path); err == nil { - if !(fi.IsDir() && hdr.Typeflag == tar.TypeDir) { - if err := os.RemoveAll(path); err != nil { - return 0, err - } - } - } - - srcData := io.Reader(tr) - srcHdr := hdr - - // Hard links into /.wh..wh.plnk don't work, as we don't extract that directory, so - // we manually retarget these into the temporary files we extracted them into - if hdr.Typeflag == tar.TypeLink && strings.HasPrefix(filepath.Clean(hdr.Linkname), whiteoutLinkDir) { - linkBasename := filepath.Base(hdr.Linkname) - srcHdr = aufsHardlinks[linkBasename] - if srcHdr == nil { - return 0, fmt.Errorf("Invalid aufs hardlink") - } - tmpFile, err := os.Open(filepath.Join(aufsTempdir, linkBasename)) - if err != nil { - return 0, err - } - defer tmpFile.Close() - srcData = tmpFile - } - - if err := createTarFile(ctx, path, root, srcHdr, srcData); err != nil { - return 0, err - } - - // Directory mtimes must be handled at the end to avoid further - // file creation in them to modify the directory mtime - if hdr.Typeflag == tar.TypeDir { - dirs = append(dirs, hdr) - } - unpackedPaths[path] = struct{}{} - } - - for _, hdr := range dirs { - path := filepath.Join(root, hdr.Name) - if err := chtimes(path, boundTime(latestTime(hdr.AccessTime, hdr.ModTime)), boundTime(hdr.ModTime)); err != nil { - return 0, err - } - } - - return size, nil -} - -type changeWriter struct { - tw *tar.Writer - source string - whiteoutT time.Time - inodeSrc map[uint64]string - inodeRefs map[uint64][]string -} - -func newChangeWriter(w io.Writer, source string) *changeWriter { - return &changeWriter{ - tw: tar.NewWriter(w), - source: source, - whiteoutT: time.Now(), - inodeSrc: map[uint64]string{}, - inodeRefs: map[uint64][]string{}, - } -} - -func (cw *changeWriter) HandleChange(k fs.ChangeKind, p string, f os.FileInfo, err error) error { - if err != nil { - return err - } - if k == fs.ChangeKindDelete { - whiteOutDir := filepath.Dir(p) - whiteOutBase := filepath.Base(p) - whiteOut := filepath.Join(whiteOutDir, whiteoutPrefix+whiteOutBase) - hdr := &tar.Header{ - Name: whiteOut[1:], - Size: 0, - ModTime: cw.whiteoutT, - AccessTime: cw.whiteoutT, - ChangeTime: cw.whiteoutT, - } - if err := cw.tw.WriteHeader(hdr); err != nil { - errors.Wrap(err, "failed to write whiteout header") - } - } else { - var ( - link string - err error - source = filepath.Join(cw.source, p) - ) - - if f.Mode()&os.ModeSymlink != 0 { - if link, err = os.Readlink(source); err != nil { - return err - } - } - - hdr, err := tar.FileInfoHeader(f, link) - if err != nil { - return err - } - - hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode))) - - name := p - if strings.HasPrefix(name, string(filepath.Separator)) { - name, err = filepath.Rel(string(filepath.Separator), name) - if err != nil { - return errors.Wrap(err, "failed to make path relative") - } - } - name, err = tarName(name) - if err != nil { - return errors.Wrap(err, "cannot canonicalize path") - } - // suffix with '/' for directories - if f.IsDir() && !strings.HasSuffix(name, "/") { - name += "/" - } - hdr.Name = name - - if err := setHeaderForSpecialDevice(hdr, name, f); err != nil { - return errors.Wrap(err, "failed to set device headers") - } - - // additionalLinks stores file names which must be linked to - // this file when this file is added - var additionalLinks []string - inode, isHardlink := fs.GetLinkInfo(f) - if isHardlink { - // If the inode has a source, always link to it - if source, ok := cw.inodeSrc[inode]; ok { - hdr.Typeflag = tar.TypeLink - hdr.Linkname = source - hdr.Size = 0 - } else { - if k == fs.ChangeKindUnmodified { - cw.inodeRefs[inode] = append(cw.inodeRefs[inode], name) - return nil - } - cw.inodeSrc[inode] = name - additionalLinks = cw.inodeRefs[inode] - delete(cw.inodeRefs, inode) - } - } else if k == fs.ChangeKindUnmodified { - // Nothing to write to diff - return nil - } - - if capability, err := getxattr(source, "security.capability"); err != nil { - return errors.Wrap(err, "failed to get capabilities xattr") - } else if capability != nil { - hdr.Xattrs = map[string]string{ - "security.capability": string(capability), - } - } - - if err := cw.tw.WriteHeader(hdr); err != nil { - return errors.Wrap(err, "failed to write file header") - } - - if hdr.Typeflag == tar.TypeReg && hdr.Size > 0 { - file, err := open(source) - if err != nil { - return errors.Wrapf(err, "failed to open path: %v", source) - } - defer file.Close() - - buf := bufferPool.Get().([]byte) - n, err := io.CopyBuffer(cw.tw, file, buf) - bufferPool.Put(buf) - if err != nil { - return errors.Wrap(err, "failed to copy") - } - if n != hdr.Size { - return errors.New("short write copying file") - } - } - - if additionalLinks != nil { - source = hdr.Name - for _, extra := range additionalLinks { - hdr.Name = extra - hdr.Typeflag = tar.TypeLink - hdr.Linkname = source - hdr.Size = 0 - if err := cw.tw.WriteHeader(hdr); err != nil { - return errors.Wrap(err, "failed to write file header") - } - } - } - } - return nil -} - -func (cw *changeWriter) Close() error { - if err := cw.tw.Close(); err != nil { - return errors.Wrap(err, "failed to close tar writer") - } - return nil -} - -func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header, reader io.Reader) error { - // hdr.Mode is in linux format, which we can use for syscalls, - // but for os.Foo() calls we need the mode converted to os.FileMode, - // so use hdrInfo.Mode() (they differ for e.g. setuid bits) - hdrInfo := hdr.FileInfo() - - switch hdr.Typeflag { - case tar.TypeDir: - // Create directory unless it exists as a directory already. - // In that case we just want to merge the two - if fi, err := os.Lstat(path); !(err == nil && fi.IsDir()) { - if err := os.Mkdir(path, hdrInfo.Mode()); err != nil { - return err - } - } - - case tar.TypeReg, tar.TypeRegA: - file, err := openFile(path, os.O_CREATE|os.O_WRONLY, hdrInfo.Mode()) - if err != nil { - return err - } - buf := bufferPool.Get().([]byte) - _, err = io.CopyBuffer(file, reader, buf) - if err1 := file.Close(); err == nil { - err = err1 - } - if err != nil { - return err - } - - case tar.TypeBlock, tar.TypeChar: - // Handle this is an OS-specific way - if err := handleTarTypeBlockCharFifo(hdr, path); err != nil { - return err - } - - case tar.TypeFifo: - // Handle this is an OS-specific way - if err := handleTarTypeBlockCharFifo(hdr, path); err != nil { - return err - } - - case tar.TypeLink: - targetPath := filepath.Join(extractDir, hdr.Linkname) - // check for hardlink breakout - if !strings.HasPrefix(targetPath, extractDir) { - return errors.Wrapf(breakoutError, "invalid hardlink %q -> %q", targetPath, hdr.Linkname) - } - if err := os.Link(targetPath, path); err != nil { - return err - } - - case tar.TypeSymlink: - // path -> hdr.Linkname = targetPath - // e.g. /extractDir/path/to/symlink -> ../2/file = /extractDir/path/2/file - targetPath := filepath.Join(filepath.Dir(path), hdr.Linkname) - - // the reason we don't need to check symlinks in the path (with FollowSymlinkInScope) is because - // that symlink would first have to be created, which would be caught earlier, at this very check: - if !strings.HasPrefix(targetPath, extractDir) { - return errors.Wrapf(breakoutError, "invalid symlink %q -> %q", path, hdr.Linkname) - } - if err := os.Symlink(hdr.Linkname, path); err != nil { - return err - } - - case tar.TypeXGlobalHeader: - log.G(ctx).Debug("PAX Global Extended Headers found and ignored") - return nil - - default: - return errors.Errorf("unhandled tar header type %d\n", hdr.Typeflag) - } - - // Lchown is not supported on Windows. - if runtime.GOOS != "windows" { - if err := os.Lchown(path, hdr.Uid, hdr.Gid); err != nil { - return err - } - } - - for key, value := range hdr.Xattrs { - if err := setxattr(path, key, value); err != nil { - if errors.Cause(err) == syscall.ENOTSUP { - log.G(ctx).WithError(err).Warnf("ignored xattr %s in archive", key) - continue - } - return err - } - } - - // There is no LChmod, so ignore mode for symlink. Also, this - // must happen after chown, as that can modify the file mode - if err := handleLChmod(hdr, path, hdrInfo); err != nil { - return err - } - - if err := chtimes(path, boundTime(latestTime(hdr.AccessTime, hdr.ModTime)), boundTime(hdr.ModTime)); err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/containerd/containerd/archive/tar_unix.go b/vendor/github.com/containerd/containerd/archive/tar_unix.go deleted file mode 100644 index 619510549a..0000000000 --- a/vendor/github.com/containerd/containerd/archive/tar_unix.go +++ /dev/null @@ -1,133 +0,0 @@ -// +build !windows - -package archive - -import ( - "archive/tar" - "os" - "sync" - "syscall" - - "github.com/containerd/continuity/sysx" - "github.com/opencontainers/runc/libcontainer/system" - "github.com/pkg/errors" -) - -func tarName(p string) (string, error) { - return p, nil -} - -func chmodTarEntry(perm os.FileMode) os.FileMode { - return perm -} - -func setHeaderForSpecialDevice(hdr *tar.Header, name string, fi os.FileInfo) error { - s, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return errors.New("unsupported stat type") - } - - // Currently go does not fill in the major/minors - if s.Mode&syscall.S_IFBLK != 0 || - s.Mode&syscall.S_IFCHR != 0 { - hdr.Devmajor = int64(major(uint64(s.Rdev))) - hdr.Devminor = int64(minor(uint64(s.Rdev))) - } - - return nil -} - -func major(device uint64) uint64 { - return (device >> 8) & 0xfff -} - -func minor(device uint64) uint64 { - return (device & 0xff) | ((device >> 12) & 0xfff00) -} - -func mkdev(major int64, minor int64) uint32 { - return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff)) -} - -func open(p string) (*os.File, error) { - return os.Open(p) -} - -func openFile(name string, flag int, perm os.FileMode) (*os.File, error) { - return os.OpenFile(name, flag, perm) -} - -func mkdirAll(path string, perm os.FileMode) error { - return os.MkdirAll(path, perm) -} - -func prepareApply() func() { - // Unset unmask before doing an apply operation, - // restore unmask when complete - oldmask := syscall.Umask(0) - return func() { - syscall.Umask(oldmask) - } -} - -func skipFile(*tar.Header) bool { - return false -} - -var ( - inUserNS bool - nsOnce sync.Once -) - -func setInUserNS() { - inUserNS = system.RunningInUserNS() -} - -// handleTarTypeBlockCharFifo is an OS-specific helper function used by -// createTarFile to handle the following types of header: Block; Char; Fifo -func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { - nsOnce.Do(setInUserNS) - if inUserNS { - // cannot create a device if running in user namespace - return nil - } - - mode := uint32(hdr.Mode & 07777) - switch hdr.Typeflag { - case tar.TypeBlock: - mode |= syscall.S_IFBLK - case tar.TypeChar: - mode |= syscall.S_IFCHR - case tar.TypeFifo: - mode |= syscall.S_IFIFO - } - - return syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor))) -} - -func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { - if hdr.Typeflag == tar.TypeLink { - if fi, err := os.Lstat(hdr.Linkname); err == nil && (fi.Mode()&os.ModeSymlink == 0) { - if err := os.Chmod(path, hdrInfo.Mode()); err != nil { - return err - } - } - } else if hdr.Typeflag != tar.TypeSymlink { - if err := os.Chmod(path, hdrInfo.Mode()); err != nil { - return err - } - } - return nil -} - -func getxattr(path, attr string) ([]byte, error) { - b, err := sysx.LGetxattr(path, attr) - if err == syscall.ENOTSUP || err == sysx.ENODATA { - return nil, nil - } - return b, err -} - -func setxattr(path, key, value string) error { - return sysx.LSetxattr(path, key, []byte(value), 0) -} diff --git a/vendor/github.com/containerd/containerd/archive/tar_windows.go b/vendor/github.com/containerd/containerd/archive/tar_windows.go deleted file mode 100644 index fda7750803..0000000000 --- a/vendor/github.com/containerd/containerd/archive/tar_windows.go +++ /dev/null @@ -1,104 +0,0 @@ -package archive - -import ( - "archive/tar" - "errors" - "fmt" - "os" - "strings" - - "github.com/containerd/containerd/sys" -) - -// tarName returns platform-specific filepath -// to canonical posix-style path for tar archival. p is relative -// path. -func tarName(p string) (string, error) { - // windows: convert windows style relative path with backslashes - // into forward slashes. Since windows does not allow '/' or '\' - // in file names, it is mostly safe to replace however we must - // check just in case - if strings.Contains(p, "/") { - return "", fmt.Errorf("Windows path contains forward slash: %s", p) - } - - return strings.Replace(p, string(os.PathSeparator), "/", -1), nil -} - -// chmodTarEntry is used to adjust the file permissions used in tar header based -// on the platform the archival is done. -func chmodTarEntry(perm os.FileMode) os.FileMode { - perm &= 0755 - // Add the x bit: make everything +x from windows - perm |= 0111 - - return perm -} - -func setHeaderForSpecialDevice(*tar.Header, string, os.FileInfo) error { - // do nothing. no notion of Rdev, Inode, Nlink in stat on Windows - return nil -} - -func open(p string) (*os.File, error) { - // We use sys.OpenSequential to ensure we use sequential file - // access on Windows to avoid depleting the standby list. - return sys.OpenSequential(p) -} - -func openFile(name string, flag int, perm os.FileMode) (*os.File, error) { - // Source is regular file. We use sys.OpenFileSequential to use sequential - // file access to avoid depleting the standby list on Windows. - return sys.OpenFileSequential(name, flag, perm) -} - -func mkdirAll(path string, perm os.FileMode) error { - return sys.MkdirAll(path, perm) -} - -func prepareApply() func() { - // No umask or filesystem changes needed before apply - return func() {} -} - -func skipFile(hdr *tar.Header) bool { - // Windows does not support filenames with colons in them. Ignore - // these files. This is not a problem though (although it might - // appear that it is). Let's suppose a client is running docker pull. - // The daemon it points to is Windows. Would it make sense for the - // client to be doing a docker pull Ubuntu for example (which has files - // with colons in the name under /usr/share/man/man3)? No, absolutely - // not as it would really only make sense that they were pulling a - // Windows image. However, for development, it is necessary to be able - // to pull Linux images which are in the repository. - // - // TODO Windows. Once the registry is aware of what images are Windows- - // specific or Linux-specific, this warning should be changed to an error - // to cater for the situation where someone does manage to upload a Linux - // image but have it tagged as Windows inadvertently. - if strings.Contains(hdr.Name, ":") { - return true - } - - return false -} - -// handleTarTypeBlockCharFifo is an OS-specific helper function used by -// createTarFile to handle the following types of header: Block; Char; Fifo -func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error { - return nil -} - -func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error { - return nil -} - -func getxattr(path, attr string) ([]byte, error) { - return nil, nil -} - -func setxattr(path, key, value string) error { - // Return not support error, do not wrap underlying not supported - // since xattrs should not exist in windows diff archives - return errors.New("xattrs not supported on Windows") -} diff --git a/vendor/github.com/containerd/containerd/archive/time.go b/vendor/github.com/containerd/containerd/archive/time.go deleted file mode 100644 index 4e9ae95084..0000000000 --- a/vendor/github.com/containerd/containerd/archive/time.go +++ /dev/null @@ -1,38 +0,0 @@ -package archive - -import ( - "syscall" - "time" - "unsafe" -) - -var ( - minTime = time.Unix(0, 0) - maxTime time.Time -) - -func init() { - if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 { - // This is a 64 bit timespec - // os.Chtimes limits time to the following - maxTime = time.Unix(0, 1<<63-1) - } else { - // This is a 32 bit timespec - maxTime = time.Unix(1<<31-1, 0) - } -} - -func boundTime(t time.Time) time.Time { - if t.Before(minTime) || t.After(maxTime) { - return minTime - } - - return t -} - -func latestTime(t1, t2 time.Time) time.Time { - if t1.Before(t2) { - return t2 - } - return t1 -} diff --git a/vendor/github.com/containerd/containerd/archive/time_darwin.go b/vendor/github.com/containerd/containerd/archive/time_darwin.go deleted file mode 100644 index 2ac517a91c..0000000000 --- a/vendor/github.com/containerd/containerd/archive/time_darwin.go +++ /dev/null @@ -1,14 +0,0 @@ -package archive - -import ( - "time" - - "github.com/pkg/errors" -) - -// as at MacOS 10.12 there is apparently no way to set timestamps -// with nanosecond precision. We could fall back to utimes/lutimes -// and lose the precision as a temporary workaround. -func chtimes(path string, atime, mtime time.Time) error { - return errors.New("OSX missing UtimesNanoAt") -} diff --git a/vendor/github.com/containerd/containerd/archive/time_unix.go b/vendor/github.com/containerd/containerd/archive/time_unix.go deleted file mode 100644 index 5f17084f28..0000000000 --- a/vendor/github.com/containerd/containerd/archive/time_unix.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build linux freebsd - -package archive - -import ( - "time" - - "golang.org/x/sys/unix" - - "github.com/pkg/errors" -) - -func chtimes(path string, atime, mtime time.Time) error { - var utimes [2]unix.Timespec - utimes[0] = unix.NsecToTimespec(atime.UnixNano()) - utimes[1] = unix.NsecToTimespec(mtime.UnixNano()) - - if err := unix.UtimesNanoAt(unix.AT_FDCWD, path, utimes[0:], unix.AT_SYMLINK_NOFOLLOW); err != nil { - return errors.Wrap(err, "failed call to UtimesNanoAt") - } - - return nil -} diff --git a/vendor/github.com/containerd/containerd/archive/time_windows.go b/vendor/github.com/containerd/containerd/archive/time_windows.go deleted file mode 100644 index a17f6acb08..0000000000 --- a/vendor/github.com/containerd/containerd/archive/time_windows.go +++ /dev/null @@ -1,25 +0,0 @@ -package archive - -import ( - "syscall" - "time" -) - -// chtimes will set the create time on a file using the given modtime. -// This requires calling SetFileTime and explicitly including the create time. -func chtimes(path string, atime, mtime time.Time) error { - ctimespec := syscall.NsecToTimespec(mtime.UnixNano()) - pathp, e := syscall.UTF16PtrFromString(path) - if e != nil { - return e - } - h, e := syscall.CreateFile(pathp, - syscall.FILE_WRITE_ATTRIBUTES, syscall.FILE_SHARE_WRITE, nil, - syscall.OPEN_EXISTING, syscall.FILE_FLAG_BACKUP_SEMANTICS, 0) - if e != nil { - return e - } - defer syscall.Close(h) - c := syscall.NsecToFiletime(syscall.TimespecToNsec(ctimespec)) - return syscall.SetFileTime(h, &c, nil, nil) -} diff --git a/vendor/github.com/containerd/containerd/fs/copy.go b/vendor/github.com/containerd/containerd/fs/copy.go deleted file mode 100644 index 0d11fa527d..0000000000 --- a/vendor/github.com/containerd/containerd/fs/copy.go +++ /dev/null @@ -1,120 +0,0 @@ -package fs - -import ( - "io/ioutil" - "os" - "path/filepath" - "sync" - - "github.com/pkg/errors" -) - -var ( - bufferPool = &sync.Pool{ - New: func() interface{} { - return make([]byte, 32*1024) - }, - } -) - -// CopyDir copies the directory from src to dst. -// Most efficient copy of files is attempted. -func CopyDir(dst, src string) error { - inodes := map[uint64]string{} - return copyDirectory(dst, src, inodes) -} - -func copyDirectory(dst, src string, inodes map[uint64]string) error { - stat, err := os.Stat(src) - if err != nil { - return errors.Wrapf(err, "failed to stat %s", src) - } - if !stat.IsDir() { - return errors.Errorf("source is not directory") - } - - if st, err := os.Stat(dst); err != nil { - if err := os.Mkdir(dst, stat.Mode()); err != nil { - return errors.Wrapf(err, "failed to mkdir %s", dst) - } - } else if !st.IsDir() { - return errors.Errorf("cannot copy to non-directory: %s", dst) - } else { - if err := os.Chmod(dst, stat.Mode()); err != nil { - return errors.Wrapf(err, "failed to chmod on %s", dst) - } - } - - fis, err := ioutil.ReadDir(src) - if err != nil { - return errors.Wrapf(err, "failed to read %s", src) - } - - if err := copyFileInfo(stat, dst); err != nil { - return errors.Wrapf(err, "failed to copy file info for %s", dst) - } - - for _, fi := range fis { - source := filepath.Join(src, fi.Name()) - target := filepath.Join(dst, fi.Name()) - - switch { - case fi.IsDir(): - if err := copyDirectory(target, source, inodes); err != nil { - return err - } - continue - case (fi.Mode() & os.ModeType) == 0: - link, err := getLinkSource(target, fi, inodes) - if err != nil { - return errors.Wrap(err, "failed to get hardlink") - } - if link != "" { - if err := os.Link(link, target); err != nil { - return errors.Wrap(err, "failed to create hard link") - } - } else if err := copyFile(source, target); err != nil { - return errors.Wrap(err, "failed to copy files") - } - case (fi.Mode() & os.ModeSymlink) == os.ModeSymlink: - link, err := os.Readlink(source) - if err != nil { - return errors.Wrapf(err, "failed to read link: %s", source) - } - if err := os.Symlink(link, target); err != nil { - return errors.Wrapf(err, "failed to create symlink: %s", target) - } - case (fi.Mode() & os.ModeDevice) == os.ModeDevice: - if err := copyDevice(target, fi); err != nil { - return errors.Wrapf(err, "failed to create device") - } - default: - // TODO: Support pipes and sockets - return errors.Wrapf(err, "unsupported mode %s", fi.Mode()) - } - if err := copyFileInfo(fi, target); err != nil { - return errors.Wrap(err, "failed to copy file info") - } - - if err := copyXAttrs(target, source); err != nil { - return errors.Wrap(err, "failed to copy xattrs") - } - } - - return nil -} - -func copyFile(source, target string) error { - src, err := os.Open(source) - if err != nil { - return errors.Wrapf(err, "failed to open source %s", source) - } - defer src.Close() - tgt, err := os.Create(target) - if err != nil { - return errors.Wrapf(err, "failed to open target %s", target) - } - defer tgt.Close() - - return copyFileContent(tgt, src) -} diff --git a/vendor/github.com/containerd/containerd/fs/copy_linux.go b/vendor/github.com/containerd/containerd/fs/copy_linux.go deleted file mode 100644 index efa9248619..0000000000 --- a/vendor/github.com/containerd/containerd/fs/copy_linux.go +++ /dev/null @@ -1,82 +0,0 @@ -package fs - -import ( - "io" - "os" - "syscall" - - "github.com/containerd/continuity/sysx" - "github.com/pkg/errors" - "golang.org/x/sys/unix" -) - -func copyFileInfo(fi os.FileInfo, name string) error { - st := fi.Sys().(*syscall.Stat_t) - if err := os.Lchown(name, int(st.Uid), int(st.Gid)); err != nil { - return errors.Wrapf(err, "failed to chown %s", name) - } - - if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { - if err := os.Chmod(name, fi.Mode()); err != nil { - return errors.Wrapf(err, "failed to chmod %s", name) - } - } - - timespec := []unix.Timespec{unix.Timespec(st.Atim), unix.Timespec(st.Mtim)} - if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil { - return errors.Wrapf(err, "failed to utime %s", name) - } - - return nil -} - -func copyFileContent(dst, src *os.File) error { - st, err := src.Stat() - if err != nil { - return errors.Wrap(err, "unable to stat source") - } - - n, err := sysx.CopyFileRange(src.Fd(), nil, dst.Fd(), nil, int(st.Size()), 0) - if err != nil { - if err != syscall.ENOSYS && err != syscall.EXDEV { - return errors.Wrap(err, "copy file range failed") - } - - buf := bufferPool.Get().([]byte) - _, err = io.CopyBuffer(dst, src, buf) - bufferPool.Put(buf) - return err - } - - if int64(n) != st.Size() { - return errors.Wrapf(err, "short copy: %d of %d", int64(n), st.Size()) - } - - return nil -} - -func copyXAttrs(dst, src string) error { - xattrKeys, err := sysx.LListxattr(src) - if err != nil { - return errors.Wrapf(err, "failed to list xattrs on %s", src) - } - for _, xattr := range xattrKeys { - data, err := sysx.LGetxattr(src, xattr) - if err != nil { - return errors.Wrapf(err, "failed to get xattr %q on %s", xattr, src) - } - if err := sysx.LSetxattr(dst, xattr, data, 0); err != nil { - return errors.Wrapf(err, "failed to set xattr %q on %s", xattr, dst) - } - } - - return nil -} - -func copyDevice(dst string, fi os.FileInfo) error { - st, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return errors.New("unsupported stat type") - } - return syscall.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) -} diff --git a/vendor/github.com/containerd/containerd/fs/copy_unix.go b/vendor/github.com/containerd/containerd/fs/copy_unix.go deleted file mode 100644 index 4a6cce49d7..0000000000 --- a/vendor/github.com/containerd/containerd/fs/copy_unix.go +++ /dev/null @@ -1,65 +0,0 @@ -// +build darwin freebsd - -package fs - -import ( - "io" - "os" - "syscall" - - "github.com/containerd/continuity/sysx" - "github.com/pkg/errors" -) - -func copyFileInfo(fi os.FileInfo, name string) error { - st := fi.Sys().(*syscall.Stat_t) - if err := os.Lchown(name, int(st.Uid), int(st.Gid)); err != nil { - return errors.Wrapf(err, "failed to chown %s", name) - } - - if (fi.Mode() & os.ModeSymlink) != os.ModeSymlink { - if err := os.Chmod(name, fi.Mode()); err != nil { - return errors.Wrapf(err, "failed to chmod %s", name) - } - } - - if err := syscall.UtimesNano(name, []syscall.Timespec{st.Atimespec, st.Mtimespec}); err != nil { - return errors.Wrapf(err, "failed to utime %s", name) - } - - return nil -} - -func copyFileContent(dst, src *os.File) error { - buf := bufferPool.Get().([]byte) - _, err := io.CopyBuffer(dst, src, buf) - bufferPool.Put(buf) - - return err -} - -func copyXAttrs(dst, src string) error { - xattrKeys, err := sysx.LListxattr(src) - if err != nil { - return errors.Wrapf(err, "failed to list xattrs on %s", src) - } - for _, xattr := range xattrKeys { - data, err := sysx.LGetxattr(src, xattr) - if err != nil { - return errors.Wrapf(err, "failed to get xattr %q on %s", xattr, src) - } - if err := sysx.LSetxattr(dst, xattr, data, 0); err != nil { - return errors.Wrapf(err, "failed to set xattr %q on %s", xattr, dst) - } - } - - return nil -} - -func copyDevice(dst string, fi os.FileInfo) error { - st, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return errors.New("unsupported stat type") - } - return syscall.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) -} diff --git a/vendor/github.com/containerd/containerd/fs/copy_windows.go b/vendor/github.com/containerd/containerd/fs/copy_windows.go deleted file mode 100644 index fb4933c252..0000000000 --- a/vendor/github.com/containerd/containerd/fs/copy_windows.go +++ /dev/null @@ -1,33 +0,0 @@ -package fs - -import ( - "io" - "os" - - "github.com/pkg/errors" -) - -func copyFileInfo(fi os.FileInfo, name string) error { - if err := os.Chmod(name, fi.Mode()); err != nil { - return errors.Wrapf(err, "failed to chmod %s", name) - } - - // TODO: copy windows specific metadata - - return nil -} - -func copyFileContent(dst, src *os.File) error { - buf := bufferPool.Get().([]byte) - _, err := io.CopyBuffer(dst, src, buf) - bufferPool.Put(buf) - return err -} - -func copyXAttrs(dst, src string) error { - return nil -} - -func copyDevice(dst string, fi os.FileInfo) error { - return errors.New("device copy not supported") -} diff --git a/vendor/github.com/containerd/containerd/fs/diff.go b/vendor/github.com/containerd/containerd/fs/diff.go deleted file mode 100644 index 5fed7cf2d0..0000000000 --- a/vendor/github.com/containerd/containerd/fs/diff.go +++ /dev/null @@ -1,310 +0,0 @@ -package fs - -import ( - "context" - "os" - "path/filepath" - "strings" - - "golang.org/x/sync/errgroup" - - "github.com/Sirupsen/logrus" -) - -// ChangeKind is the type of modification that -// a change is making. -type ChangeKind int - -const ( - // ChangeKindUnmodified represents an unmodified - // file - ChangeKindUnmodified = iota - - // ChangeKindAdd represents an addition of - // a file - ChangeKindAdd - - // ChangeKindModify represents a change to - // an existing file - ChangeKindModify - - // ChangeKindDelete represents a delete of - // a file - ChangeKindDelete -) - -func (k ChangeKind) String() string { - switch k { - case ChangeKindUnmodified: - return "unmodified" - case ChangeKindAdd: - return "add" - case ChangeKindModify: - return "modify" - case ChangeKindDelete: - return "delete" - default: - return "" - } -} - -// Change represents single change between a diff and its parent. -type Change struct { - Kind ChangeKind - Path string -} - -// ChangeFunc is the type of function called for each change -// computed during a directory changes calculation. -type ChangeFunc func(ChangeKind, string, os.FileInfo, error) error - -// Changes computes changes between two directories calling the -// given change function for each computed change. The first -// directory is intended to the base directory and second -// directory the changed directory. -// -// The change callback is called by the order of path names and -// should be appliable in that order. -// Due to this apply ordering, the following is true -// - Removed directory trees only create a single change for the root -// directory removed. Remaining changes are implied. -// - A directory which is modified to become a file will not have -// delete entries for sub-path items, their removal is implied -// by the removal of the parent directory. -// -// Opaque directories will not be treated specially and each file -// removed from the base directory will show up as a removal. -// -// File content comparisons will be done on files which have timestamps -// which may have been truncated. If either of the files being compared -// has a zero value nanosecond value, each byte will be compared for -// differences. If 2 files have the same seconds value but different -// nanosecond values where one of those values is zero, the files will -// be considered unchanged if the content is the same. This behavior -// is to account for timestamp truncation during archiving. -func Changes(ctx context.Context, a, b string, changeFn ChangeFunc) error { - if a == "" { - logrus.Debugf("Using single walk diff for %s", b) - return addDirChanges(ctx, changeFn, b) - } else if diffOptions := detectDirDiff(b, a); diffOptions != nil { - logrus.Debugf("Using single walk diff for %s from %s", diffOptions.diffDir, a) - return diffDirChanges(ctx, changeFn, a, diffOptions) - } - - logrus.Debugf("Using double walk diff for %s from %s", b, a) - return doubleWalkDiff(ctx, changeFn, a, b) -} - -func addDirChanges(ctx context.Context, changeFn ChangeFunc, root string) error { - return filepath.Walk(root, func(path string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - // Rebase path - path, err = filepath.Rel(root, path) - if err != nil { - return err - } - - path = filepath.Join(string(os.PathSeparator), path) - - // Skip root - if path == string(os.PathSeparator) { - return nil - } - - return changeFn(ChangeKindAdd, path, f, nil) - }) -} - -// diffDirOptions is used when the diff can be directly calculated from -// a diff directory to its base, without walking both trees. -type diffDirOptions struct { - diffDir string - skipChange func(string) (bool, error) - deleteChange func(string, string, os.FileInfo) (string, error) -} - -// diffDirChanges walks the diff directory and compares changes against the base. -func diffDirChanges(ctx context.Context, changeFn ChangeFunc, base string, o *diffDirOptions) error { - changedDirs := make(map[string]struct{}) - return filepath.Walk(o.diffDir, func(path string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - // Rebase path - path, err = filepath.Rel(o.diffDir, path) - if err != nil { - return err - } - - path = filepath.Join(string(os.PathSeparator), path) - - // Skip root - if path == string(os.PathSeparator) { - return nil - } - - // TODO: handle opaqueness, start new double walker at this - // location to get deletes, and skip tree in single walker - - if o.skipChange != nil { - if skip, err := o.skipChange(path); skip { - return err - } - } - - var kind ChangeKind - - deletedFile, err := o.deleteChange(o.diffDir, path, f) - if err != nil { - return err - } - - // Find out what kind of modification happened - if deletedFile != "" { - path = deletedFile - kind = ChangeKindDelete - f = nil - } else { - // Otherwise, the file was added - kind = ChangeKindAdd - - // ...Unless it already existed in a base, in which case, it's a modification - stat, err := os.Stat(filepath.Join(base, path)) - if err != nil && !os.IsNotExist(err) { - return err - } - if err == nil { - // The file existed in the base, so that's a modification - - // However, if it's a directory, maybe it wasn't actually modified. - // If you modify /foo/bar/baz, then /foo will be part of the changed files only because it's the parent of bar - if stat.IsDir() && f.IsDir() { - if f.Size() == stat.Size() && f.Mode() == stat.Mode() && sameFsTime(f.ModTime(), stat.ModTime()) { - // Both directories are the same, don't record the change - return nil - } - } - kind = ChangeKindModify - } - } - - // If /foo/bar/file.txt is modified, then /foo/bar must be part of the changed files. - // This block is here to ensure the change is recorded even if the - // modify time, mode and size of the parent directory in the rw and ro layers are all equal. - // Check https://github.com/docker/docker/pull/13590 for details. - if f.IsDir() { - changedDirs[path] = struct{}{} - } - if kind == ChangeKindAdd || kind == ChangeKindDelete { - parent := filepath.Dir(path) - if _, ok := changedDirs[parent]; !ok && parent != "/" { - pi, err := os.Stat(filepath.Join(o.diffDir, parent)) - if err := changeFn(ChangeKindModify, parent, pi, err); err != nil { - return err - } - changedDirs[parent] = struct{}{} - } - } - - return changeFn(kind, path, f, nil) - }) -} - -// doubleWalkDiff walks both directories to create a diff -func doubleWalkDiff(ctx context.Context, changeFn ChangeFunc, a, b string) (err error) { - g, ctx := errgroup.WithContext(ctx) - - var ( - c1 = make(chan *currentPath) - c2 = make(chan *currentPath) - - f1, f2 *currentPath - rmdir string - ) - g.Go(func() error { - defer close(c1) - return pathWalk(ctx, a, c1) - }) - g.Go(func() error { - defer close(c2) - return pathWalk(ctx, b, c2) - }) - g.Go(func() error { - for c1 != nil || c2 != nil { - if f1 == nil && c1 != nil { - f1, err = nextPath(ctx, c1) - if err != nil { - return err - } - if f1 == nil { - c1 = nil - } - } - - if f2 == nil && c2 != nil { - f2, err = nextPath(ctx, c2) - if err != nil { - return err - } - if f2 == nil { - c2 = nil - } - } - if f1 == nil && f2 == nil { - continue - } - - var f os.FileInfo - k, p := pathChange(f1, f2) - switch k { - case ChangeKindAdd: - if rmdir != "" { - rmdir = "" - } - f = f2.f - f2 = nil - case ChangeKindDelete: - // Check if this file is already removed by being - // under of a removed directory - if rmdir != "" && strings.HasPrefix(f1.path, rmdir) { - f1 = nil - continue - } else if rmdir == "" && f1.f.IsDir() { - rmdir = f1.path + string(os.PathSeparator) - } else if rmdir != "" { - rmdir = "" - } - f1 = nil - case ChangeKindModify: - same, err := sameFile(f1, f2) - if err != nil { - return err - } - if f1.f.IsDir() && !f2.f.IsDir() { - rmdir = f1.path + string(os.PathSeparator) - } else if rmdir != "" { - rmdir = "" - } - f = f2.f - f1 = nil - f2 = nil - if same { - if !isLinked(f) { - continue - } - k = ChangeKindUnmodified - } - } - if err := changeFn(k, p, f, nil); err != nil { - return err - } - } - return nil - }) - - return g.Wait() -} diff --git a/vendor/github.com/containerd/containerd/fs/diff_unix.go b/vendor/github.com/containerd/containerd/fs/diff_unix.go deleted file mode 100644 index 36a0f3fde7..0000000000 --- a/vendor/github.com/containerd/containerd/fs/diff_unix.go +++ /dev/null @@ -1,102 +0,0 @@ -// +build !windows - -package fs - -import ( - "bytes" - "os" - "path/filepath" - "strings" - "syscall" - - "github.com/containerd/continuity/sysx" - "github.com/pkg/errors" -) - -// whiteouts are files with a special meaning for the layered filesystem. -// Docker uses AUFS whiteout files inside exported archives. In other -// filesystems these files are generated/handled on tar creation/extraction. - -// whiteoutPrefix prefix means file is a whiteout. If this is followed by a -// filename this means that file has been removed from the base layer. -const whiteoutPrefix = ".wh." - -// whiteoutMetaPrefix prefix means whiteout has a special meaning and is not -// for removing an actual file. Normally these files are excluded from exported -// archives. -const whiteoutMetaPrefix = whiteoutPrefix + whiteoutPrefix - -// whiteoutLinkDir is a directory AUFS uses for storing hardlink links to other -// layers. Normally these should not go into exported archives and all changed -// hardlinks should be copied to the top layer. -const whiteoutLinkDir = whiteoutMetaPrefix + "plnk" - -// whiteoutOpaqueDir file means directory has been made opaque - meaning -// readdir calls to this directory do not follow to lower layers. -const whiteoutOpaqueDir = whiteoutMetaPrefix + ".opq" - -// detectDirDiff returns diff dir options if a directory could -// be found in the mount info for upper which is the direct -// diff with the provided lower directory -func detectDirDiff(upper, lower string) *diffDirOptions { - // TODO: get mount options for upper - // TODO: detect AUFS - // TODO: detect overlay - return nil -} - -func aufsMetadataSkip(path string) (skip bool, err error) { - skip, err = filepath.Match(string(os.PathSeparator)+whiteoutMetaPrefix+"*", path) - if err != nil { - skip = true - } - return -} - -func aufsDeletedFile(root, path string, fi os.FileInfo) (string, error) { - f := filepath.Base(path) - - // If there is a whiteout, then the file was removed - if strings.HasPrefix(f, whiteoutPrefix) { - originalFile := f[len(whiteoutPrefix):] - return filepath.Join(filepath.Dir(path), originalFile), nil - } - - return "", nil -} - -// compareSysStat returns whether the stats are equivalent, -// whether the files are considered the same file, and -// an error -func compareSysStat(s1, s2 interface{}) (bool, error) { - ls1, ok := s1.(*syscall.Stat_t) - if !ok { - return false, nil - } - ls2, ok := s2.(*syscall.Stat_t) - if !ok { - return false, nil - } - - return ls1.Mode == ls2.Mode && ls1.Uid == ls2.Uid && ls1.Gid == ls2.Gid && ls1.Rdev == ls2.Rdev, nil -} - -func compareCapabilities(p1, p2 string) (bool, error) { - c1, err := sysx.LGetxattr(p1, "security.capability") - if err != nil && err != sysx.ENODATA { - return false, errors.Wrapf(err, "failed to get xattr for %s", p1) - } - c2, err := sysx.LGetxattr(p2, "security.capability") - if err != nil && err != sysx.ENODATA { - return false, errors.Wrapf(err, "failed to get xattr for %s", p2) - } - return bytes.Equal(c1, c2), nil -} - -func isLinked(f os.FileInfo) bool { - s, ok := f.Sys().(*syscall.Stat_t) - if !ok { - return false - } - return !f.IsDir() && s.Nlink > 1 -} diff --git a/vendor/github.com/containerd/containerd/fs/diff_windows.go b/vendor/github.com/containerd/containerd/fs/diff_windows.go deleted file mode 100644 index 7bbd662849..0000000000 --- a/vendor/github.com/containerd/containerd/fs/diff_windows.go +++ /dev/null @@ -1,21 +0,0 @@ -package fs - -import "os" - -func detectDirDiff(upper, lower string) *diffDirOptions { - return nil -} - -func compareSysStat(s1, s2 interface{}) (bool, error) { - // TODO: Use windows specific sys type - return false, nil -} - -func compareCapabilities(p1, p2 string) (bool, error) { - // TODO: Use windows equivalent - return true, nil -} - -func isLinked(os.FileInfo) bool { - return false -} diff --git a/vendor/github.com/containerd/containerd/fs/dtype_linux.go b/vendor/github.com/containerd/containerd/fs/dtype_linux.go deleted file mode 100644 index cc06573f1b..0000000000 --- a/vendor/github.com/containerd/containerd/fs/dtype_linux.go +++ /dev/null @@ -1,87 +0,0 @@ -// +build linux - -package fs - -import ( - "fmt" - "io/ioutil" - "os" - "syscall" - "unsafe" -) - -func locateDummyIfEmpty(path string) (string, error) { - children, err := ioutil.ReadDir(path) - if err != nil { - return "", err - } - if len(children) != 0 { - return "", nil - } - dummyFile, err := ioutil.TempFile(path, "fsutils-dummy") - if err != nil { - return "", err - } - name := dummyFile.Name() - err = dummyFile.Close() - return name, err -} - -// SupportsDType returns whether the filesystem mounted on path supports d_type -func SupportsDType(path string) (bool, error) { - // locate dummy so that we have at least one dirent - dummy, err := locateDummyIfEmpty(path) - if err != nil { - return false, err - } - if dummy != "" { - defer os.Remove(dummy) - } - - visited := 0 - supportsDType := true - fn := func(ent *syscall.Dirent) bool { - visited++ - if ent.Type == syscall.DT_UNKNOWN { - supportsDType = false - // stop iteration - return true - } - // continue iteration - return false - } - if err = iterateReadDir(path, fn); err != nil { - return false, err - } - if visited == 0 { - return false, fmt.Errorf("did not hit any dirent during iteration %s", path) - } - return supportsDType, nil -} - -func iterateReadDir(path string, fn func(*syscall.Dirent) bool) error { - d, err := os.Open(path) - if err != nil { - return err - } - defer d.Close() - fd := int(d.Fd()) - buf := make([]byte, 4096) - for { - nbytes, err := syscall.ReadDirent(fd, buf) - if err != nil { - return err - } - if nbytes == 0 { - break - } - for off := 0; off < nbytes; { - ent := (*syscall.Dirent)(unsafe.Pointer(&buf[off])) - if stop := fn(ent); stop { - return nil - } - off += int(ent.Reclen) - } - } - return nil -} diff --git a/vendor/github.com/containerd/containerd/fs/du.go b/vendor/github.com/containerd/containerd/fs/du.go deleted file mode 100644 index 8dfdaebdae..0000000000 --- a/vendor/github.com/containerd/containerd/fs/du.go +++ /dev/null @@ -1,12 +0,0 @@ -package fs - -type Usage struct { - Inodes int64 - Size int64 -} - -// DiskUsage counts the number of inodes and disk usage for the resources under -// path. -func DiskUsage(roots ...string) (Usage, error) { - return diskUsage(roots...) -} diff --git a/vendor/github.com/containerd/containerd/fs/du_unix.go b/vendor/github.com/containerd/containerd/fs/du_unix.go deleted file mode 100644 index 3d0af20e66..0000000000 --- a/vendor/github.com/containerd/containerd/fs/du_unix.go +++ /dev/null @@ -1,42 +0,0 @@ -// +build !windows - -package fs - -import ( - "os" - "path/filepath" - "syscall" -) - -func diskUsage(roots ...string) (Usage, error) { - type inode struct { - // TODO(stevvooe): Can probably reduce memory usage by not tracking - // device, but we can leave this right for now. - dev, ino uint64 - } - - var ( - size int64 - inodes = map[inode]struct{}{} // expensive! - ) - - for _, root := range roots { - if err := filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - - stat := fi.Sys().(*syscall.Stat_t) - inodes[inode{dev: uint64(stat.Dev), ino: uint64(stat.Ino)}] = struct{}{} - size += fi.Size() - return nil - }); err != nil { - return Usage{}, err - } - } - - return Usage{ - Inodes: int64(len(inodes)), - Size: size, - }, nil -} diff --git a/vendor/github.com/containerd/containerd/fs/du_windows.go b/vendor/github.com/containerd/containerd/fs/du_windows.go deleted file mode 100644 index 4a0363c06c..0000000000 --- a/vendor/github.com/containerd/containerd/fs/du_windows.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build windows - -package fs - -import ( - "os" - "path/filepath" -) - -func diskUsage(roots ...string) (Usage, error) { - var ( - size int64 - ) - - // TODO(stevvooe): Support inodes (or equivalent) for windows. - - for _, root := range roots { - if err := filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - - size += fi.Size() - return nil - }); err != nil { - return Usage{}, err - } - } - - return Usage{ - Size: size, - }, nil -} diff --git a/vendor/github.com/containerd/containerd/fs/hardlink.go b/vendor/github.com/containerd/containerd/fs/hardlink.go deleted file mode 100644 index 4d5156f400..0000000000 --- a/vendor/github.com/containerd/containerd/fs/hardlink.go +++ /dev/null @@ -1,27 +0,0 @@ -package fs - -import "os" - -// GetLinkID returns an identifier representing the node a hardlink is pointing -// to. If the file is not hard linked then 0 will be returned. -func GetLinkInfo(fi os.FileInfo) (uint64, bool) { - return getLinkInfo(fi) -} - -// getLinkSource returns a path for the given name and -// file info to its link source in the provided inode -// map. If the given file name is not in the map and -// has other links, it is added to the inode map -// to be a source for other link locations. -func getLinkSource(name string, fi os.FileInfo, inodes map[uint64]string) (string, error) { - inode, isHardlink := getLinkInfo(fi) - if !isHardlink { - return "", nil - } - - path, ok := inodes[inode] - if !ok { - inodes[inode] = name - } - return path, nil -} diff --git a/vendor/github.com/containerd/containerd/fs/hardlink_unix.go b/vendor/github.com/containerd/containerd/fs/hardlink_unix.go deleted file mode 100644 index 3b825c940b..0000000000 --- a/vendor/github.com/containerd/containerd/fs/hardlink_unix.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build !windows - -package fs - -import ( - "os" - "syscall" -) - -func getLinkInfo(fi os.FileInfo) (uint64, bool) { - s, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return 0, false - } - - return uint64(s.Ino), !fi.IsDir() && s.Nlink > 1 -} diff --git a/vendor/github.com/containerd/containerd/fs/hardlink_windows.go b/vendor/github.com/containerd/containerd/fs/hardlink_windows.go deleted file mode 100644 index ad8845a7fb..0000000000 --- a/vendor/github.com/containerd/containerd/fs/hardlink_windows.go +++ /dev/null @@ -1,7 +0,0 @@ -package fs - -import "os" - -func getLinkInfo(fi os.FileInfo) (uint64, bool) { - return 0, false -} diff --git a/vendor/github.com/containerd/containerd/fs/path.go b/vendor/github.com/containerd/containerd/fs/path.go deleted file mode 100644 index a46d0fcbde..0000000000 --- a/vendor/github.com/containerd/containerd/fs/path.go +++ /dev/null @@ -1,162 +0,0 @@ -package fs - -import ( - "bytes" - "context" - "io" - "os" - "path/filepath" - "strings" -) - -type currentPath struct { - path string - f os.FileInfo - fullPath string -} - -func pathChange(lower, upper *currentPath) (ChangeKind, string) { - if lower == nil { - if upper == nil { - panic("cannot compare nil paths") - } - return ChangeKindAdd, upper.path - } - if upper == nil { - return ChangeKindDelete, lower.path - } - // TODO: compare by directory - - switch i := strings.Compare(lower.path, upper.path); { - case i < 0: - // File in lower that is not in upper - return ChangeKindDelete, lower.path - case i > 0: - // File in upper that is not in lower - return ChangeKindAdd, upper.path - default: - return ChangeKindModify, upper.path - } -} - -func sameFile(f1, f2 *currentPath) (bool, error) { - if os.SameFile(f1.f, f2.f) { - return true, nil - } - - equalStat, err := compareSysStat(f1.f.Sys(), f2.f.Sys()) - if err != nil || !equalStat { - return equalStat, err - } - - if eq, err := compareCapabilities(f1.fullPath, f2.fullPath); err != nil || !eq { - return eq, err - } - - // If not a directory also check size, modtime, and content - if !f1.f.IsDir() { - if f1.f.Size() != f2.f.Size() { - return false, nil - } - t1 := f1.f.ModTime() - t2 := f2.f.ModTime() - - if t1.Unix() != t2.Unix() { - return false, nil - } - - // If the timestamp may have been truncated in one of the - // files, check content of file to determine difference - if t1.Nanosecond() == 0 || t2.Nanosecond() == 0 { - if f1.f.Size() > 0 { - eq, err := compareFileContent(f1.fullPath, f2.fullPath) - if err != nil || !eq { - return eq, err - } - } - } else if t1.Nanosecond() != t2.Nanosecond() { - return false, nil - } - } - - return true, nil -} - -const compareChuckSize = 32 * 1024 - -// compareFileContent compares the content of 2 same sized files -// by comparing each byte. -func compareFileContent(p1, p2 string) (bool, error) { - f1, err := os.Open(p1) - if err != nil { - return false, err - } - defer f1.Close() - f2, err := os.Open(p2) - if err != nil { - return false, err - } - defer f2.Close() - - b1 := make([]byte, compareChuckSize) - b2 := make([]byte, compareChuckSize) - for { - n1, err1 := f1.Read(b1) - if err1 != nil && err1 != io.EOF { - return false, err1 - } - n2, err2 := f2.Read(b2) - if err2 != nil && err2 != io.EOF { - return false, err2 - } - if n1 != n2 || !bytes.Equal(b1[:n1], b2[:n2]) { - return false, nil - } - if err1 == io.EOF && err2 == io.EOF { - return true, nil - } - } -} - -func pathWalk(ctx context.Context, root string, pathC chan<- *currentPath) error { - return filepath.Walk(root, func(path string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - // Rebase path - path, err = filepath.Rel(root, path) - if err != nil { - return err - } - - path = filepath.Join(string(os.PathSeparator), path) - - // Skip root - if path == string(os.PathSeparator) { - return nil - } - - p := ¤tPath{ - path: path, - f: f, - fullPath: filepath.Join(root, path), - } - - select { - case <-ctx.Done(): - return ctx.Err() - case pathC <- p: - return nil - } - }) -} - -func nextPath(ctx context.Context, pathC <-chan *currentPath) (*currentPath, error) { - select { - case <-ctx.Done(): - return nil, ctx.Err() - case p := <-pathC: - return p, nil - } -} diff --git a/vendor/github.com/containerd/containerd/fs/time.go b/vendor/github.com/containerd/containerd/fs/time.go deleted file mode 100644 index c336f4d881..0000000000 --- a/vendor/github.com/containerd/containerd/fs/time.go +++ /dev/null @@ -1,13 +0,0 @@ -package fs - -import "time" - -// Gnu tar and the go tar writer don't have sub-second mtime -// precision, which is problematic when we apply changes via tar -// files, we handle this by comparing for exact times, *or* same -// second count and either a or b having exactly 0 nanoseconds -func sameFsTime(a, b time.Time) bool { - return a == b || - (a.Unix() == b.Unix() && - (a.Nanosecond() == 0 || b.Nanosecond() == 0)) -} diff --git a/vendor/github.com/containerd/containerd/sys/epoll.go b/vendor/github.com/containerd/containerd/sys/epoll.go deleted file mode 100644 index 3a4d97cfa8..0000000000 --- a/vendor/github.com/containerd/containerd/sys/epoll.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build linux - -package sys - -import "golang.org/x/sys/unix" - -// EpollCreate1 directly calls unix.EpollCreate1 -func EpollCreate1(flag int) (int, error) { - return unix.EpollCreate1(flag) -} - -// EpollCtl directly calls unix.EpollCtl -func EpollCtl(epfd int, op int, fd int, event *unix.EpollEvent) error { - return unix.EpollCtl(epfd, op, fd, event) -} - -// EpollWait directly calls unix.EpollWait -func EpollWait(epfd int, events []unix.EpollEvent, msec int) (int, error) { - return unix.EpollWait(epfd, events, msec) -} diff --git a/vendor/github.com/containerd/containerd/sys/fds.go b/vendor/github.com/containerd/containerd/sys/fds.go deleted file mode 100644 index 3c1ec67e5a..0000000000 --- a/vendor/github.com/containerd/containerd/sys/fds.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build !windows,!darwin - -package sys - -import ( - "io/ioutil" - "path/filepath" - "strconv" -) - -// GetOpenFds returns the number of open fds for the process provided by pid -func GetOpenFds(pid int) (int, error) { - dirs, err := ioutil.ReadDir(filepath.Join("/proc", strconv.Itoa(pid), "fd")) - if err != nil { - return -1, err - } - return len(dirs), nil -} diff --git a/vendor/github.com/containerd/containerd/sys/filesys_windows.go b/vendor/github.com/containerd/containerd/sys/filesys_windows.go deleted file mode 100644 index b5ce13579d..0000000000 --- a/vendor/github.com/containerd/containerd/sys/filesys_windows.go +++ /dev/null @@ -1,236 +0,0 @@ -// +build windows - -package sys - -import ( - "os" - "path/filepath" - "regexp" - "strings" - "syscall" - "unsafe" - - winio "github.com/Microsoft/go-winio" -) - -// MkdirAllWithACL is a wrapper for MkdirAll that creates a directory -// ACL'd for Builtin Administrators and Local System. -func MkdirAllWithACL(path string, perm os.FileMode) error { - return mkdirall(path, true) -} - -// MkdirAll implementation that is volume path aware for Windows. -func MkdirAll(path string, _ os.FileMode) error { - return mkdirall(path, false) -} - -// mkdirall is a custom version of os.MkdirAll modified for use on Windows -// so that it is both volume path aware, and can create a directory with -// a DACL. -func mkdirall(path string, adminAndLocalSystem bool) error { - if re := regexp.MustCompile(`^\\\\\?\\Volume{[a-z0-9-]+}$`); re.MatchString(path) { - return nil - } - - // The rest of this method is largely copied from os.MkdirAll and should be kept - // as-is to ensure compatibility. - - // Fast path: if we can tell whether path is a directory or file, stop with success or error. - dir, err := os.Stat(path) - if err == nil { - if dir.IsDir() { - return nil - } - return &os.PathError{ - Op: "mkdir", - Path: path, - Err: syscall.ENOTDIR, - } - } - - // Slow path: make sure parent exists and then call Mkdir for path. - i := len(path) - for i > 0 && os.IsPathSeparator(path[i-1]) { // Skip trailing path separator. - i-- - } - - j := i - for j > 0 && !os.IsPathSeparator(path[j-1]) { // Scan backward over element. - j-- - } - - if j > 1 { - // Create parent - err = mkdirall(path[0:j-1], false) - if err != nil { - return err - } - } - - // Parent now exists; invoke os.Mkdir or mkdirWithACL and use its result. - if adminAndLocalSystem { - err = mkdirWithACL(path) - } else { - err = os.Mkdir(path, 0) - } - - if err != nil { - // Handle arguments like "foo/." by - // double-checking that directory doesn't exist. - dir, err1 := os.Lstat(path) - if err1 == nil && dir.IsDir() { - return nil - } - return err - } - return nil -} - -// mkdirWithACL creates a new directory. If there is an error, it will be of -// type *PathError. . -// -// This is a modified and combined version of os.Mkdir and syscall.Mkdir -// in golang to cater for creating a directory am ACL permitting full -// access, with inheritance, to any subfolder/file for Built-in Administrators -// and Local System. -func mkdirWithACL(name string) error { - sa := syscall.SecurityAttributes{Length: 0} - sddl := "D:P(A;OICI;GA;;;BA)(A;OICI;GA;;;SY)" - sd, err := winio.SddlToSecurityDescriptor(sddl) - if err != nil { - return &os.PathError{Op: "mkdir", Path: name, Err: err} - } - sa.Length = uint32(unsafe.Sizeof(sa)) - sa.InheritHandle = 1 - sa.SecurityDescriptor = uintptr(unsafe.Pointer(&sd[0])) - - namep, err := syscall.UTF16PtrFromString(name) - if err != nil { - return &os.PathError{Op: "mkdir", Path: name, Err: err} - } - - e := syscall.CreateDirectory(namep, &sa) - if e != nil { - return &os.PathError{Op: "mkdir", Path: name, Err: e} - } - return nil -} - -// IsAbs is a platform-specific wrapper for filepath.IsAbs. On Windows, -// golang filepath.IsAbs does not consider a path \windows\system32 as absolute -// as it doesn't start with a drive-letter/colon combination. However, in -// docker we need to verify things such as WORKDIR /windows/system32 in -// a Dockerfile (which gets translated to \windows\system32 when being processed -// by the daemon. This SHOULD be treated as absolute from a docker processing -// perspective. -func IsAbs(path string) bool { - if !filepath.IsAbs(path) { - if !strings.HasPrefix(path, string(os.PathSeparator)) { - return false - } - } - return true -} - -// The origin of the functions below here are the golang OS and syscall packages, -// slightly modified to only cope with files, not directories due to the -// specific use case. -// -// The alteration is to allow a file on Windows to be opened with -// FILE_FLAG_SEQUENTIAL_SCAN (particular for docker load), to avoid eating -// the standby list, particularly when accessing large files such as layer.tar. - -// CreateSequential creates the named file with mode 0666 (before umask), truncating -// it if it already exists. If successful, methods on the returned -// File can be used for I/O; the associated file descriptor has mode -// O_RDWR. -// If there is an error, it will be of type *PathError. -func CreateSequential(name string) (*os.File, error) { - return OpenFileSequential(name, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0) -} - -// OpenSequential opens the named file for reading. If successful, methods on -// the returned file can be used for reading; the associated file -// descriptor has mode O_RDONLY. -// If there is an error, it will be of type *PathError. -func OpenSequential(name string) (*os.File, error) { - return OpenFileSequential(name, os.O_RDONLY, 0) -} - -// OpenFileSequential is the generalized open call; most users will use Open -// or Create instead. -// If there is an error, it will be of type *PathError. -func OpenFileSequential(name string, flag int, _ os.FileMode) (*os.File, error) { - if name == "" { - return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOENT} - } - r, errf := syscallOpenFileSequential(name, flag, 0) - if errf == nil { - return r, nil - } - return nil, &os.PathError{Op: "open", Path: name, Err: errf} -} - -func syscallOpenFileSequential(name string, flag int, _ os.FileMode) (file *os.File, err error) { - r, e := syscallOpenSequential(name, flag|syscall.O_CLOEXEC, 0) - if e != nil { - return nil, e - } - return os.NewFile(uintptr(r), name), nil -} - -func makeInheritSa() *syscall.SecurityAttributes { - var sa syscall.SecurityAttributes - sa.Length = uint32(unsafe.Sizeof(sa)) - sa.InheritHandle = 1 - return &sa -} - -func syscallOpenSequential(path string, mode int, _ uint32) (fd syscall.Handle, err error) { - if len(path) == 0 { - return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND - } - pathp, err := syscall.UTF16PtrFromString(path) - if err != nil { - return syscall.InvalidHandle, err - } - var access uint32 - switch mode & (syscall.O_RDONLY | syscall.O_WRONLY | syscall.O_RDWR) { - case syscall.O_RDONLY: - access = syscall.GENERIC_READ - case syscall.O_WRONLY: - access = syscall.GENERIC_WRITE - case syscall.O_RDWR: - access = syscall.GENERIC_READ | syscall.GENERIC_WRITE - } - if mode&syscall.O_CREAT != 0 { - access |= syscall.GENERIC_WRITE - } - if mode&syscall.O_APPEND != 0 { - access &^= syscall.GENERIC_WRITE - access |= syscall.FILE_APPEND_DATA - } - sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE) - var sa *syscall.SecurityAttributes - if mode&syscall.O_CLOEXEC == 0 { - sa = makeInheritSa() - } - var createmode uint32 - switch { - case mode&(syscall.O_CREAT|syscall.O_EXCL) == (syscall.O_CREAT | syscall.O_EXCL): - createmode = syscall.CREATE_NEW - case mode&(syscall.O_CREAT|syscall.O_TRUNC) == (syscall.O_CREAT | syscall.O_TRUNC): - createmode = syscall.CREATE_ALWAYS - case mode&syscall.O_CREAT == syscall.O_CREAT: - createmode = syscall.OPEN_ALWAYS - case mode&syscall.O_TRUNC == syscall.O_TRUNC: - createmode = syscall.TRUNCATE_EXISTING - default: - createmode = syscall.OPEN_EXISTING - } - // Use FILE_FLAG_SEQUENTIAL_SCAN rather than FILE_ATTRIBUTE_NORMAL as implemented in golang. - //https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx - const fileFlagSequentialScan = 0x08000000 // FILE_FLAG_SEQUENTIAL_SCAN - h, e := syscall.CreateFile(pathp, access, sharemode, sa, createmode, fileFlagSequentialScan, 0) - return h, e -} diff --git a/vendor/github.com/containerd/containerd/sys/oom_unix.go b/vendor/github.com/containerd/containerd/sys/oom_unix.go deleted file mode 100644 index 23fcc94371..0000000000 --- a/vendor/github.com/containerd/containerd/sys/oom_unix.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build !windows - -package sys - -import ( - "fmt" - "os" - "strconv" - - "github.com/opencontainers/runc/libcontainer/system" -) - -// OOMScoreMaxKillable is the maximum score keeping the process killable by the oom killer -const OOMScoreMaxKillable = -999 - -// SetOOMScore sets the oom score for the provided pid -func SetOOMScore(pid, score int) error { - path := fmt.Sprintf("/proc/%d/oom_score_adj", pid) - f, err := os.OpenFile(path, os.O_WRONLY, 0) - if err != nil { - return err - } - defer f.Close() - if _, err = f.WriteString(strconv.Itoa(score)); err != nil { - if os.IsPermission(err) && system.RunningInUserNS() { - return nil - } - return err - } - return nil -} diff --git a/vendor/github.com/containerd/containerd/sys/oom_windows.go b/vendor/github.com/containerd/containerd/sys/oom_windows.go deleted file mode 100644 index a72568b279..0000000000 --- a/vendor/github.com/containerd/containerd/sys/oom_windows.go +++ /dev/null @@ -1,5 +0,0 @@ -package sys - -func SetOOMScore(pid, score int) error { - return nil -} diff --git a/vendor/github.com/containerd/containerd/sys/prctl.go b/vendor/github.com/containerd/containerd/sys/prctl.go deleted file mode 100644 index 63c418db98..0000000000 --- a/vendor/github.com/containerd/containerd/sys/prctl.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build linux - -// Package osutils provide access to the Get Child and Set Child prctl -// flags. -// See http://man7.org/linux/man-pages/man2/prctl.2.html -package sys - -import ( - "unsafe" - - "golang.org/x/sys/unix" -) - -// PR_SET_CHILD_SUBREAPER allows setting the child subreaper. -// If arg2 is nonzero, set the "child subreaper" attribute of the -// calling process; if arg2 is zero, unset the attribute. When a -// process is marked as a child subreaper, all of the children -// that it creates, and their descendants, will be marked as -// having a subreaper. In effect, a subreaper fulfills the role -// of init(1) for its descendant processes. Upon termination of -// a process that is orphaned (i.e., its immediate parent has -// already terminated) and marked as having a subreaper, the -// nearest still living ancestor subreaper will receive a SIGCHLD -// signal and be able to wait(2) on the process to discover its -// termination status. -const prSetChildSubreaper = 36 - -// PR_GET_CHILD_SUBREAPER allows retrieving the current child -// subreaper. -// Returns the "child subreaper" setting of the caller, in the -// location pointed to by (int *) arg2. -const prGetChildSubreaper = 37 - -// GetSubreaper returns the subreaper setting for the calling process -func GetSubreaper() (int, error) { - var i uintptr - if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, prGetChildSubreaper, uintptr(unsafe.Pointer(&i)), 0); err != 0 { - return -1, err - } - return int(i), nil -} - -// SetSubreaper sets the value i as the subreaper setting for the calling process -func SetSubreaper(i int) error { - if _, _, err := unix.RawSyscall(unix.SYS_PRCTL, prSetChildSubreaper, uintptr(i), 0); err != 0 { - return err - } - return nil -} diff --git a/vendor/github.com/containerd/containerd/sys/prctl_solaris.go b/vendor/github.com/containerd/containerd/sys/prctl_solaris.go deleted file mode 100644 index 9443f14dbd..0000000000 --- a/vendor/github.com/containerd/containerd/sys/prctl_solaris.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build solaris - -package sys - -import ( - "errors" -) - -//Solaris TODO - -// GetSubreaper returns the subreaper setting for the calling process -func GetSubreaper() (int, error) { - return 0, errors.New("osutils GetSubreaper not implemented on Solaris") -} - -// SetSubreaper sets the value i as the subreaper setting for the calling process -func SetSubreaper(i int) error { - return errors.New("osutils SetSubreaper not implemented on Solaris") -} diff --git a/vendor/github.com/containerd/containerd/sys/proc.go b/vendor/github.com/containerd/containerd/sys/proc.go deleted file mode 100644 index fbe7b51905..0000000000 --- a/vendor/github.com/containerd/containerd/sys/proc.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build linux - -package sys - -import ( - "bufio" - "fmt" - "os" - "strconv" - "strings" - - "github.com/opencontainers/runc/libcontainer/system" -) - -const nanoSecondsPerSecond = 1e9 - -var clockTicksPerSecond = uint64(system.GetClockTicks()) - -// GetSystemCPUUsage returns the host system's cpu usage in -// nanoseconds. An error is returned if the format of the underlying -// file does not match. -// -// Uses /proc/stat defined by POSIX. Looks for the cpu -// statistics line and then sums up the first seven fields -// provided. See `man 5 proc` for details on specific field -// information. -func GetSystemCPUUsage() (uint64, error) { - var line string - f, err := os.Open("/proc/stat") - if err != nil { - return 0, err - } - bufReader := bufio.NewReaderSize(nil, 128) - defer func() { - bufReader.Reset(nil) - f.Close() - }() - bufReader.Reset(f) - err = nil - for err == nil { - line, err = bufReader.ReadString('\n') - if err != nil { - break - } - parts := strings.Fields(line) - switch parts[0] { - case "cpu": - if len(parts) < 8 { - return 0, fmt.Errorf("bad format of cpu stats") - } - var totalClockTicks uint64 - for _, i := range parts[1:8] { - v, err := strconv.ParseUint(i, 10, 64) - if err != nil { - return 0, fmt.Errorf("error parsing cpu stats") - } - totalClockTicks += v - } - return (totalClockTicks * nanoSecondsPerSecond) / - clockTicksPerSecond, nil - } - } - return 0, fmt.Errorf("bad stats format") -} diff --git a/vendor/github.com/containerd/containerd/sys/reaper.go b/vendor/github.com/containerd/containerd/sys/reaper.go deleted file mode 100644 index bbc5a1e868..0000000000 --- a/vendor/github.com/containerd/containerd/sys/reaper.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build !windows - -package sys - -import "golang.org/x/sys/unix" - -// Exit is the wait4 information from an exited process -type Exit struct { - Pid int - Status int -} - -// Reap reaps all child processes for the calling process and returns their -// exit information -func Reap(wait bool) (exits []Exit, err error) { - var ( - ws unix.WaitStatus - rus unix.Rusage - ) - flag := unix.WNOHANG - if wait { - flag = 0 - } - for { - pid, err := unix.Wait4(-1, &ws, flag, &rus) - if err != nil { - if err == unix.ECHILD { - return exits, nil - } - return exits, err - } - if pid <= 0 { - return exits, nil - } - exits = append(exits, Exit{ - Pid: pid, - Status: exitStatus(ws), - }) - } -} - -const exitSignalOffset = 128 - -// exitStatus returns the correct exit status for a process based on if it -// was signaled or exited cleanly -func exitStatus(status unix.WaitStatus) int { - if status.Signaled() { - return exitSignalOffset + int(status.Signal()) - } - return status.ExitStatus() -} diff --git a/vendor/github.com/containerd/containerd/sys/socket_unix.go b/vendor/github.com/containerd/containerd/sys/socket_unix.go deleted file mode 100644 index cd361c25e6..0000000000 --- a/vendor/github.com/containerd/containerd/sys/socket_unix.go +++ /dev/null @@ -1,42 +0,0 @@ -// +build !windows - -package sys - -import ( - "net" - "os" - "path/filepath" - - "golang.org/x/sys/unix" -) - -// CreateUnixSocket creates a unix socket and returns the listener -func CreateUnixSocket(path string) (net.Listener, error) { - if err := os.MkdirAll(filepath.Dir(path), 0660); err != nil { - return nil, err - } - if err := unix.Unlink(path); err != nil && !os.IsNotExist(err) { - return nil, err - } - return net.Listen("unix", path) -} - -// GetLocalListener returns a listerner out of a unix socket. -func GetLocalListener(path string, uid, gid int) (net.Listener, error) { - l, err := CreateUnixSocket(path) - if err != nil { - return l, err - } - - if err := os.Chmod(path, 0660); err != nil { - l.Close() - return nil, err - } - - if err := os.Chown(path, uid, gid); err != nil { - l.Close() - return nil, err - } - - return l, nil -} diff --git a/vendor/github.com/containerd/containerd/sys/socket_windows.go b/vendor/github.com/containerd/containerd/sys/socket_windows.go deleted file mode 100644 index de25c08601..0000000000 --- a/vendor/github.com/containerd/containerd/sys/socket_windows.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build windows - -package sys - -import ( - "net" - - "github.com/Microsoft/go-winio" -) - -// GetLocalListener returns a Listernet out of a named pipe. -// `path` must be of the form of `\\.\pipe\` -// (see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365150) -func GetLocalListener(path string, uid, gid int) (net.Listener, error) { - return winio.ListenPipe(path, nil) -} diff --git a/vendor/github.com/containerd/continuity/LICENSE b/vendor/github.com/containerd/continuity/LICENSE deleted file mode 100644 index 8f71f43fee..0000000000 --- a/vendor/github.com/containerd/continuity/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/github.com/containerd/continuity/README.md b/vendor/github.com/containerd/continuity/README.md deleted file mode 100644 index 50b64c20f3..0000000000 --- a/vendor/github.com/containerd/continuity/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# continuity - -[![GoDoc](https://godoc.org/github.com/containerd/continuity?status.svg)](https://godoc.org/github.com/containerd/continuity) -[![Build Status](https://travis-ci.org/containerd/continuity.svg?branch=master)](https://travis-ci.org/containerd/continuity) - -A transport-agnostic, filesystem metadata manifest system - -This project is a staging area for experiments in providing transport agnostic -metadata storage. - -Please see https://github.com/opencontainers/specs/issues/11 for more details. - -## Building Proto Package - -If you change the proto file you will need to rebuild the generated Go with `go generate`. - -``` -go generate ./proto -``` diff --git a/vendor/github.com/containerd/continuity/sysx/asm.s b/vendor/github.com/containerd/continuity/sysx/asm.s deleted file mode 100644 index 8ed2fdb94b..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/asm.s +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -TEXT ·use(SB),NOSPLIT,$0 - RET diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_darwin.go b/vendor/github.com/containerd/continuity/sysx/chmod_darwin.go deleted file mode 100644 index e3ae2b7bbf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_darwin.go +++ /dev/null @@ -1,18 +0,0 @@ -package sysx - -const ( - // AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in - AtSymlinkNofollow = 0x20 -) - -const ( - - // SYS_FCHMODAT defined from golang.org/sys/unix - SYS_FCHMODAT = 467 -) - -// These functions will be generated by generate.sh -// $ GOOS=darwin GOARCH=386 ./generate.sh chmod -// $ GOOS=darwin GOARCH=amd64 ./generate.sh chmod - -//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_darwin_386.go b/vendor/github.com/containerd/continuity/sysx/chmod_darwin_386.go deleted file mode 100644 index 5a8cf5b57d..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_darwin_386.go +++ /dev/null @@ -1,25 +0,0 @@ -// mksyscall.pl -l32 chmod_darwin.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_darwin_amd64.go b/vendor/github.com/containerd/continuity/sysx/chmod_darwin_amd64.go deleted file mode 100644 index 3287d1d579..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_darwin_amd64.go +++ /dev/null @@ -1,25 +0,0 @@ -// mksyscall.pl chmod_darwin.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_freebsd.go b/vendor/github.com/containerd/continuity/sysx/chmod_freebsd.go deleted file mode 100644 index b64a708be1..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_freebsd.go +++ /dev/null @@ -1,17 +0,0 @@ -package sysx - -const ( - // AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in - AtSymlinkNofollow = 0x200 -) - -const ( - - // SYS_FCHMODAT defined from golang.org/sys/unix - SYS_FCHMODAT = 490 -) - -// These functions will be generated by generate.sh -// $ GOOS=freebsd GOARCH=amd64 ./generate.sh chmod - -//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_freebsd_amd64.go b/vendor/github.com/containerd/continuity/sysx/chmod_freebsd_amd64.go deleted file mode 100644 index 5a271abb1e..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_freebsd_amd64.go +++ /dev/null @@ -1,25 +0,0 @@ -// mksyscall.pl chmod_freebsd.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall.Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - use(unsafe.Pointer(_p0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/chmod_linux.go b/vendor/github.com/containerd/continuity/sysx/chmod_linux.go deleted file mode 100644 index 89df6d38ef..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/chmod_linux.go +++ /dev/null @@ -1,12 +0,0 @@ -package sysx - -import "syscall" - -const ( - // AtSymlinkNoFollow defined from AT_SYMLINK_NOFOLLOW in /usr/include/linux/fcntl.h - AtSymlinkNofollow = 0x100 -) - -func Fchmodat(dirfd int, path string, mode uint32, flags int) error { - return syscall.Fchmodat(dirfd, path, mode, flags) -} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux.go b/vendor/github.com/containerd/continuity/sysx/copy_linux.go deleted file mode 100644 index d7ccbb26ee..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux.go +++ /dev/null @@ -1,9 +0,0 @@ -package sysx - -// These functions will be generated by generate.sh -// $ GOOS=linux GOARCH=386 ./generate.sh copy -// $ GOOS=linux GOARCH=amd64 ./generate.sh copy -// $ GOOS=linux GOARCH=arm ./generate.sh copy -// $ GOOS=linux GOARCH=arm64 ./generate.sh copy - -//sys CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_386.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_386.go deleted file mode 100644 index c1368c5723..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux_386.go +++ /dev/null @@ -1,20 +0,0 @@ -// mksyscall.pl -l32 copy_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { - r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_amd64.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_amd64.go deleted file mode 100644 index 9941b01f09..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux_amd64.go +++ /dev/null @@ -1,20 +0,0 @@ -// mksyscall.pl copy_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { - r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_arm.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_arm.go deleted file mode 100644 index c1368c5723..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux_arm.go +++ /dev/null @@ -1,20 +0,0 @@ -// mksyscall.pl -l32 copy_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { - r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/copy_linux_arm64.go b/vendor/github.com/containerd/continuity/sysx/copy_linux_arm64.go deleted file mode 100644 index 9941b01f09..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/copy_linux_arm64.go +++ /dev/null @@ -1,20 +0,0 @@ -// mksyscall.pl copy_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func CopyFileRange(fdin uintptr, offin *int64, fdout uintptr, offout *int64, len int, flags int) (n int, err error) { - r0, _, e1 := syscall.Syscall6(SYS_COPY_FILE_RANGE, uintptr(fdin), uintptr(unsafe.Pointer(offin)), uintptr(fdout), uintptr(unsafe.Pointer(offout)), uintptr(len), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/nodata_linux.go b/vendor/github.com/containerd/continuity/sysx/nodata_linux.go deleted file mode 100644 index fc47ddb8dc..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/nodata_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -package sysx - -import ( - "syscall" -) - -const ENODATA = syscall.ENODATA diff --git a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go b/vendor/github.com/containerd/continuity/sysx/nodata_unix.go deleted file mode 100644 index 7e6851209f..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/nodata_unix.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build darwin freebsd - -package sysx - -import ( - "syscall" -) - -const ENODATA = syscall.ENOATTR diff --git a/vendor/github.com/containerd/continuity/sysx/sys.go b/vendor/github.com/containerd/continuity/sysx/sys.go deleted file mode 100644 index 0bb1676283..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/sys.go +++ /dev/null @@ -1,37 +0,0 @@ -package sysx - -import ( - "syscall" - "unsafe" -) - -var _zero uintptr - -// use is a no-op, but the compiler cannot see that it is. -// Calling use(p) ensures that p is kept live until that point. -//go:noescape -func use(p unsafe.Pointer) - -// Do the interface allocations only once for common -// Errno values. -var ( - errEAGAIN error = syscall.EAGAIN - errEINVAL error = syscall.EINVAL - errENOENT error = syscall.ENOENT -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case syscall.EAGAIN: - return errEAGAIN - case syscall.EINVAL: - return errEINVAL - case syscall.ENOENT: - return errENOENT - } - return e -} diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_386.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_386.go deleted file mode 100644 index 0063f8a913..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_386.go +++ /dev/null @@ -1,7 +0,0 @@ -package sysx - -const ( - // SYS_COPYFILERANGE defined in Kernel 4.5+ - // Number defined in /usr/include/asm/unistd_32.h - SYS_COPY_FILE_RANGE = 377 -) diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_amd64.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_amd64.go deleted file mode 100644 index 4170540c5d..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_amd64.go +++ /dev/null @@ -1,7 +0,0 @@ -package sysx - -const ( - // SYS_COPYFILERANGE defined in Kernel 4.5+ - // Number defined in /usr/include/asm/unistd_64.h - SYS_COPY_FILE_RANGE = 326 -) diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm.go deleted file mode 100644 index a05dcbb5ef..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm.go +++ /dev/null @@ -1,7 +0,0 @@ -package sysx - -const ( - // SYS_COPY_FILE_RANGE defined in Kernel 4.5+ - // Number defined in /usr/include/arm-linux-gnueabihf/asm/unistd.h - SYS_COPY_FILE_RANGE = 391 -) diff --git a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm64.go b/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm64.go deleted file mode 100644 index da31bbd908..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/sysnum_linux_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -package sysx - -const ( - // SYS_COPY_FILE_RANGE defined in Kernel 4.5+ - // Number defined in /usr/include/asm-generic/unistd.h - SYS_COPY_FILE_RANGE = 285 -) diff --git a/vendor/github.com/containerd/continuity/sysx/xattr.go b/vendor/github.com/containerd/continuity/sysx/xattr.go deleted file mode 100644 index 20937c2d4d..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr.go +++ /dev/null @@ -1,67 +0,0 @@ -package sysx - -import ( - "bytes" - "fmt" - "syscall" -) - -const defaultXattrBufferSize = 5 - -var ErrNotSupported = fmt.Errorf("not supported") - -type listxattrFunc func(path string, dest []byte) (int, error) - -func listxattrAll(path string, listFunc listxattrFunc) ([]string, error) { - var p []byte // nil on first execution - - for { - n, err := listFunc(path, p) // first call gets buffer size. - if err != nil { - return nil, err - } - - if n > len(p) { - p = make([]byte, n) - continue - } - - p = p[:n] - - ps := bytes.Split(bytes.TrimSuffix(p, []byte{0}), []byte{0}) - var entries []string - for _, p := range ps { - s := string(p) - if s != "" { - entries = append(entries, s) - } - } - - return entries, nil - } -} - -type getxattrFunc func(string, string, []byte) (int, error) - -func getxattrAll(path, attr string, getFunc getxattrFunc) ([]byte, error) { - p := make([]byte, defaultXattrBufferSize) - for { - n, err := getFunc(path, attr, p) - if err != nil { - if errno, ok := err.(syscall.Errno); ok && errno == syscall.ERANGE { - p = make([]byte, len(p)*2) // this can't be ideal. - continue // try again! - } - - return nil, err - } - - // realloc to correct size and repeat - if n > len(p) { - p = make([]byte, n) - continue - } - - return p[:n], nil - } -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_darwin.go b/vendor/github.com/containerd/continuity/sysx/xattr_darwin.go deleted file mode 100644 index 1164a7d11c..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_darwin.go +++ /dev/null @@ -1,71 +0,0 @@ -package sysx - -// These functions will be generated by generate.sh -// $ GOOS=darwin GOARCH=386 ./generate.sh xattr -// $ GOOS=darwin GOARCH=amd64 ./generate.sh xattr - -//sys getxattr(path string, attr string, dest []byte, pos int, options int) (sz int, err error) -//sys setxattr(path string, attr string, data []byte, flags int) (err error) -//sys removexattr(path string, attr string, options int) (err error) -//sys listxattr(path string, dest []byte, options int) (sz int, err error) -//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) - -const ( - xattrNoFollow = 0x01 -) - -func listxattrFollow(path string, dest []byte) (sz int, err error) { - return listxattr(path, dest, 0) -} - -// Listxattr calls syscall getxattr -func Listxattr(path string) ([]string, error) { - return listxattrAll(path, listxattrFollow) -} - -// Removexattr calls syscall getxattr -func Removexattr(path string, attr string) (err error) { - return removexattr(path, attr, 0) -} - -// Setxattr calls syscall setxattr -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return setxattr(path, attr, data, flags) -} - -func getxattrFollow(path, attr string, dest []byte) (sz int, err error) { - return getxattr(path, attr, dest, 0, 0) -} - -// Getxattr calls syscall getxattr -func Getxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, getxattrFollow) -} - -func listxattrNoFollow(path string, dest []byte) (sz int, err error) { - return listxattr(path, dest, xattrNoFollow) -} - -// LListxattr calls syscall listxattr with XATTR_NOFOLLOW -func LListxattr(path string) ([]string, error) { - return listxattrAll(path, listxattrNoFollow) -} - -// LRemovexattr calls syscall removexattr with XATTR_NOFOLLOW -func LRemovexattr(path string, attr string) (err error) { - return removexattr(path, attr, xattrNoFollow) -} - -// Setxattr calls syscall setxattr with XATTR_NOFOLLOW -func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return setxattr(path, attr, data, flags|xattrNoFollow) -} - -func getxattrNoFollow(path, attr string, dest []byte) (sz int, err error) { - return getxattr(path, attr, dest, 0, xattrNoFollow) -} - -// LGetxattr calls syscall getxattr with XATTR_NOFOLLOW -func LGetxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, getxattrNoFollow) -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_darwin_386.go b/vendor/github.com/containerd/continuity/sysx/xattr_darwin_386.go deleted file mode 100644 index aa896b57fc..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_darwin_386.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl -l32 xattr_darwin.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest []byte, pos int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), uintptr(pos), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest []byte, options int) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(options), 0, 0) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_darwin_amd64.go b/vendor/github.com/containerd/continuity/sysx/xattr_darwin_amd64.go deleted file mode 100644 index 6ff27e2703..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_darwin_amd64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_darwin.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest []byte, pos int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), uintptr(pos), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest []byte, options int) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(options), 0, 0) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go b/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go deleted file mode 100644 index 80dba49aa5..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_freebsd.go +++ /dev/null @@ -1,53 +0,0 @@ -package sysx - -import ( - "errors" -) - -// Initial stub version for FreeBSD. FreeBSD has a different -// syscall API from Darwin and Linux for extended attributes; -// it is also not widely used. It is not exposed at all by the -// Go syscall package, so we need to implement directly eventually. - -var unsupported error = errors.New("extended attributes unsupported on FreeBSD") - -// Listxattr calls syscall listxattr and reads all content -// and returns a string array -func Listxattr(path string) ([]string, error) { - return []string{}, nil -} - -// Removexattr calls syscall removexattr -func Removexattr(path string, attr string) (err error) { - return unsupported -} - -// Setxattr calls syscall setxattr -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported -} - -// Getxattr calls syscall getxattr -func Getxattr(path, attr string) ([]byte, error) { - return []byte{}, nil -} - -// LListxattr lists xattrs, not following symlinks -func LListxattr(path string) ([]string, error) { - return []string{}, nil -} - -// LRemovexattr removes an xattr, not following symlinks -func LRemovexattr(path string, attr string) (err error) { - return unsupported -} - -// LSetxattr sets an xattr, not following symlinks -func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return unsupported -} - -// LGetxattr gets an xattr, not following symlinks -func LGetxattr(path, attr string) ([]byte, error) { - return []byte{}, nil -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux.go deleted file mode 100644 index cd18136343..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux.go +++ /dev/null @@ -1,61 +0,0 @@ -package sysx - -import "syscall" - -// These functions will be generated by generate.sh -// $ GOOS=linux GOARCH=386 ./generate.sh xattr -// $ GOOS=linux GOARCH=amd64 ./generate.sh xattr -// $ GOOS=linux GOARCH=arm ./generate.sh xattr -// $ GOOS=linux GOARCH=arm64 ./generate.sh xattr -// $ GOOS=linux GOARCH=ppc64 ./generate.sh xattr -// $ GOOS=linux GOARCH=ppc64le ./generate.sh xattr -// $ GOOS=linux GOARCH=s390x ./generate.sh xattr - -// Listxattr calls syscall listxattr and reads all content -// and returns a string array -func Listxattr(path string) ([]string, error) { - return listxattrAll(path, syscall.Listxattr) -} - -// Removexattr calls syscall removexattr -func Removexattr(path string, attr string) (err error) { - return syscall.Removexattr(path, attr) -} - -// Setxattr calls syscall setxattr -func Setxattr(path string, attr string, data []byte, flags int) (err error) { - return syscall.Setxattr(path, attr, data, flags) -} - -// Getxattr calls syscall getxattr -func Getxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, syscall.Getxattr) -} - -//sys llistxattr(path string, dest []byte) (sz int, err error) - -// LListxattr lists xattrs, not following symlinks -func LListxattr(path string) ([]string, error) { - return listxattrAll(path, llistxattr) -} - -//sys lremovexattr(path string, attr string) (err error) - -// LRemovexattr removes an xattr, not following symlinks -func LRemovexattr(path string, attr string) (err error) { - return lremovexattr(path, attr) -} - -//sys lsetxattr(path string, attr string, data []byte, flags int) (err error) - -// LSetxattr sets an xattr, not following symlinks -func LSetxattr(path string, attr string, data []byte, flags int) (err error) { - return lsetxattr(path, attr, data, flags) -} - -//sys lgetxattr(path string, attr string, dest []byte) (sz int, err error) - -// LGetxattr gets an xattr, not following symlinks -func LGetxattr(path, attr string) ([]byte, error) { - return getxattrAll(path, attr, lgetxattr) -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go deleted file mode 100644 index c3e5c8e385..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_386.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl -l32 xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_amd64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go deleted file mode 100644 index c3e5c8e385..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl -l32 xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_arm64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_ppc64le.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go b/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go deleted file mode 100644 index dec46faaaf..0000000000 --- a/vendor/github.com/containerd/continuity/sysx/xattr_linux_s390x.go +++ /dev/null @@ -1,111 +0,0 @@ -// mksyscall.pl xattr_linux.go -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT - -package sysx - -import ( - "syscall" - "unsafe" -) - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func llistxattr(path string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(dest) > 0 { - _p1 = unsafe.Pointer(&dest[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) - use(unsafe.Pointer(_p0)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lremovexattr(path string, attr string) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall.Syscall(syscall.SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lsetxattr(path string, attr string, data []byte, flags int) (err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(data) > 0 { - _p2 = unsafe.Pointer(&data[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func lgetxattr(path string, attr string, dest []byte) (sz int, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(attr) - if err != nil { - return - } - var _p2 unsafe.Pointer - if len(dest) > 0 { - _p2 = unsafe.Pointer(&dest[0]) - } else { - _p2 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) - use(unsafe.Pointer(_p0)) - use(unsafe.Pointer(_p1)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go deleted file mode 100644 index 1afc52b4bd..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go +++ /dev/null @@ -1,143 +0,0 @@ -// +build linux - -package system - -import ( - "bufio" - "fmt" - "os" - "os/exec" - "syscall" - "unsafe" -) - -// If arg2 is nonzero, set the "child subreaper" attribute of the -// calling process; if arg2 is zero, unset the attribute. When a -// process is marked as a child subreaper, all of the children -// that it creates, and their descendants, will be marked as -// having a subreaper. In effect, a subreaper fulfills the role -// of init(1) for its descendant processes. Upon termination of -// a process that is orphaned (i.e., its immediate parent has -// already terminated) and marked as having a subreaper, the -// nearest still living ancestor subreaper will receive a SIGCHLD -// signal and be able to wait(2) on the process to discover its -// termination status. -const PR_SET_CHILD_SUBREAPER = 36 - -type ParentDeathSignal int - -func (p ParentDeathSignal) Restore() error { - if p == 0 { - return nil - } - current, err := GetParentDeathSignal() - if err != nil { - return err - } - if p == current { - return nil - } - return p.Set() -} - -func (p ParentDeathSignal) Set() error { - return SetParentDeathSignal(uintptr(p)) -} - -func Execv(cmd string, args []string, env []string) error { - name, err := exec.LookPath(cmd) - if err != nil { - return err - } - - return syscall.Exec(name, args, env) -} - -func Prlimit(pid, resource int, limit syscall.Rlimit) error { - _, _, err := syscall.RawSyscall6(syscall.SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(&limit)), uintptr(unsafe.Pointer(&limit)), 0, 0) - if err != 0 { - return err - } - return nil -} - -func SetParentDeathSignal(sig uintptr) error { - if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, sig, 0); err != 0 { - return err - } - return nil -} - -func GetParentDeathSignal() (ParentDeathSignal, error) { - var sig int - _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_GET_PDEATHSIG, uintptr(unsafe.Pointer(&sig)), 0) - if err != 0 { - return -1, err - } - return ParentDeathSignal(sig), nil -} - -func SetKeepCaps() error { - if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_KEEPCAPS, 1, 0); err != 0 { - return err - } - - return nil -} - -func ClearKeepCaps() error { - if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_KEEPCAPS, 0, 0); err != 0 { - return err - } - - return nil -} - -func Setctty() error { - if _, _, err := syscall.RawSyscall(syscall.SYS_IOCTL, 0, uintptr(syscall.TIOCSCTTY), 0); err != 0 { - return err - } - return nil -} - -// RunningInUserNS detects whether we are currently running in a user namespace. -// Copied from github.com/lxc/lxd/shared/util.go -func RunningInUserNS() bool { - file, err := os.Open("/proc/self/uid_map") - if err != nil { - // This kernel-provided file only exists if user namespaces are supported - return false - } - defer file.Close() - - buf := bufio.NewReader(file) - l, _, err := buf.ReadLine() - if err != nil { - return false - } - - line := string(l) - var a, b, c int64 - fmt.Sscanf(line, "%d %d %d", &a, &b, &c) - /* - * We assume we are in the initial user namespace if we have a full - * range - 4294967295 uids starting at uid 0. - */ - if a == 0 && b == 0 && c == 4294967295 { - return false - } - return true -} - -// SetSubreaper sets the value i as the subreaper setting for the calling process -func SetSubreaper(i int) error { - return Prctl(PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) -} - -func Prctl(option int, arg2, arg3, arg4, arg5 uintptr) (err error) { - _, _, e1 := syscall.Syscall6(syscall.SYS_PRCTL, uintptr(option), arg2, arg3, arg4, arg5, 0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go b/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go deleted file mode 100644 index a0e9637199..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/proc.go +++ /dev/null @@ -1,43 +0,0 @@ -package system - -import ( - "io/ioutil" - "path/filepath" - "strconv" - "strings" -) - -// look in /proc to find the process start time so that we can verify -// that this pid has started after ourself -func GetProcessStartTime(pid int) (string, error) { - data, err := ioutil.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "stat")) - if err != nil { - return "", err - } - return parseStartTime(string(data)) -} - -func parseStartTime(stat string) (string, error) { - // the starttime is located at pos 22 - // from the man page - // - // starttime %llu (was %lu before Linux 2.6) - // (22) The time the process started after system boot. In kernels before Linux 2.6, this - // value was expressed in jiffies. Since Linux 2.6, the value is expressed in clock ticks - // (divide by sysconf(_SC_CLK_TCK)). - // - // NOTE: - // pos 2 could contain space and is inside `(` and `)`: - // (2) comm %s - // The filename of the executable, in parentheses. - // This is visible whether or not the executable is - // swapped out. - // - // the following is an example: - // 89653 (gunicorn: maste) S 89630 89653 89653 0 -1 4194560 29689 28896 0 3 146 32 76 19 20 0 1 0 2971844 52965376 3920 18446744073709551615 1 1 0 0 0 0 0 16781312 137447943 0 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0 - - // get parts after last `)`: - s := strings.Split(stat, ")") - parts := strings.Split(strings.TrimSpace(s[len(s)-1]), " ") - return parts[22-3], nil // starts at 3 (after the filename pos `2`) -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go deleted file mode 100644 index 615ff4c827..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/setns_linux.go +++ /dev/null @@ -1,40 +0,0 @@ -package system - -import ( - "fmt" - "runtime" - "syscall" -) - -// Via http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7b21fddd087678a70ad64afc0f632e0f1071b092 -// -// We need different setns values for the different platforms and arch -// We are declaring the macro here because the SETNS syscall does not exist in th stdlib -var setNsMap = map[string]uintptr{ - "linux/386": 346, - "linux/arm64": 268, - "linux/amd64": 308, - "linux/arm": 375, - "linux/ppc": 350, - "linux/ppc64": 350, - "linux/ppc64le": 350, - "linux/s390x": 339, -} - -var sysSetns = setNsMap[fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)] - -func SysSetns() uint32 { - return uint32(sysSetns) -} - -func Setns(fd uintptr, flags uintptr) error { - ns, exists := setNsMap[fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)] - if !exists { - return fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH) - } - _, _, err := syscall.RawSyscall(ns, fd, flags, 0) - if err != 0 { - return err - } - return nil -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go deleted file mode 100644 index bb44d895ce..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_386.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build linux,386 - -package system - -import ( - "syscall" -) - -// Setuid sets the uid of the calling thread to the specified uid. -func Setuid(uid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// Setgid sets the gid of the calling thread to the specified gid. -func Setgid(gid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID32, uintptr(gid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go deleted file mode 100644 index 0816bf8281..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build linux,arm64 linux,amd64 linux,ppc linux,ppc64 linux,ppc64le linux,s390x - -package system - -import ( - "syscall" -) - -// Setuid sets the uid of the calling thread to the specified uid. -func Setuid(uid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// Setgid sets the gid of the calling thread to the specified gid. -func Setgid(gid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go deleted file mode 100644 index 3f780f312b..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_arm.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build linux,arm - -package system - -import ( - "syscall" -) - -// Setuid sets the uid of the calling thread to the specified uid. -func Setuid(uid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} - -// Setgid sets the gid of the calling thread to the specified gid. -func Setgid(gid int) (err error) { - _, _, e1 := syscall.RawSyscall(syscall.SYS_SETGID32, uintptr(gid), 0, 0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go deleted file mode 100644 index b3a07cba3e..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build cgo,linux cgo,freebsd - -package system - -/* -#include -*/ -import "C" - -func GetClockTicks() int { - return int(C.sysconf(C._SC_CLK_TCK)) -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go b/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go deleted file mode 100644 index d93b5d5fdf..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/sysconfig_notcgo.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build !cgo windows - -package system - -func GetClockTicks() int { - // TODO figure out a better alternative for platforms where we're missing cgo - // - // TODO Windows. This could be implemented using Win32 QueryPerformanceFrequency(). - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx - // - // An example of its usage can be found here. - // https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx - - return 100 -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go b/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go deleted file mode 100644 index e7cfd62b29..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build !linux - -package system - -// RunningInUserNS is a stub for non-Linux systems -// Always returns false -func RunningInUserNS() bool { - return false -} diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go b/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go deleted file mode 100644 index 30f74dfb1b..0000000000 --- a/vendor/github.com/opencontainers/runc/libcontainer/system/xattrs_linux.go +++ /dev/null @@ -1,99 +0,0 @@ -package system - -import ( - "syscall" - "unsafe" -) - -var _zero uintptr - -// Returns the size of xattrs and nil error -// Requires path, takes allocated []byte or nil as last argument -func Llistxattr(path string, dest []byte) (size int, err error) { - pathBytes, err := syscall.BytePtrFromString(path) - if err != nil { - return -1, err - } - var newpathBytes unsafe.Pointer - if len(dest) > 0 { - newpathBytes = unsafe.Pointer(&dest[0]) - } else { - newpathBytes = unsafe.Pointer(&_zero) - } - - _size, _, errno := syscall.Syscall6(syscall.SYS_LLISTXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(newpathBytes), uintptr(len(dest)), 0, 0, 0) - size = int(_size) - if errno != 0 { - return -1, errno - } - - return size, nil -} - -// Returns a []byte slice if the xattr is set and nil otherwise -// Requires path and its attribute as arguments -func Lgetxattr(path string, attr string) ([]byte, error) { - var sz int - pathBytes, err := syscall.BytePtrFromString(path) - if err != nil { - return nil, err - } - attrBytes, err := syscall.BytePtrFromString(attr) - if err != nil { - return nil, err - } - - // Start with a 128 length byte array - sz = 128 - dest := make([]byte, sz) - destBytes := unsafe.Pointer(&dest[0]) - _sz, _, errno := syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(destBytes), uintptr(len(dest)), 0, 0) - - switch { - case errno == syscall.ENODATA: - return nil, errno - case errno == syscall.ENOTSUP: - return nil, errno - case errno == syscall.ERANGE: - // 128 byte array might just not be good enough, - // A dummy buffer is used ``uintptr(0)`` to get real size - // of the xattrs on disk - _sz, _, errno = syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(unsafe.Pointer(nil)), uintptr(0), 0, 0) - sz = int(_sz) - if sz < 0 { - return nil, errno - } - dest = make([]byte, sz) - destBytes := unsafe.Pointer(&dest[0]) - _sz, _, errno = syscall.Syscall6(syscall.SYS_LGETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(destBytes), uintptr(len(dest)), 0, 0) - if errno != 0 { - return nil, errno - } - case errno != 0: - return nil, errno - } - sz = int(_sz) - return dest[:sz], nil -} - -func Lsetxattr(path string, attr string, data []byte, flags int) error { - pathBytes, err := syscall.BytePtrFromString(path) - if err != nil { - return err - } - attrBytes, err := syscall.BytePtrFromString(attr) - if err != nil { - return err - } - var dataBytes unsafe.Pointer - if len(data) > 0 { - dataBytes = unsafe.Pointer(&data[0]) - } else { - dataBytes = unsafe.Pointer(&_zero) - } - _, _, errno := syscall.Syscall6(syscall.SYS_LSETXATTR, uintptr(unsafe.Pointer(pathBytes)), uintptr(unsafe.Pointer(attrBytes)), uintptr(dataBytes), uintptr(len(data)), uintptr(flags), 0) - if errno != 0 { - return errno - } - return nil -} From 4d702a51241d896d1681b43662c387fc24bca638 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 15 Jun 2017 15:54:14 +0100 Subject: [PATCH 10/35] containerd: Rework and simplify mount handling Changes/simplifications: - no anon volume support, they don't really make sense in a cluster environment; - mount over the image provided mounts instead of trying to dedup; - don't worry about dedup of the requested mounts either; With this there is no longer any need to obtain the image config on the client side. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 220 +++++++++---------------------- 1 file changed, 59 insertions(+), 161 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index ed8c170a22..0f5de790d6 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -1,7 +1,6 @@ package containerd import ( - "encoding/json" "fmt" "io" "os" @@ -16,14 +15,12 @@ import ( containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/task" - "github.com/containerd/containerd/content" "github.com/containerd/fifo" dockermount "github.com/docker/docker/pkg/mount" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/api/naming" "github.com/docker/swarmkit/log" - ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "golang.org/x/net/context" @@ -125,150 +122,80 @@ func (c *containerAdapter) pullImage(ctx context.Context) error { return nil } -func (c *containerAdapter) makeAnonVolume(ctx context.Context, target string) (specs.Mount, error) { - source := filepath.Join(c.dir, "anon-volumes", target) - if err := os.MkdirAll(source, 0755); err != nil { - return specs.Mount{}, err - } - - return specs.Mount{ - Destination: target, - Type: "bind", - Source: source, - Options: []string{"rbind", "rprivate", "rw"}, - }, nil -} +func withMounts(ctx context.Context, ms []api.Mount) containerd.SpecOpts { + sort.Sort(mounts(ms)) -// Somewhat like docker/docker/daemon/oci_linux.go:setMounts -func (c *containerAdapter) setMounts(ctx context.Context, s *specs.Spec, mounts []api.Mount, volumes map[string]struct{}) error { - - userMounts := make(map[string]struct{}) - for _, m := range mounts { - userMounts[m.Target] = struct{}{} - } - - // Filter out mounts that are overridden by user supplied mounts - var defaultMounts []specs.Mount - _, mountDev := userMounts["/dev"] - for _, m := range s.Mounts { - if _, ok := userMounts[m.Destination]; !ok { - if mountDev && strings.HasPrefix(m.Destination, "/dev/") { - continue + return func(s *specs.Spec) error { + for _, m := range ms { + if !filepath.IsAbs(m.Target) { + return errors.Errorf("mount %s is not absolute", m.Target) } - defaultMounts = append(defaultMounts, m) - } - } - - s.Mounts = defaultMounts - for _, m := range mounts { - if !filepath.IsAbs(m.Target) { - return errors.Errorf("mount %s is not absolute", m.Target) - } - - for _, cm := range s.Mounts { - if cm.Destination == m.Target { - return errors.Errorf("duplicate mount point '%s'", m.Target) - } - } - delete(volumes, m.Target) // volume is no longer anon - - switch m.Type { - case api.MountTypeTmpfs: - opts := []string{"noexec", "nosuid", "nodev", "rprivate"} - if m.TmpfsOptions != nil { - if m.TmpfsOptions.SizeBytes <= 0 { - return errors.New("invalid tmpfs size give") + switch m.Type { + case api.MountTypeTmpfs: + opts := []string{"noexec", "nosuid", "nodev", "rprivate"} + if m.TmpfsOptions != nil { + if m.TmpfsOptions.SizeBytes <= 0 { + return errors.New("invalid tmpfs size give") + } + opts = append(opts, fmt.Sprintf("size=%d", m.TmpfsOptions.SizeBytes)) + opts = append(opts, fmt.Sprintf("mode=%o", m.TmpfsOptions.Mode)) + } + if m.ReadOnly { + opts = append(opts, "ro") + } else { + opts = append(opts, "rw") } - opts = append(opts, fmt.Sprintf("size=%d", m.TmpfsOptions.SizeBytes)) - opts = append(opts, fmt.Sprintf("mode=%o", m.TmpfsOptions.Mode)) - } - if m.ReadOnly { - opts = append(opts, "ro") - } else { - opts = append(opts, "rw") - } - - opts, err := dockermount.MergeTmpfsOptions(opts) - if err != nil { - return err - } - - s.Mounts = append(s.Mounts, specs.Mount{ - Destination: m.Target, - Type: "tmpfs", - Source: "tmpfs", - Options: opts, - }) - - case api.MountTypeVolume: - if m.Source != "" { - return errors.Errorf("non-anon volume mounts not implemented, ignoring %v", m) - } - if m.VolumeOptions != nil { - return errors.Errorf("volume mount VolumeOptions not implemented, ignoring %v", m) - } - mt, err := c.makeAnonVolume(ctx, m.Target) - if err != nil { - return err - } + opts, err := dockermount.MergeTmpfsOptions(opts) + if err != nil { + return err + } - s.Mounts = append(s.Mounts, mt) - continue + s.Mounts = append(s.Mounts, specs.Mount{ + Destination: m.Target, + Type: "tmpfs", + Source: "tmpfs", + Options: opts, + }) - case api.MountTypeBind: - opts := []string{"rbind"} - if m.ReadOnly { - opts = append(opts, "ro") - } else { - opts = append(opts, "rw") - } + case api.MountTypeVolume: + return errors.Errorf("volume mounts not implemented, ignoring %v", m) - propagation := "rprivate" - if m.BindOptions != nil { - if p, ok := mountPropagationReverseMap[m.BindOptions.Propagation]; ok { - propagation = p + case api.MountTypeBind: + opts := []string{"rbind"} + if m.ReadOnly { + opts = append(opts, "ro") } else { - log.G(ctx).Warningf("unknown bind mount propagation, using %q", propagation) + opts = append(opts, "rw") } - } - opts = append(opts, propagation) - mt := specs.Mount{ - Destination: m.Target, - Type: "bind", - Source: m.Source, - Options: opts, + propagation := "rprivate" + if m.BindOptions != nil { + if p, ok := mountPropagationReverseMap[m.BindOptions.Propagation]; ok { + propagation = p + } else { + log.G(ctx).Warningf("unknown bind mount propagation, using %q", propagation) + } + } + opts = append(opts, propagation) + + s.Mounts = append(s.Mounts, specs.Mount{ + Destination: m.Target, + Type: "bind", + Source: m.Source, + Options: opts, + }) } - - s.Mounts = append(s.Mounts, mt) - continue } + return nil } - - for v := range volumes { - mt, err := c.makeAnonVolume(ctx, v) - if err != nil { - return err - } - - s.Mounts = append(s.Mounts, mt) - } - - return nil } -func (c *containerAdapter) specOpts(ctx context.Context, config *ocispec.ImageConfig) []containerd.SpecOpts { +func (c *containerAdapter) specOpts(ctx context.Context) []containerd.SpecOpts { opts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), - func(s *specs.Spec) error { - if err := c.setMounts(ctx, s, c.spec.Mounts, config.Volumes); err != nil { - return errors.Wrap(err, "failed to set mounts") - } - sort.Sort(mounts(s.Mounts)) - return nil - }, + withMounts(ctx, c.spec.Mounts), } // spec.Process.Args is config.Entrypoint + config.Cmd at this @@ -295,19 +222,6 @@ func (c *containerAdapter) create(ctx context.Context) error { return errors.New("image has not been pulled") } - cs := c.client.ContentStore() - imageStore := c.client.ImageService() - - image, err := imageStore.Get(ctx, c.image.Name()) - if err != nil { - return errors.Wrap(err, "image get") - } - - mbytes, err := content.ReadBlob(ctx, cs, image.Target.Digest) - if err != nil { - return err - } - if err := os.MkdirAll(c.dir, 0755); err != nil { return err } @@ -317,23 +231,7 @@ func (c *containerAdapter) create(ctx context.Context) error { stdout := filepath.Join(c.dir, "stdout") stderr := filepath.Join(c.dir, "stderr") - var config ocispec.Image - - var manifest ocispec.Manifest - if err := json.Unmarshal(mbytes, &manifest); err != nil { - return errors.Wrap(err, "unmarshalling image manifest") - } - - bytes, err := content.ReadBlob(ctx, cs, manifest.Config.Digest) - if err != nil { - return err - } - - if err := json.Unmarshal(bytes, &config); err != nil { - return errors.Wrap(err, "unmarshalling image config") - } - - spec, err := containerd.GenerateSpec(c.specOpts(ctx, &config.Config)...) + spec, err := containerd.GenerateSpec(c.specOpts(ctx)...) if err != nil { return err } @@ -502,7 +400,7 @@ func isUnknownContainer(err error) bool { } // For sort.Sort -type mounts []specs.Mount +type mounts []api.Mount // Len returns the number of mounts. Used in sorting. func (m mounts) Len() int { @@ -523,5 +421,5 @@ func (m mounts) Swap(i, j int) { // parts returns the number of parts in the destination of a mount. Used in sorting. func (m mounts) parts(i int) int { - return strings.Count(filepath.Clean(m[i].Destination), string(os.PathSeparator)) + return strings.Count(filepath.Clean(m[i].Target), string(os.PathSeparator)) } From e59c1319a1ffa7abdaaef99086d923d12d4ab9b5 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 15 Jun 2017 15:16:06 +0100 Subject: [PATCH 11/35] containerd: use client lib for stdio Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 71 ++++---------------------------- 1 file changed, 9 insertions(+), 62 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 0f5de790d6..b42524d03f 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -2,20 +2,16 @@ package containerd import ( "fmt" - "io" "os" "path/filepath" "sort" "strings" - "sync" - "syscall" "github.com/Sirupsen/logrus" "github.com/containerd/containerd" containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/task" - "github.com/containerd/fifo" dockermount "github.com/docker/docker/pkg/mount" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" @@ -28,6 +24,7 @@ import ( ) var ( + devNull *os.File mountPropagationReverseMap = map[api.Mount_BindOptions_MountPropagation]string{ api.MountPropagationPrivate: "private", api.MountPropagationRPrivate: "rprivate", @@ -70,48 +67,6 @@ func newContainerAdapter(client *containerd.Client, containerDir string, task *a }, nil } -// github.com/containerd/containerd cmd/ctr/utils.go, dropped stdin handling -func prepareStdio(stdout, stderr string, console bool) (wg *sync.WaitGroup, err error) { - wg = &sync.WaitGroup{} - ctx := context.Background() - - f, err := fifo.OpenFifo(ctx, stdout, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700) - if err != nil { - return nil, err - } - defer func(c io.Closer) { - if err != nil { - c.Close() - } - }(f) - wg.Add(1) - go func(r io.ReadCloser) { - io.Copy(os.Stdout, r) - r.Close() - wg.Done() - }(f) - - f, err = fifo.OpenFifo(ctx, stderr, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700) - if err != nil { - return nil, err - } - defer func(c io.Closer) { - if err != nil { - c.Close() - } - }(f) - if !console { - wg.Add(1) - go func(r io.ReadCloser) { - io.Copy(os.Stderr, r) - r.Close() - wg.Done() - }(f) - } - - return wg, nil -} - func (c *containerAdapter) pullImage(ctx context.Context) error { image, err := c.client.Pull(ctx, c.spec.Image, containerd.WithPullUnpack) if err != nil { @@ -226,19 +181,17 @@ func (c *containerAdapter) create(ctx context.Context) error { return err } - // TODO(ijc) support ControllerLogs interface - stdin := "/dev/null" - stdout := filepath.Join(c.dir, "stdout") - stderr := filepath.Join(c.dir, "stderr") - spec, err := containerd.GenerateSpec(c.specOpts(ctx)...) if err != nil { return err } - _, err = prepareStdio(stdout, stderr, spec.Process.Terminal) - if err != nil { - return err + // TODO(ijc) Consider an addition to container library which + // directly attaches stdin to /dev/null. + if devNull == nil { + if devNull, err = os.Open(os.DevNull); err != nil { + return errors.Wrap(err, "opening null device") + } } c.container, err = c.client.NewContainer(ctx, c.name, @@ -248,14 +201,8 @@ func (c *containerAdapter) create(ctx context.Context) error { return errors.Wrap(err, "creating container") } - io := func() (*containerd.IO, error) { - return &containerd.IO{ - Stdin: stdin, - Stdout: stdout, - Stderr: stderr, - Terminal: spec.Process.Terminal, - }, nil - } + // TODO(ijc) support ControllerLogs interface. + io := containerd.NewIOWithTerminal(devNull, os.Stdout, os.Stderr, spec.Process.Terminal) c.task, err = c.container.NewTask(ctx, io) if err != nil { From a0548edc60f1d08f269d3b91c32b6fd8a7511620 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 15 Jun 2017 15:26:12 +0100 Subject: [PATCH 12/35] containerd: Inline specOpts into create It is so simple now a separate function is not that useful. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index b42524d03f..f9bf50b4ea 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -147,8 +147,16 @@ func withMounts(ctx context.Context, ms []api.Mount) containerd.SpecOpts { } } -func (c *containerAdapter) specOpts(ctx context.Context) []containerd.SpecOpts { - opts := []containerd.SpecOpts{ +func (c *containerAdapter) create(ctx context.Context) error { + if c.image == nil { + return errors.New("image has not been pulled") + } + + if err := os.MkdirAll(c.dir, 0755); err != nil { + return err + } + + specOpts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), withMounts(ctx, c.spec.Mounts), } @@ -161,27 +169,15 @@ func (c *containerAdapter) specOpts(ctx context.Context) []containerd.SpecOpts { // TODO(ijc) Improve this if len(c.spec.Command) > 0 { args := append(c.spec.Command, c.spec.Args...) - opts = append(opts, containerd.WithProcessArgs(args...)) + specOpts = append(specOpts, containerd.WithProcessArgs(args...)) } else { - opts = append(opts, func(s *specs.Spec) error { + specOpts = append(specOpts, func(s *specs.Spec) error { s.Process.Args = append(s.Process.Args, c.spec.Args...) return nil }) } - return opts -} - -func (c *containerAdapter) create(ctx context.Context) error { - if c.image == nil { - return errors.New("image has not been pulled") - } - - if err := os.MkdirAll(c.dir, 0755); err != nil { - return err - } - - spec, err := containerd.GenerateSpec(c.specOpts(ctx)...) + spec, err := containerd.GenerateSpec(specOpts...) if err != nil { return err } From 60883cca60825185e3fe4f77c22cd670bd1400d0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 15 Jun 2017 16:47:45 +0100 Subject: [PATCH 13/35] containerd: Drop container specific directory Now that rootfs and stdio are handled by containerd there is no need for this. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 12 ++---------- agent/exec/containerd/controller.go | 4 ++-- agent/exec/containerd/executor.go | 9 ++------- cmd/swarmd/main.go | 2 +- 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index f9bf50b4ea..69e6c7eb16 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -42,7 +42,6 @@ type containerAdapter struct { client *containerd.Client spec *api.ContainerSpec secrets exec.SecretGetter - dir string name string image containerd.Image // Pulled image container containerd.Container @@ -50,19 +49,16 @@ type containerAdapter struct { deleteResponse *execution.DeleteResponse } -func newContainerAdapter(client *containerd.Client, containerDir string, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { +func newContainerAdapter(client *containerd.Client, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { spec := task.Spec.GetContainer() if spec == nil { return nil, exec.ErrRuntimeUnsupported } - dir := filepath.Join(containerDir, task.ID) - return &containerAdapter{ client: client, spec: spec, secrets: secrets, - dir: dir, name: naming.Task(task), }, nil } @@ -152,10 +148,6 @@ func (c *containerAdapter) create(ctx context.Context) error { return errors.New("image has not been pulled") } - if err := os.MkdirAll(c.dir, 0755); err != nil { - return err - } - specOpts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), withMounts(ctx, c.spec.Mounts), @@ -329,7 +321,7 @@ func (c *containerAdapter) remove(ctx context.Context) error { "ID": c.name, }) l.Debug("Remove") - return os.RemoveAll(c.dir) + return nil } func isContainerCreateNameConflict(err error) bool { diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 759122e017..932d12f458 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -26,8 +26,8 @@ type controller struct { var _ exec.Controller = &controller{} -func newController(client *containerd.Client, containerDir string, task *api.Task, secrets exec.SecretGetter) (exec.Controller, error) { - adapter, err := newContainerAdapter(client, containerDir, task, secrets) +func newController(client *containerd.Client, task *api.Task, secrets exec.SecretGetter) (exec.Controller, error) { + adapter, err := newContainerAdapter(client, task, secrets) if err != nil { return nil, err } diff --git a/agent/exec/containerd/executor.go b/agent/exec/containerd/executor.go index 60b07e4b05..9a485f9538 100644 --- a/agent/exec/containerd/executor.go +++ b/agent/exec/containerd/executor.go @@ -2,7 +2,6 @@ package containerd import ( "os" - "path/filepath" "runtime" "github.com/containerd/containerd" @@ -20,13 +19,12 @@ type executor struct { client *containerd.Client secrets exec.SecretsManager genericResources []*api.GenericResource - containerDir string } var _ exec.Executor = &executor{} // NewExecutor returns an executor using the given containerd control socket -func NewExecutor(sock, stateDir string, genericResources []*api.GenericResource) (exec.Executor, error) { +func NewExecutor(sock string, genericResources []*api.GenericResource) (exec.Executor, error) { // TODO(ijc), configurable namespace. // TODO(ijc), default to swarmd? client, err := containerd.New(sock, containerd.WithDefaultNamespace("default")) @@ -34,13 +32,10 @@ func NewExecutor(sock, stateDir string, genericResources []*api.GenericResource) return nil, errors.Wrap(err, "creating containerd client") } - containerDir := filepath.Join(stateDir, "containers") - return &executor{ client: client, secrets: secrets.NewManager(), genericResources: genericResources, - containerDir: containerDir, }, nil } @@ -83,7 +78,7 @@ func (e *executor) Configure(ctx context.Context, node *api.Node) error { // Controller returns a docker container controller. func (e *executor) Controller(t *api.Task) (exec.Controller, error) { - ctlr, err := newController(e.client, e.containerDir, t, secrets.Restrict(e.secrets, t)) + ctlr, err := newController(e.client, t, secrets.Restrict(e.secrets, t)) if err != nil { return nil, err } diff --git a/cmd/swarmd/main.go b/cmd/swarmd/main.go index 280699e173..b957de517a 100644 --- a/cmd/swarmd/main.go +++ b/cmd/swarmd/main.go @@ -182,7 +182,7 @@ var ( if containerdAddr != "" { logrus.Infof("Using containerd via %s", containerdAddr) - executor, err = containerd.NewExecutor(containerdAddr, stateDir, resources) + executor, err = containerd.NewExecutor(containerdAddr, resources) if err != nil { return err } From a7fdc45eed80f967bd1dd7b0cd650672af431aa7 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 15:17:15 +0100 Subject: [PATCH 14/35] containerd: rename adapter.create to adapter.prepare It is called from controller.Prepare and this seems to better reflect its purpose. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 2 +- agent/exec/containerd/controller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 69e6c7eb16..57b2f0037e 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -143,7 +143,7 @@ func withMounts(ctx context.Context, ms []api.Mount) containerd.SpecOpts { } } -func (c *containerAdapter) create(ctx context.Context) error { +func (c *containerAdapter) prepare(ctx context.Context) error { if c.image == nil { return errors.New("image has not been pulled") } diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 932d12f458..50801027a5 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -134,7 +134,7 @@ func (r *controller) Prepare(ctx context.Context) error { } } - if err := r.adapter.create(ctx); err != nil { + if err := r.adapter.prepare(ctx); err != nil { if isContainerCreateNameConflict(err) { if _, err := r.adapter.inspect(ctx); err != nil { return err From e41100de4a91f12ae488b18cd5214e24209fe1ed Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 15:23:31 +0100 Subject: [PATCH 15/35] containerd: Check that the adapter has been "prepared" at entry points Here "prepared" means the prepared() method has been called and therefore both c.container and c.task can be assumed to be non-nil. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 57b2f0037e..54e536f81f 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -25,6 +25,7 @@ import ( var ( devNull *os.File + errAdapterNotPrepared = errors.New("container adapter not prepared") mountPropagationReverseMap = map[api.Mount_BindOptions_MountPropagation]string{ api.MountPropagationPrivate: "private", api.MountPropagationRPrivate: "rprivate", @@ -143,7 +144,14 @@ func withMounts(ctx context.Context, ms []api.Mount) containerd.SpecOpts { } } +func (c *containerAdapter) isPrepared() bool { + return c.container != nil && c.task != nil +} + func (c *containerAdapter) prepare(ctx context.Context) error { + if c.isPrepared() { + return errors.New("adapter already prepared") + } if c.image == nil { return errors.New("image has not been pulled") } @@ -201,6 +209,10 @@ func (c *containerAdapter) prepare(ctx context.Context) error { } func (c *containerAdapter) start(ctx context.Context) error { + if !c.isPrepared() { + return errAdapterNotPrepared + } + tasks := c.client.TaskService() _, err := tasks.Start(ctx, &execution.StartRequest{ @@ -225,6 +237,10 @@ func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan t // A chan struct{} is returned that will be closed if the event processing // fails and needs to be restarted. func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) (<-chan task.Event, <-chan struct{}, error) { + if !c.isPrepared() { + return nil, nil, errAdapterNotPrepared + } + l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -271,6 +287,10 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) } func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { + if !c.isPrepared() { + return task.Task{}, errAdapterNotPrepared + } + tasks := c.client.TaskService() rsp, err := tasks.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) if err != nil { @@ -280,6 +300,10 @@ func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { } func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { + if !c.isPrepared() { + return 0, errAdapterNotPrepared + } + l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -309,6 +333,10 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { } func (c *containerAdapter) terminate(ctx context.Context) error { + if !c.isPrepared() { + return errAdapterNotPrepared + } + l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) @@ -317,6 +345,10 @@ func (c *containerAdapter) terminate(ctx context.Context) error { } func (c *containerAdapter) remove(ctx context.Context) error { + if !c.isPrepared() { + return errAdapterNotPrepared + } + l := log.G(ctx).WithFields(logrus.Fields{ "ID": c.name, }) From 21b8ccf4ce65592d849ceafcd5343d7a6c5a412b Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 15:30:44 +0100 Subject: [PATCH 16/35] containerd: Ensure container is destroyed on prepare failure Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 54e536f81f..3c3b8b2f67 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -156,6 +156,10 @@ func (c *containerAdapter) prepare(ctx context.Context) error { return errors.New("image has not been pulled") } + l := log.G(ctx).WithFields(logrus.Fields{ + "ID": c.name, + }) + specOpts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), withMounts(ctx, c.spec.Mounts), @@ -202,6 +206,12 @@ func (c *containerAdapter) prepare(ctx context.Context) error { c.task, err = c.container.NewTask(ctx, io) if err != nil { + // Destroy the container we created above, but + // propagate the original error. + if err2 := c.container.Delete(ctx); err2 != nil { + l.WithError(err2).Error("failed to delete container on prepare failure") + } + c.container = nil return errors.Wrap(err, "creating task") } From 90c3b22cc9a7df7b2187b82dd22284d752629859 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 15:50:43 +0100 Subject: [PATCH 17/35] containerd: Rediscover existing containers and tasks This potentially allows callers to try and cleanup partial state. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 3c3b8b2f67..e5f0f3c745 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -21,6 +21,7 @@ import ( "github.com/pkg/errors" "golang.org/x/net/context" "google.golang.org/grpc" + "google.golang.org/grpc/codes" ) var ( @@ -56,12 +57,55 @@ func newContainerAdapter(client *containerd.Client, task *api.Task, secrets exec return nil, exec.ErrRuntimeUnsupported } - return &containerAdapter{ + c := &containerAdapter{ client: client, spec: spec, secrets: secrets, name: naming.Task(task), - }, nil + } + + if err := c.reattach(context.Background()); err != nil { + return nil, err + } + + return c, nil +} + +// reattaches to an existing container. If the container is found but +// the task is missing then still succeeds, allowing subsequent use of +// c.delete() +func (c *containerAdapter) reattach(ctx context.Context) error { + container, err := c.client.LoadContainer(ctx, c.name) + if err != nil { + if grpc.Code(err) == codes.NotFound { + c.log(ctx).Debug("reattach: container not found") + return nil + } + + return errors.Wrap(err, "reattach: loading container") + } + c.log(ctx).Debug("reattach: loaded container") + c.container = container + + // TODO(ijc) Consider an addition to container library which + // directly attaches stdin to /dev/null. + if devNull == nil { + if devNull, err = os.Open(os.DevNull); err != nil { + return errors.Wrap(err, "reattach: opening null device") + } + } + + task, err := container.Task(ctx, containerd.WithAttach(devNull, os.Stdout, os.Stderr)) + if err != nil { + if err == containerd.ErrNoRunningTask { + c.log(ctx).WithError(err).Info("reattach: no running task") + return nil + } + return errors.Wrap(err, "reattach: reattaching task") + } + c.task = task + c.log(ctx).Debug("reattach: successful") + return nil } func (c *containerAdapter) pullImage(ctx context.Context) error { From bf4ee9814433142811494b0464d3041e51f6de35 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 15:52:59 +0100 Subject: [PATCH 18/35] containerd: consolidate production of the logger Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 44 ++++++++++++-------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index e5f0f3c745..0d02743b65 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -108,6 +108,12 @@ func (c *containerAdapter) reattach(ctx context.Context) error { return nil } +func (c *containerAdapter) log(ctx context.Context) *logrus.Entry { + return log.G(ctx).WithFields(logrus.Fields{ + "ID": c.name, + }) +} + func (c *containerAdapter) pullImage(ctx context.Context) error { image, err := c.client.Pull(ctx, c.spec.Image, containerd.WithPullUnpack) if err != nil { @@ -200,10 +206,6 @@ func (c *containerAdapter) prepare(ctx context.Context) error { return errors.New("image has not been pulled") } - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, - }) - specOpts := []containerd.SpecOpts{ containerd.WithImageConfig(ctx, c.image), withMounts(ctx, c.spec.Mounts), @@ -253,7 +255,7 @@ func (c *containerAdapter) prepare(ctx context.Context) error { // Destroy the container we created above, but // propagate the original error. if err2 := c.container.Delete(ctx); err2 != nil { - l.WithError(err2).Error("failed to delete container on prepare failure") + c.log(ctx).WithError(err2).Error("failed to delete container on prepare failure") } c.container = nil return errors.Wrap(err, "creating task") @@ -295,10 +297,6 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) return nil, nil, errAdapterNotPrepared } - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, - }) - // TODO(stevvooe): Move this to a single, global event dispatch. For // now, we create a connection per container. var ( @@ -306,12 +304,12 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) closed = make(chan struct{}) ) - l.Debugf("waiting on events") + c.log(ctx).Debugf("waiting on events") tasks := c.client.TaskService() cl, err := tasks.Events(ctx, &execution.EventsRequest{}, opts...) if err != nil { - l.WithError(err).Errorf("failed to start event stream") + c.log(ctx).WithError(err).Errorf("failed to start event stream") return nil, nil, err } @@ -321,11 +319,11 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) for { evt, err := cl.Recv() if err != nil { - l.WithError(err).Error("fatal error from events stream") + c.log(ctx).WithError(err).Error("fatal error from events stream") return } if evt.ID != c.name { - l.Debugf("Event for a different container %s", evt.ID) + c.log(ctx).Debugf("Event for a different container %s", evt.ID) continue } @@ -358,20 +356,16 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { return 0, errAdapterNotPrepared } - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, - }) - if c.deleteResponse == nil { var err error - l.Debug("Deleting") + c.log(ctx).Debug("Deleting") tasks := c.client.TaskService() rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) if err != nil { return 0, err } - l.Debugf("Status=%d", rsp.ExitStatus) + c.log(ctx).Debugf("Status=%d", rsp.ExitStatus) c.deleteResponse = rsp containers := c.client.ContainerService() @@ -379,7 +373,7 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { ID: c.name, }) if err != nil { - l.WithError(err).Warnf("failed to delete container") + c.log(ctx).WithError(err).Warnf("failed to delete container") } } @@ -391,10 +385,7 @@ func (c *containerAdapter) terminate(ctx context.Context) error { return errAdapterNotPrepared } - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, - }) - l.Debug("Terminate") + c.log(ctx).Debug("Terminate") return errors.New("terminate not implemented") } @@ -403,10 +394,7 @@ func (c *containerAdapter) remove(ctx context.Context) error { return errAdapterNotPrepared } - l := log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, - }) - l.Debug("Remove") + c.log(ctx).Debug("Remove") return nil } From 3a03878cfbda76df2c5610348877cb6b286a1bd6 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 16:09:45 +0100 Subject: [PATCH 19/35] containerd: Avoid direct use of container api, use methods on container Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 0d02743b65..30de2a2efa 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -9,7 +9,6 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/containerd" - containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/task" dockermount "github.com/docker/docker/pkg/mount" @@ -368,11 +367,8 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { c.log(ctx).Debugf("Status=%d", rsp.ExitStatus) c.deleteResponse = rsp - containers := c.client.ContainerService() - _, err = containers.Delete(ctx, &containersapi.DeleteContainerRequest{ - ID: c.name, - }) - if err != nil { + // TODO(ijc) this should be moved to the remove method. + if err := c.container.Delete(ctx); err != nil { c.log(ctx).WithError(err).Warnf("failed to delete container") } } From 80c76b29df943e7fd137b6ad0d0e04a166720a01 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 16:18:50 +0100 Subject: [PATCH 20/35] containerd: Use task.Start instead of open coding Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 30de2a2efa..656f6c3fdd 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -267,13 +267,8 @@ func (c *containerAdapter) start(ctx context.Context) error { if !c.isPrepared() { return errAdapterNotPrepared } - - tasks := c.client.TaskService() - - _, err := tasks.Start(ctx, &execution.StartRequest{ - ContainerID: c.name, - }) - return err + err := c.task.Start(ctx) + return errors.Wrap(err, "starting") } func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan task.Event, <-chan error, error) { From 16fb22bd27b4819d63e187910fb17614dffc7d8f Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 20 Jun 2017 16:09:45 +0100 Subject: [PATCH 21/35] containerd: move the container delete to the remove method This is the more correct location for it. However this exposes an oddity which is that Controller.Wait() is shutting down the containers and hence now must also remove them as well. Add a TODO to figure out why .Shutdown and .Remove appear to not be getting called otherwise. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 13 ++++++------- agent/exec/containerd/controller.go | 6 ++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 656f6c3fdd..f5e9df6196 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -361,11 +361,6 @@ func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { } c.log(ctx).Debugf("Status=%d", rsp.ExitStatus) c.deleteResponse = rsp - - // TODO(ijc) this should be moved to the remove method. - if err := c.container.Delete(ctx); err != nil { - c.log(ctx).WithError(err).Warnf("failed to delete container") - } } return c.deleteResponse.ExitStatus, nil @@ -381,12 +376,16 @@ func (c *containerAdapter) terminate(ctx context.Context) error { } func (c *containerAdapter) remove(ctx context.Context) error { - if !c.isPrepared() { + // Unlike most other entry points we don't use c.isPrepared + // here so that we can clean up a container which was + // partially reattached (via c.attach). + if c.container == nil { return errAdapterNotPrepared } c.log(ctx).Debug("Remove") - return nil + err := c.container.Delete(ctx) + return errors.Wrap(err, "removing container") } func isContainerCreateNameConflict(err error) bool { diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 50801027a5..ac079941d6 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -195,12 +195,18 @@ func (r *controller) Wait(ctx context.Context) error { return errors.Wrap(err, "inspecting container failed") } + // TODO(ijc) this shouldn't be needed here, figure out why + // .shutdown/.remove are not being called otherwise. shutdownWithExitStatus := func(reason string) error { exitStatus, err := r.adapter.shutdown(ctx) if err != nil { return err } log.G(ctx).Errorf("EXIT STATUS %v", exitStatus) + if err := r.adapter.remove(ctx); err != nil { + // Just log it, report the exit status + log.G(ctx).WithError(err).Info("remove after wait failed") + } return makeExitError(exitStatus, reason) } switch ctnr.Status { From 112d617d70a0bf116495381ace15605126b34d8d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 14:15:14 +0100 Subject: [PATCH 22/35] containerd: log tag which fits in with the others Existing tags as "node.id" and "task.id" etc. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index f5e9df6196..ca866b56d8 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -109,7 +109,7 @@ func (c *containerAdapter) reattach(ctx context.Context) error { func (c *containerAdapter) log(ctx context.Context) *logrus.Entry { return log.G(ctx).WithFields(logrus.Fields{ - "ID": c.name, + "container.id": c.name, }) } From 1bcaaad7c538d00a60fa2c91dc7fc49d270522df Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:01:03 +0100 Subject: [PATCH 23/35] containerd: Do not shutdown task on OOM It's just an event, not a fatal one (at least not at this level) Signed-off-by: Ian Campbell --- agent/exec/containerd/controller.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index ac079941d6..5a279ed508 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -231,9 +231,7 @@ func (r *controller) Wait(ctx context.Context) error { switch event.Type { case task.Event_EXIT: return shutdownWithExitStatus("") - case task.Event_OOM: - return shutdownWithExitStatus("Container OOMd") - case task.Event_CREATE, task.Event_START, task.Event_EXEC_ADDED, task.Event_PAUSED: + case task.Event_OOM, task.Event_CREATE, task.Event_START, task.Event_EXEC_ADDED, task.Event_PAUSED: continue default: return errors.Errorf("Unknown event type %s\n", event.Type.String()) From 236d1a677827c3e8983179d9e71633c959c373d0 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:20:48 +0100 Subject: [PATCH 24/35] containerd: Only return an error from adapter.shutdown() Dropping the exit code. The exitError type implements the ExitCoder interface so callers can extract it if they want. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 33 ++++++++++++++------------ agent/exec/containerd/controller.go | 36 +++++++++++++---------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index ca866b56d8..9f1cff4995 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -40,14 +40,14 @@ var ( // are mostly naked calls to the client API, seeded with information from // containerConfig. type containerAdapter struct { - client *containerd.Client - spec *api.ContainerSpec - secrets exec.SecretGetter - name string - image containerd.Image // Pulled image - container containerd.Container - task containerd.Task - deleteResponse *execution.DeleteResponse + client *containerd.Client + spec *api.ContainerSpec + secrets exec.SecretGetter + name string + image containerd.Image // Pulled image + container containerd.Container + task containerd.Task + exitStatus error } func newContainerAdapter(client *containerd.Client, task *api.Task, secrets exec.SecretGetter) (*containerAdapter, error) { @@ -345,25 +345,28 @@ func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { return *rsp.Task, nil } -func (c *containerAdapter) shutdown(ctx context.Context) (uint32, error) { +func (c *containerAdapter) shutdown(ctx context.Context) error { if !c.isPrepared() { - return 0, errAdapterNotPrepared + return errAdapterNotPrepared } - if c.deleteResponse == nil { + if c.exitStatus == nil { var err error c.log(ctx).Debug("Deleting") tasks := c.client.TaskService() rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) if err != nil { - return 0, err + c.log(ctx).WithError(err).Debug("Task.Delete failed") + return err } - c.log(ctx).Debugf("Status=%d", rsp.ExitStatus) - c.deleteResponse = rsp + c.log(ctx).Debugf("Task.Delete success, status=%d", rsp.ExitStatus) + c.exitStatus = makeExitError(rsp.ExitStatus, "") + } else { + c.log(ctx).Debug("Task already deleted, error=%s", c.exitStatus) } - return c.deleteResponse.ExitStatus, nil + return c.exitStatus } func (c *containerAdapter) terminate(ctx context.Context) error { diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 5a279ed508..57b32a66c0 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -57,14 +57,16 @@ func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus, switch ctnr.Status { case task.StatusStopped: - exitStatus, err := r.adapter.shutdown(ctx) - if err != nil { - return nil, err + err := r.adapter.shutdown(ctx) + if ec, ok := err.(exec.ExitCoder); ok { + status.ExitCode = int32(ec.ExitCode()) + return status, nil } - status.ExitCode = int32(exitStatus) + return status, err + default: + return status, nil } - return status, err } // Update takes a recent task update and applies it to the container. @@ -197,21 +199,17 @@ func (r *controller) Wait(ctx context.Context) error { // TODO(ijc) this shouldn't be needed here, figure out why // .shutdown/.remove are not being called otherwise. - shutdownWithExitStatus := func(reason string) error { - exitStatus, err := r.adapter.shutdown(ctx) - if err != nil { - return err - } - log.G(ctx).Errorf("EXIT STATUS %v", exitStatus) - if err := r.adapter.remove(ctx); err != nil { + shutdownWithExitStatus := func() error { + err := r.adapter.shutdown(ctx) + if err2 := r.adapter.remove(ctx); err != nil { // Just log it, report the exit status - log.G(ctx).WithError(err).Info("remove after wait failed") + log.G(ctx).WithError(err2).Info("remove after wait failed") } - return makeExitError(exitStatus, reason) + return err } switch ctnr.Status { case task.StatusStopped: - return shutdownWithExitStatus("") + return shutdownWithExitStatus() } // We do not disable FailFast for this initial call (like we @@ -226,11 +224,9 @@ func (r *controller) Wait(ctx context.Context) error { for { select { case event := <-eventq: - log.G(ctx).Debugf("Event: %v", event) - switch event.Type { case task.Event_EXIT: - return shutdownWithExitStatus("") + return shutdownWithExitStatus() case task.Event_OOM, task.Event_CREATE, task.Event_START, task.Event_EXEC_ADDED, task.Event_PAUSED: continue default: @@ -256,7 +252,7 @@ func (r *controller) Wait(ctx context.Context) error { } switch ctnr.Status { case task.StatusStopped: - return shutdownWithExitStatus("container had exited after event stream restart") + return shutdownWithExitStatus() } case <-ctx.Done(): @@ -279,7 +275,7 @@ func (r *controller) Shutdown(ctx context.Context) error { r.cancelPull() } - if _, err := r.adapter.shutdown(ctx); err != nil { + if err := r.adapter.shutdown(ctx); err != nil { if isUnknownContainer(err) { return nil } From 585b3b19ff1d3494340dd01806bca9e3871713bb Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:32:11 +0100 Subject: [PATCH 25/35] containerd: Define a local struct as result of adapter.inspect() The containerd Task struct contains a lot of info which callers are not interested in and which is not provided by the Task.Status() method, which we will shortly switch to in preference to an open coded InfoRequest gRPC. Belt-and-braces checks that ID and Pid match will go away as part of Task.Status switch. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 9f1cff4995..dcdbd6b2de 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -332,17 +332,36 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) return eventsq, closed, nil } -func (c *containerAdapter) inspect(ctx context.Context) (task.Task, error) { +type status struct { + ID string + Pid uint32 + Status task.Status + ExitStatus error +} + +func (c *containerAdapter) inspect(ctx context.Context) (status, error) { if !c.isPrepared() { - return task.Task{}, errAdapterNotPrepared + return status{}, errAdapterNotPrepared } tasks := c.client.TaskService() rsp, err := tasks.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) if err != nil { - return task.Task{}, err + return status{}, err + } + if rsp.Task.ID != c.container.ID() { + c.log(ctx).Errorf("inspect: container id mismatch %s %s", rsp.Task.ID, c.container.ID()) + } + if rsp.Task.Pid != c.task.Pid() { + c.log(ctx).Errorf("inspect: task pid mismatch %s %s", rsp.Task.Pid, c.task.Pid()) + } + s := status{ + ID: c.container.ID(), + Pid: c.task.Pid(), + Status: rsp.Task.Status, + ExitStatus: c.exitStatus, } - return *rsp.Task, nil + return s, nil } func (c *containerAdapter) shutdown(ctx context.Context) error { From a751488d254360332481e00041ced3b5bcfce4d2 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:37:58 +0100 Subject: [PATCH 26/35] containerd: Use Task.Status() instead of opencoded Info() Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 13 +++---------- agent/exec/containerd/controller.go | 8 ++++---- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index dcdbd6b2de..46e9da26fa 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -335,7 +335,7 @@ func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) type status struct { ID string Pid uint32 - Status task.Status + Status containerd.TaskStatus ExitStatus error } @@ -344,21 +344,14 @@ func (c *containerAdapter) inspect(ctx context.Context) (status, error) { return status{}, errAdapterNotPrepared } - tasks := c.client.TaskService() - rsp, err := tasks.Info(ctx, &execution.InfoRequest{ContainerID: c.name}) + ts, err := c.task.Status(ctx) if err != nil { return status{}, err } - if rsp.Task.ID != c.container.ID() { - c.log(ctx).Errorf("inspect: container id mismatch %s %s", rsp.Task.ID, c.container.ID()) - } - if rsp.Task.Pid != c.task.Pid() { - c.log(ctx).Errorf("inspect: task pid mismatch %s %s", rsp.Task.Pid, c.task.Pid()) - } s := status{ ID: c.container.ID(), Pid: c.task.Pid(), - Status: rsp.Task.Status, + Status: ts, ExitStatus: c.exitStatus, } return s, nil diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 57b32a66c0..c19bca8517 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -56,7 +56,7 @@ func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus, } switch ctnr.Status { - case task.StatusStopped: + case containerd.Stopped: err := r.adapter.shutdown(ctx) if ec, ok := err.(exec.ExitCoder); ok { status.ExitCode = int32(ec.ExitCode()) @@ -170,7 +170,7 @@ func (r *controller) Start(ctx context.Context) error { // // TODO(stevvooe): This is very racy. While reading inspect, another could // start the process and we could end up starting it twice. - if ctnr.Status != task.StatusCreated { + if ctnr.Status != containerd.Created { return exec.ErrTaskStarted } @@ -208,7 +208,7 @@ func (r *controller) Wait(ctx context.Context) error { return err } switch ctnr.Status { - case task.StatusStopped: + case containerd.Stopped: return shutdownWithExitStatus() } @@ -251,7 +251,7 @@ func (r *controller) Wait(ctx context.Context) error { return errors.Wrap(err, "inspecting container on event restart failed") } switch ctnr.Status { - case task.StatusStopped: + case containerd.Stopped: return shutdownWithExitStatus() } From f2699f884e1a2724b3b55097ce0ea190f2b7dfe7 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:43:14 +0100 Subject: [PATCH 27/35] containerd: Stop shutting down the container in ContainerStatus() It's unexpected and unnecessary, the orchestrator will call the Shutdown() or Remove() methods as needed. Signed-off-by: Ian Campbell --- agent/exec/containerd/controller.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index c19bca8517..694528f3b4 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -55,18 +55,11 @@ func (r *controller) ContainerStatus(ctx context.Context) (*api.ContainerStatus, PID: int32(ctnr.Pid), } - switch ctnr.Status { - case containerd.Stopped: - err := r.adapter.shutdown(ctx) - if ec, ok := err.(exec.ExitCoder); ok { - status.ExitCode = int32(ec.ExitCode()) - return status, nil - } - return status, err - default: - return status, nil + if ec, ok := ctnr.ExitStatus.(exec.ExitCoder); ok { + status.ExitCode = int32(ec.ExitCode()) } + return status, nil } // Update takes a recent task update and applies it to the container. From 8129a34504c736b96ad115d27663d73f6c0a2ddf Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 15:55:33 +0100 Subject: [PATCH 28/35] containerd: Do not shutdown container in Wait() method Signed-off-by: Ian Campbell --- agent/exec/containerd/controller.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 694528f3b4..61f99460d2 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -190,19 +190,9 @@ func (r *controller) Wait(ctx context.Context) error { return errors.Wrap(err, "inspecting container failed") } - // TODO(ijc) this shouldn't be needed here, figure out why - // .shutdown/.remove are not being called otherwise. - shutdownWithExitStatus := func() error { - err := r.adapter.shutdown(ctx) - if err2 := r.adapter.remove(ctx); err != nil { - // Just log it, report the exit status - log.G(ctx).WithError(err2).Info("remove after wait failed") - } - return err - } switch ctnr.Status { case containerd.Stopped: - return shutdownWithExitStatus() + return ctnr.ExitStatus } // We do not disable FailFast for this initial call (like we @@ -219,7 +209,7 @@ func (r *controller) Wait(ctx context.Context) error { case event := <-eventq: switch event.Type { case task.Event_EXIT: - return shutdownWithExitStatus() + return makeExitError(event.ExitStatus, "") case task.Event_OOM, task.Event_CREATE, task.Event_START, task.Event_EXEC_ADDED, task.Event_PAUSED: continue default: @@ -245,7 +235,7 @@ func (r *controller) Wait(ctx context.Context) error { } switch ctnr.Status { case containerd.Stopped: - return shutdownWithExitStatus() + return ctnr.ExitStatus } case <-ctx.Done(): From cf2fe62f05a184424c8bbb8232078e2712e51792 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 16:23:06 +0100 Subject: [PATCH 29/35] containerd: Make adapter.shutdown() non-idempotent Idempotency is not a requirement of the interface, just let it return failed (presumably some sort of "already dead" or "not found" type error). Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 46e9da26fa..40a9f995ba 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -362,21 +362,16 @@ func (c *containerAdapter) shutdown(ctx context.Context) error { return errAdapterNotPrepared } - if c.exitStatus == nil { - var err error - c.log(ctx).Debug("Deleting") - - tasks := c.client.TaskService() - rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) - if err != nil { - c.log(ctx).WithError(err).Debug("Task.Delete failed") - return err - } - c.log(ctx).Debugf("Task.Delete success, status=%d", rsp.ExitStatus) - c.exitStatus = makeExitError(rsp.ExitStatus, "") - } else { - c.log(ctx).Debug("Task already deleted, error=%s", c.exitStatus) + var err error + + tasks := c.client.TaskService() + rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) + if err != nil { + c.log(ctx).WithError(err).Debug("Task.Delete failed") + return err } + c.log(ctx).Debugf("Task.Delete success, status=%d", rsp.ExitStatus) + c.exitStatus = makeExitError(rsp.ExitStatus, "") return c.exitStatus } From 3b814d9d8a11de1cb3a1e9b70fc67fe1867476fb Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 21 Jun 2017 16:54:41 +0100 Subject: [PATCH 30/35] containerd: Use Task.Delete() in adapter.shutdown() This means we need to send the signals ourselves, since Delete waits for the IO to complete. Previously we were just lucky (and probably leaking some goroutines). Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 81 ++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 40a9f995ba..d7f07a7dbf 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -6,16 +6,20 @@ import ( "path/filepath" "sort" "strings" + "syscall" + "time" "github.com/Sirupsen/logrus" "github.com/containerd/containerd" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/types/task" dockermount "github.com/docker/docker/pkg/mount" + "github.com/docker/docker/pkg/signal" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/api/naming" "github.com/docker/swarmkit/log" + gogotypes "github.com/gogo/protobuf/types" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "golang.org/x/net/context" @@ -362,18 +366,77 @@ func (c *containerAdapter) shutdown(ctx context.Context) error { return errAdapterNotPrepared } - var err error + var ( + sig syscall.Signal + timeout = time.Duration(10 * time.Second) + err error + ) - tasks := c.client.TaskService() - rsp, err := tasks.Delete(ctx, &execution.DeleteRequest{ContainerID: c.name}) - if err != nil { - c.log(ctx).WithError(err).Debug("Task.Delete failed") - return err + if c.spec.StopSignal != "" { + if sig, err = signal.ParseSignal(c.spec.StopSignal); err != nil { + sig = syscall.SIGTERM + c.log(ctx).WithError(err).Errorf("unknown StopSignal, using %q", sig) + } + } else { + sig = syscall.SIGTERM + c.log(ctx).Infof("no StopSignal given, using %q", sig) + } + + if c.spec.StopGracePeriod != nil { + timeout, _ = gogotypes.DurationFromProto(c.spec.StopGracePeriod) + } + + deleteErr := make(chan error, 1) + deleteCtx, deleteCancel := context.WithCancel(ctx) + defer deleteCancel() + + go func(ctx context.Context, ch chan error) { + status, err := c.task.Delete(ctx) + if err != nil { + c.log(ctx).WithError(err).Debug("Task.Delete failed") + ch <- err + } + c.log(ctx).Debugf("Task.Delete success, status=%d", status) + ch <- makeExitError(status, "") + }(deleteCtx, deleteErr) + + c.log(ctx).Debugf("Killing task with %q signal", sig) + if err := c.task.Kill(ctx, sig); err != nil { + return errors.Wrapf(err, "killing task with %q", sig) + } + + select { + case c.exitStatus = <-deleteErr: + return c.exitStatus + case <-ctx.Done(): + return ctx.Err() + case <-time.After(timeout): + c.log(ctx).Infof("Task did not exit after %s", timeout) + // Fall through + } + + if sig == syscall.SIGKILL { + // We've tried as hard as we can. + return errors.New("task is unkillable") + } + + // Bring out the big guns + sig = syscall.SIGKILL + c.log(ctx).Debugf("Killing task harder with %q signal", sig) + if err := c.task.Kill(ctx, sig); err != nil { + return errors.Wrapf(err, "killing task with %q", sig) + } + + select { + case c.exitStatus = <-deleteErr: + return c.exitStatus + case <-ctx.Done(): + return ctx.Err() + case <-time.After(timeout): + c.log(ctx).Infof("Task did exit after %s", timeout) + return errors.New("task is unkillable") } - c.log(ctx).Debugf("Task.Delete success, status=%d", rsp.ExitStatus) - c.exitStatus = makeExitError(rsp.ExitStatus, "") - return c.exitStatus } func (c *containerAdapter) terminate(ctx context.Context) error { From a214aeb5ce75b07422ef34ade03ace90ef71c0dd Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 22 Jun 2017 09:57:30 +0100 Subject: [PATCH 31/35] containerd: Use Task.Wait() rather than open coded event stream Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 63 +++------------------------ agent/exec/containerd/controller.go | 66 ++--------------------------- 2 files changed, 10 insertions(+), 119 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index d7f07a7dbf..20ecc9c6f4 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -11,8 +11,6 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/containerd" - "github.com/containerd/containerd/api/services/execution" - "github.com/containerd/containerd/api/types/task" dockermount "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/signal" "github.com/docker/swarmkit/agent/exec" @@ -275,65 +273,16 @@ func (c *containerAdapter) start(ctx context.Context) error { return errors.Wrap(err, "starting") } -func (c *containerAdapter) eventStream(ctx context.Context, id string) (<-chan task.Event, <-chan error, error) { - - var ( - evtch = make(chan task.Event) - errch = make(chan error) - ) - - return evtch, errch, nil -} - -// events issues a call to the events API and returns a channel with all -// events. The stream of events can be shutdown by cancelling the context. -// -// A chan struct{} is returned that will be closed if the event processing -// fails and needs to be restarted. -func (c *containerAdapter) events(ctx context.Context, opts ...grpc.CallOption) (<-chan task.Event, <-chan struct{}, error) { +func (c *containerAdapter) wait(ctx context.Context) error { if !c.isPrepared() { - return nil, nil, errAdapterNotPrepared + return errAdapterNotPrepared } - - // TODO(stevvooe): Move this to a single, global event dispatch. For - // now, we create a connection per container. - var ( - eventsq = make(chan task.Event) - closed = make(chan struct{}) - ) - - c.log(ctx).Debugf("waiting on events") - - tasks := c.client.TaskService() - cl, err := tasks.Events(ctx, &execution.EventsRequest{}, opts...) + status, err := c.task.Wait(ctx) if err != nil { - c.log(ctx).WithError(err).Errorf("failed to start event stream") - return nil, nil, err + return errors.Wrap(err, "waiting") } - - go func() { - defer close(closed) - - for { - evt, err := cl.Recv() - if err != nil { - c.log(ctx).WithError(err).Error("fatal error from events stream") - return - } - if evt.ID != c.name { - c.log(ctx).Debugf("Event for a different container %s", evt.ID) - continue - } - - select { - case eventsq <- *evt: - case <-ctx.Done(): - return - } - } - }() - - return eventsq, closed, nil + // Should update c.exitStatus or not? + return makeExitError(status, "") } type status struct { diff --git a/agent/exec/containerd/controller.go b/agent/exec/containerd/controller.go index 61f99460d2..7508740265 100644 --- a/agent/exec/containerd/controller.go +++ b/agent/exec/containerd/controller.go @@ -4,13 +4,11 @@ import ( "fmt" "github.com/containerd/containerd" - "github.com/containerd/containerd/api/types/task" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" "github.com/docker/swarmkit/log" "github.com/pkg/errors" "golang.org/x/net/context" - "google.golang.org/grpc" ) type controller struct { @@ -184,66 +182,10 @@ func (r *controller) Wait(ctx context.Context) error { return err } - // check the initial state and report that. - ctnr, err := r.adapter.inspect(ctx) - if err != nil { - return errors.Wrap(err, "inspecting container failed") - } - - switch ctnr.Status { - case containerd.Stopped: - return ctnr.ExitStatus - } - - // We do not disable FailFast for this initial call (like we - // do on the retry below) since we are still halfway through - // setting up the container and if containerd goes away half - // way through we consider that a failure. - eventq, closed, err := r.adapter.events(ctx) - if err != nil { - return err - } - - for { - select { - case event := <-eventq: - switch event.Type { - case task.Event_EXIT: - return makeExitError(event.ExitStatus, "") - case task.Event_OOM, task.Event_CREATE, task.Event_START, task.Event_EXEC_ADDED, task.Event_PAUSED: - continue - default: - return errors.Errorf("Unknown event type %s\n", event.Type.String()) - } - case <-closed: - // restart! - log.G(ctx).Debugf("Restarting event stream") - // We disable FailFast for this call so that gRPC will keep - // retrying while we wait for containerd to come back. Otherwise - // a temporary glitch in the connection (e.g. a containerd restart) - // will result in the task being declared dead even though it is - // likely to be recoverable. - eventq, closed, err = r.adapter.events(ctx, grpc.FailFast(false)) - if err != nil { - return err - } - - // recheck the container state, if this fails then we may have missed a - ctnr, err := r.adapter.inspect(ctx) - if err != nil { - return errors.Wrap(err, "inspecting container on event restart failed") - } - switch ctnr.Status { - case containerd.Stopped: - return ctnr.ExitStatus - } - - case <-ctx.Done(): - return ctx.Err() - case <-r.closed: - return r.err - } - } + // TODO(ijc) HealthCheck + // TODO(ijc) Underlying wait is racy + // TODO(ijc) Underlying wait does not handle restart + return r.adapter.wait(ctx) } // Shutdown the container cleanly. From 5e209395f2038ab7ab7cd3146d8d29914b226c38 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 22 Jun 2017 12:00:23 +0100 Subject: [PATCH 32/35] containerd: Drop github.com/docker/docker/pkg/mount.MergeTmpfsOptions This function checks for valid options and for duplicates, but we have just constructed opts from a static set above and can trivially verify that everything is ok. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index 20ecc9c6f4..e5cfc40b67 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -11,7 +11,6 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/containerd" - dockermount "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/signal" "github.com/docker/swarmkit/agent/exec" "github.com/docker/swarmkit/api" @@ -150,11 +149,6 @@ func withMounts(ctx context.Context, ms []api.Mount) containerd.SpecOpts { opts = append(opts, "rw") } - opts, err := dockermount.MergeTmpfsOptions(opts) - if err != nil { - return err - } - s.Mounts = append(s.Mounts, specs.Mount{ Destination: m.Target, Type: "tmpfs", From 505f593fe33af57b44633bd0ae72f79ed6439419 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 22 Jun 2017 13:57:07 +0100 Subject: [PATCH 33/35] Update to containerd 76697ac8cbf357a19beb58e4805a81fe48cf7974 Requires a newer github.com/pkg/errors due to: undefined: "github.com/docker/swarmkit/vendor/github.com/pkg/errors".WithStack So update to 645ef00459ed84a119197bfb8d8205042c6df63d which is v0.8.0 as used in current containerd. Despite substantial changes to the containerd grpc interface the client library isolated us from all that so no code changes required! Signed-off-by: Ian Campbell --- vendor.conf | 4 +- .../containerd/containerd/README.md | 217 +- .../api/services/containers/containers.pb.go | 517 +++- .../api/services/containers/containers.proto | 21 +- .../api/services/content/content.pb.go | 585 ++--- .../api/services/content/content.proto | 30 +- .../containerd/api/services/diff/diff.pb.go | 73 +- .../containerd/api/services/diff/diff.proto | 2 +- .../api/services/events/events.pb.go | 407 ++++ .../api/services/events/events.proto | 11 + .../api/services/images/images.pb.go | 635 +++-- .../api/services/images/images.proto | 49 +- .../api/services/namespaces/namespace.pb.go | 111 +- .../api/services/namespaces/namespace.proto | 4 +- .../api/services/snapshot/snapshots.pb.go | 964 ++++++-- .../api/services/snapshot/snapshots.proto | 47 +- .../execution.pb.go => tasks/tasks.pb.go} | 2075 ++++++++--------- .../execution.proto => tasks/tasks.proto} | 126 +- .../api/services/version/version.pb.go | 32 +- .../api/services/version/version.proto | 2 +- .../api/types/event/container.pb.go | 1259 ++++++++++ .../api/types/event/container.proto | 26 + .../containerd/api/types/event/content.pb.go | 329 +++ .../containerd/api/types/event/content.proto | 9 + .../containerd/api/types/event/event.pb.go | 429 ++++ .../containerd/api/types/event/event.proto | 13 + .../containerd/api/types/event/image.pb.go | 615 +++++ .../containerd/api/types/event/image.proto | 12 + .../api/types/event/namespace.pb.go | 901 +++++++ .../api/types/event/namespace.proto | 17 + .../containerd/api/types/event/runtime.pb.go | 1516 ++++++++++++ .../containerd/api/types/event/runtime.proto | 43 + .../containerd/api/types/event/snapshot.pb.go | 673 ++++++ .../containerd/api/types/event/snapshot.proto | 17 + .../containerd/api/types/event/task.pb.go | 651 ++++++ .../containerd/api/types/event/task.proto | 17 + .../containerd/containerd/client.go | 27 +- .../containerd/containerd/client_unix.go | 3 + .../containerd/containerd/client_windows.go | 3 + .../containerd/containerd/container.go | 30 +- .../containerd/containerd/container_unix.go | 4 +- .../containerd/containers/containers.go | 7 +- .../containerd/containerd/content/content.go | 29 - .../containerd/containerd/content/errors.go | 98 + .../containerd/containerd/content/locks.go | 5 +- .../containerd/containerd/content/store.go | 10 +- .../containerd/containerd/content/writer.go | 2 +- .../containerd/containerd/events/convert.go | 92 + .../containerd/containerd/events/emitter.go | 65 + .../containerd/containerd/events/event.go | 3 + .../containerd/containerd/events/poster.go | 65 + .../containerd/containerd/events/sink.go | 58 + .../containerd/containerd/events/topic.go | 35 + .../containerd/events/transaction.go | 96 + .../containerd/containerd/images/image.go | 41 +- .../containerd/containerd/metadata/buckets.go | 2 + .../containerd/metadata/containers.go | 62 +- .../containerd/containerd/metadata/errors.go | 91 +- .../containerd/containerd/metadata/images.go | 8 +- .../containerd/metadata/namespaces.go | 10 +- .../containerd/namespaces/context.go | 27 + .../containerd/namespaces/validate.go | 52 + .../containerd/containerd/plugin/context.go | 3 + .../containerd/containerd/plugin/runtime.go | 12 +- .../plugin/{container.go => task.go} | 12 +- .../containerd/containerd/process.go | 50 +- .../containerd/remotes/docker/pusher.go | 4 +- .../containerd/remotes/docker/status.go | 2 +- .../containerd/services/content/helpers.go | 7 +- .../containerd/services/content/reader.go | 6 +- .../containerd/services/content/service.go | 55 +- .../containerd/services/content/store.go | 8 +- .../containerd/services/content/writer.go | 8 +- .../containerd/services/images/client.go | 10 +- .../containerd/services/images/helpers.go | 6 +- .../containerd/services/images/service.go | 70 +- .../containerd/services/snapshot/client.go | 29 +- .../containerd/services/snapshot/service.go | 79 +- .../containerd/containerd/spec_unix.go | 18 + .../github.com/containerd/containerd/task.go | 92 +- .../containerd/containerd/vendor.conf | 3 +- vendor/github.com/pkg/errors/LICENSE | 1 - vendor/github.com/pkg/errors/README.md | 2 + vendor/github.com/pkg/errors/errors.go | 170 +- vendor/github.com/pkg/errors/stack.go | 13 + 85 files changed, 11444 insertions(+), 2580 deletions(-) create mode 100644 vendor/github.com/containerd/containerd/api/services/events/events.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/services/events/events.proto rename vendor/github.com/containerd/containerd/api/services/{execution/execution.pb.go => tasks/tasks.pb.go} (61%) rename vendor/github.com/containerd/containerd/api/services/{execution/execution.proto => tasks/tasks.proto} (56%) create mode 100644 vendor/github.com/containerd/containerd/api/types/event/container.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/container.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/content.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/content.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/event.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/event.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/image.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/image.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/namespace.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/namespace.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/runtime.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/runtime.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/snapshot.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/snapshot.proto create mode 100644 vendor/github.com/containerd/containerd/api/types/event/task.pb.go create mode 100644 vendor/github.com/containerd/containerd/api/types/event/task.proto create mode 100644 vendor/github.com/containerd/containerd/content/errors.go create mode 100644 vendor/github.com/containerd/containerd/events/convert.go create mode 100644 vendor/github.com/containerd/containerd/events/emitter.go create mode 100644 vendor/github.com/containerd/containerd/events/event.go create mode 100644 vendor/github.com/containerd/containerd/events/poster.go create mode 100644 vendor/github.com/containerd/containerd/events/sink.go create mode 100644 vendor/github.com/containerd/containerd/events/topic.go create mode 100644 vendor/github.com/containerd/containerd/events/transaction.go create mode 100644 vendor/github.com/containerd/containerd/namespaces/validate.go rename vendor/github.com/containerd/containerd/plugin/{container.go => task.go} (87%) diff --git a/vendor.conf b/vendor.conf index a3b17d6f5d..696123e858 100644 --- a/vendor.conf +++ b/vendor.conf @@ -31,7 +31,7 @@ github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb github.com/opencontainers/image-spec 372ad780f63454fbbbbcc7cf80e5b90245c13e13 # containerd executor -github.com/containerd/containerd 7e3b7dead60d96e9a7b13b8813d1712c7761e327 +github.com/containerd/containerd 76697ac8cbf357a19beb58e4805a81fe48cf7974 github.com/containerd/fifo 69b99525e472735860a5269b75af1970142b3062 github.com/opencontainers/runtime-spec v1.0.0-rc5 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c @@ -50,7 +50,7 @@ github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 github.com/phayes/permbits f7e3ac5e859d0b919c5068d581cc4c5d4f4f9bc5 github.com/pivotal-golang/clock 3fd3c1944c59d9742e1cd333672181cd1a6f9fa0 -github.com/pkg/errors 01fa4104b9c248c8945d14d9f128454d5b28d595 +github.com/pkg/errors 645ef00459ed84a119197bfb8d8205042c6df63d github.com/pmezard/go-difflib 792786c7400a136282c1664665ae0a8db921c6c2 github.com/rcrowley/go-metrics 51425a2415d21afadfd55cd93432c0bc69e9598d github.com/spf13/cobra 8e91712f174ced10270cf66615e0a9127e7c4de5 diff --git a/vendor/github.com/containerd/containerd/README.md b/vendor/github.com/containerd/containerd/README.md index 2c7888674f..b8f9d64d9b 100644 --- a/vendor/github.com/containerd/containerd/README.md +++ b/vendor/github.com/containerd/containerd/README.md @@ -4,24 +4,143 @@ [![Build Status](https://travis-ci.org/containerd/containerd.svg?branch=master)](https://travis-ci.org/containerd/containerd) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd?ref=badge_shield) -containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc.. +containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc. containerd is designed to be embedded into a larger system, rather than being used directly by developers or end-users. -### State of the Project +## Features -containerd currently has two active branches. -There is a [v0.2.x](https://github.com/containerd/containerd/tree/v0.2.x) branch for the current release of containerd that is being consumed by Docker and others and the master branch is the development branch for the 1.0 roadmap and feature set. -Any PR or issue that is intended for the current v0.2.x release should be tagged with the same `v0.2.x` tag. +### Client -### Communication +containerd offers a full client package to help you integrate containerd into your platform. -For async communication and long running discussions please use issues and pull requests on the github repo. -This will be the best place to discuss design and implementation. +```go -For sync communication we have a community slack with a #containerd channel that everyone is welcome to join and chat about development. +import "github.com/containerd/containerd" -**Slack:** https://dockr.ly/community +func main() { + client, err := containerd.New("/run/containerd/containerd.sock") + defer client.Close() +} + +``` + +### Namespaces + +Namespaces allow multiple consumers to use the same containerd without conflicting with each other. It has the benefit of sharing content but still having separation with containers and images. + +To set a namespace for requests to the API: + +```go +context = context.Background() +// create a context for docker +docker = namespaces.WithNamespace(context, "docker") + +containerd, err := client.NewContainer(docker, "id") +``` + +To set a default namespace on the client: + +```go +client, err := containerd.New(address, containerd.WithDefaultNamespace("docker")) +``` + +### Distribution + +```go +// pull an image +image, err := client.Pull(context, "docker.io/library/redis:latest") + +// push an image +err := client.Push(context, "docker.io/library/redis:latest", image.Target()) +``` + +### OCI Runtime Specification + +containerd fully supports the OCI runtime specification for running containers. We have built in functions to help you generate runtime specifications based on images as well as custom parameters. + +```go +spec, err := containerd.GenerateSpec(containerd.WithImageConfig(context, image)) +``` + +### Containers + +In containerd, a container is a metadata object. Resources such as an OCI runtime specification, image, root filesystem, and other metadata can be attached to a container. + +```go +redis, err := client.NewContainer(context, "redis-master", + containerd.WithSpec(spec), +) +defer redis.Delete(context) +``` + +## Root Filesystems + +containerd allows you to use overlay or snapshot filesystems with your containers. It comes with builtin support for overlayfs and btrfs. + +```go +// pull an image and unpack it into the configured snapshotter +image, err := client.Pull(context, "docker.io/library/redis:latest", containerd.WithPullUnpack) + +// allocate a new RW root filesystem for a container based on the image +redis, err := client.NewContainer(context, "redis-master", + containerd.WithSpec(spec), + containerd.WithNewRootFS("redis-rootfs", image), +) + +// use a readonly filesystem with multiple containers +for i := 0; i < 10; i++ { + id := fmt.Sprintf("id-%s", i) + container, err := client.NewContainer(ctx, id, + containerd.WithSpec(spec), + containerd.WithNewReadonlyRootFS(id, image), + ) +} +``` + +### Tasks + +Taking a container object and turning it into a runnable process on a system is done by creating a new `Task` from the container. A task represents the runnable object within containerd. + +```go +// create a new task +task, err := redis.NewTask(context, containerd.Stdio) +defer task.Delete(context) + +// the task is now running and has a pid that can be use to setup networking +// or other runtime settings outside of containerd +pid := task.Pid() + +// start the redis-server process inside the container +err := task.Start(context) + +// wait for the task to exit and get the exit status +status, err := task.Wait(context) +``` + +### Checkpoint and Restore + +If you have [criu](https://criu.org/Main_Page) installed on your machine you can checkpoint and restore containers and their tasks. This allow you to clone and/or live migrate containers to other machines. + +```go +// checkpoint the task then push it to a registry +checkpoint, err := task.Checkpoint(context, containerd.WithExit) + +err := client.Push(context, "myregistry/checkpoints/redis:master", checkpoint) + +// on a new machine pull the checkpoint and restore the redis container +image, err := client.Pull(context, "myregistry/checkpoints/redis:master") + +checkpoint := image.Target() + +redis, err = client.NewContainer(context, "redis-master", containerd.WithCheckpoint(checkpoint, "redis-rootfs")) +defer container.Delete(context) + +task, err = redis.NewTask(context, containerd.Stdio, containerd.WithTaskCheckpoint(checkpoint)) +defer task.Delete(context) + +err := task.Start(context) +``` ### Developer Quick-Start @@ -48,44 +167,6 @@ Vendoring of external imports uses the [`vndr` tool](https://github.com/LK4D4/vn Please refer to [RUNC.md](/RUNC.md) for the currently supported version of `runc` that is used by containerd. -## Features - -* OCI Image Spec support -* OCI Runtime Spec support -* Image push and pull support -* Container runtime and lifecycle support -* Management of network namespaces containers to join existing namespaces -* Multi-tenant supported with CAS storage for global images - -## Scope and Principles - -Having a clearly defined scope of a project is important for ensuring consistency and focus. -These following criteria will be used when reviewing pull requests, features, and changes for the project before being accepted. - -### Components - -Components should not have tight dependencies on each other so that they are able to be used independently. -The APIs for images and containers should be designed in a way that when used together the components have a natural flow but still be useful independently. - -An example for this design can be seen with the overlay filesystems and the container execution layer. -The execution layer and overlay filesystems can be used independently but if you were to use both, they share a common `Mount` struct that the filesystems produce and the execution layer consumes. - -### Primitives - -containerd should expose primitives to solve problems instead of building high level abstractions in the API. -A common example of this is how build would be implemented. -Instead of having a build API in containerd we should expose the lower level primitives that allow things required in build to work. -Breaking up the filesystem APIs to allow snapshots, copy functionality, and mounts allow people implementing build at the higher levels more flexibility. - -### Extensibility and Defaults - -For the various components in containerd there should be defined extension points where implementations can be swapped for alternatives. -The best example of this is that containerd will use `runc` from OCI as the default runtime in the execution layer but other runtimes conforming to the OCI Runtime specification they can be easily added to containerd. - -containerd will come with a default implementation for the various components. -These defaults will be chosen by the maintainers of the project and should not change unless better tech for that component comes out. -Additional implementations will not be accepted into the core repository and should be developed in a separate repository not maintained by the containerd maintainers. - ### Releases containerd will be released with a 1.0 when feature complete and this version will be supported for 1 year with security and bug fixes applied and released. @@ -97,45 +178,23 @@ There is no compatibility guarantees with upgrades from two minor releases. i.e. There are not backwards compatibility guarantees with upgrades to major versions. i.e 1.0.0 to 2.0.0. Each major version will be supported for 1 year with bug fixes and security patches. -### Scope - -The following table specifies the various components of containerd and general features of container runtimes. -The table specifies whether or not the feature/component is in or out of scope. - -| Name | Description | In/Out | Reason | -|------------------------------|--------------------------------------------------------------------------------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| execution | Provide an extensible execution layer for executing a container | in | Create,start, stop pause, resume exec, signal, delete | -| cow filesystem | Built in functionality for overlay, aufs, and other copy on write filesystems for containers | in | | -| distribution | Having the ability to push and pull images as well as operations on images as a first class API object | in | containerd will fully support the management and retrieval of images | -| metrics | container-level metrics, cgroup stats, and OOM events | in | -| networking | creation and management of network interfaces | out | Networking will be handled and provided to containerd via higher level systems. | -| build | Building images as a first class API | out | Build is a higher level tooling feature and can be implemented in many different ways on top of containerd | -| volumes | Volume management for external data | out | The API supports mounts, binds, etc where all volumes type systems can be built on top of containerd. | -| logging | Persisting container logs | out | Logging can be build on top of containerd because the container’s STDIO will be provided to the clients and they can persist any way they see fit. There is no io copying of container STDIO in containerd. | - - -containerd is scoped to a single host and makes assumptions based on that fact. -It can be used to build things like a node agent that launches containers but does not have any concepts of a distributed system. - -containerd is designed to be embedded into a larger system, hence it only includes a barebone CLI (`ctr`) specifically for development and debugging purpose, with no mandate to be human-friendly, and no guarantee of interface stability over time. +### Development reports. -Also things like service discovery are out of scope even though networking is in scope. -containerd should provide the primitives to create, add, remove, or manage network interfaces and network namespaces for a container but IP allocation, discovery, and DNS should be handled at higher layers. +Weekly summary on the progress and what is being worked on. +https://github.com/containerd/containerd/tree/master/reports -### How is the scope changed? +### Communication -The scope of this project is a whitelist. -If it's not mentioned as being in scope, it is out of scope. -For the scope of this project to change it requires a 100% vote from all maintainers of the project. +For async communication and long running discussions please use issues and pull requests on the github repo. +This will be the best place to discuss design and implementation. -### Development reports. +For sync communication we have a community slack with a #containerd channel that everyone is welcome to join and chat about development. -Weekly summary on the progress and what is being worked on. -https://github.com/containerd/containerd/tree/master/reports +**Slack:** https://dockr.ly/community ## Copyright and license -Copyright © 2016 Docker, Inc. All rights reserved, except as follows. Code +Copyright ©2016-2017 Docker, Inc. All rights reserved, except as follows. Code is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file diff --git a/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go b/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go index 544cdbc6f3..84fb05a56f 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/containers/containers.pb.go @@ -75,9 +75,9 @@ type Container struct { // If this field is updated, the spec and rootfs needed to updated, as well. Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"` // Runtime specifies which runtime to use for executing this container. - Runtime string `protobuf:"bytes,4,opt,name=runtime,proto3" json:"runtime,omitempty"` + Runtime *Container_Runtime `protobuf:"bytes,4,opt,name=runtime" json:"runtime,omitempty"` // Spec to be used when creating the container. This is runtime specific. - Spec *google_protobuf1.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` + Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"` // RootFS specifies the snapshot key to use for the container's root // filesystem. When starting a task from this container, a caller should // look up the mounts from the snapshot service and include those on the @@ -86,15 +86,28 @@ type Container struct { // Snapshots referenced in this field will not be garbage collected. // // This field may be updated. - RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"` - CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,stdtime" json:"created_at"` - UpdatedAt time.Time `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,stdtime" json:"updated_at"` + RootFS string `protobuf:"bytes,6,opt,name=rootfs,proto3" json:"rootfs,omitempty"` + // CreatedAt is the time the container was first created. + CreatedAt time.Time `protobuf:"bytes,7,opt,name=created_at,json=createdAt,stdtime" json:"created_at"` + // UpdatedAt is the last time the container was mutated. + UpdatedAt time.Time `protobuf:"bytes,8,opt,name=updated_at,json=updatedAt,stdtime" json:"updated_at"` } func (m *Container) Reset() { *m = Container{} } func (*Container) ProtoMessage() {} func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{0} } +type Container_Runtime struct { + // Name is the name of the runtime. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Options specify additional runtime initialization options. + Options map[string]string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *Container_Runtime) Reset() { *m = Container_Runtime{} } +func (*Container_Runtime) ProtoMessage() {} +func (*Container_Runtime) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{0, 1} } + type GetContainerRequest struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -183,16 +196,17 @@ func (*DeleteContainerRequest) ProtoMessage() {} func (*DeleteContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{9} } func init() { - proto.RegisterType((*Container)(nil), "containerd.v1.Container") - proto.RegisterType((*GetContainerRequest)(nil), "containerd.v1.GetContainerRequest") - proto.RegisterType((*GetContainerResponse)(nil), "containerd.v1.GetContainerResponse") - proto.RegisterType((*ListContainersRequest)(nil), "containerd.v1.ListContainersRequest") - proto.RegisterType((*ListContainersResponse)(nil), "containerd.v1.ListContainersResponse") - proto.RegisterType((*CreateContainerRequest)(nil), "containerd.v1.CreateContainerRequest") - proto.RegisterType((*CreateContainerResponse)(nil), "containerd.v1.CreateContainerResponse") - proto.RegisterType((*UpdateContainerRequest)(nil), "containerd.v1.UpdateContainerRequest") - proto.RegisterType((*UpdateContainerResponse)(nil), "containerd.v1.UpdateContainerResponse") - proto.RegisterType((*DeleteContainerRequest)(nil), "containerd.v1.DeleteContainerRequest") + proto.RegisterType((*Container)(nil), "containerd.services.containers.v1.Container") + proto.RegisterType((*Container_Runtime)(nil), "containerd.services.containers.v1.Container.Runtime") + proto.RegisterType((*GetContainerRequest)(nil), "containerd.services.containers.v1.GetContainerRequest") + proto.RegisterType((*GetContainerResponse)(nil), "containerd.services.containers.v1.GetContainerResponse") + proto.RegisterType((*ListContainersRequest)(nil), "containerd.services.containers.v1.ListContainersRequest") + proto.RegisterType((*ListContainersResponse)(nil), "containerd.services.containers.v1.ListContainersResponse") + proto.RegisterType((*CreateContainerRequest)(nil), "containerd.services.containers.v1.CreateContainerRequest") + proto.RegisterType((*CreateContainerResponse)(nil), "containerd.services.containers.v1.CreateContainerResponse") + proto.RegisterType((*UpdateContainerRequest)(nil), "containerd.services.containers.v1.UpdateContainerRequest") + proto.RegisterType((*UpdateContainerResponse)(nil), "containerd.services.containers.v1.UpdateContainerResponse") + proto.RegisterType((*DeleteContainerRequest)(nil), "containerd.services.containers.v1.DeleteContainerRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -223,7 +237,7 @@ func NewContainersClient(cc *grpc.ClientConn) ContainersClient { func (c *containersClient) Get(ctx context.Context, in *GetContainerRequest, opts ...grpc.CallOption) (*GetContainerResponse, error) { out := new(GetContainerResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Containers/Get", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/Get", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -232,7 +246,7 @@ func (c *containersClient) Get(ctx context.Context, in *GetContainerRequest, opt func (c *containersClient) List(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) { out := new(ListContainersResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Containers/List", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/List", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -241,7 +255,7 @@ func (c *containersClient) List(ctx context.Context, in *ListContainersRequest, func (c *containersClient) Create(ctx context.Context, in *CreateContainerRequest, opts ...grpc.CallOption) (*CreateContainerResponse, error) { out := new(CreateContainerResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Containers/Create", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/Create", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -250,7 +264,7 @@ func (c *containersClient) Create(ctx context.Context, in *CreateContainerReques func (c *containersClient) Update(ctx context.Context, in *UpdateContainerRequest, opts ...grpc.CallOption) (*UpdateContainerResponse, error) { out := new(UpdateContainerResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Containers/Update", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/Update", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -259,7 +273,7 @@ func (c *containersClient) Update(ctx context.Context, in *UpdateContainerReques func (c *containersClient) Delete(ctx context.Context, in *DeleteContainerRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) { out := new(google_protobuf2.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.Containers/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.containers.v1.Containers/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -290,7 +304,7 @@ func _Containers_Get_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Containers/Get", + FullMethod: "/containerd.services.containers.v1.Containers/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainersServer).Get(ctx, req.(*GetContainerRequest)) @@ -308,7 +322,7 @@ func _Containers_List_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Containers/List", + FullMethod: "/containerd.services.containers.v1.Containers/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainersServer).List(ctx, req.(*ListContainersRequest)) @@ -326,7 +340,7 @@ func _Containers_Create_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Containers/Create", + FullMethod: "/containerd.services.containers.v1.Containers/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainersServer).Create(ctx, req.(*CreateContainerRequest)) @@ -344,7 +358,7 @@ func _Containers_Update_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Containers/Update", + FullMethod: "/containerd.services.containers.v1.Containers/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainersServer).Update(ctx, req.(*UpdateContainerRequest)) @@ -362,7 +376,7 @@ func _Containers_Delete_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Containers/Delete", + FullMethod: "/containerd.services.containers.v1.Containers/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContainersServer).Delete(ctx, req.(*DeleteContainerRequest)) @@ -371,7 +385,7 @@ func _Containers_Delete_Handler(srv interface{}, ctx context.Context, dec func(i } var _Containers_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.Containers", + ServiceName: "containerd.services.containers.v1.Containers", HandlerType: (*ContainersServer)(nil), Methods: []grpc.MethodDesc{ { @@ -443,44 +457,89 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintContainers(dAtA, i, uint64(len(m.Image))) i += copy(dAtA[i:], m.Image) } - if len(m.Runtime) > 0 { + if m.Runtime != nil { dAtA[i] = 0x22 i++ - i = encodeVarintContainers(dAtA, i, uint64(len(m.Runtime))) - i += copy(dAtA[i:], m.Runtime) + i = encodeVarintContainers(dAtA, i, uint64(m.Runtime.Size())) + n1, err := m.Runtime.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 } if m.Spec != nil { - dAtA[i] = 0x32 + dAtA[i] = 0x2a i++ i = encodeVarintContainers(dAtA, i, uint64(m.Spec.Size())) - n1, err := m.Spec.MarshalTo(dAtA[i:]) + n2, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n1 + i += n2 } if len(m.RootFS) > 0 { - dAtA[i] = 0x3a + dAtA[i] = 0x32 i++ i = encodeVarintContainers(dAtA, i, uint64(len(m.RootFS))) i += copy(dAtA[i:], m.RootFS) } - dAtA[i] = 0x42 + dAtA[i] = 0x3a i++ i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt))) - n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) + n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i:]) if err != nil { return 0, err } - i += n2 - dAtA[i] = 0x4a + i += n3 + dAtA[i] = 0x42 i++ i = encodeVarintContainers(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt))) - n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:]) + n4, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i:]) if err != nil { return 0, err } - i += n3 + i += n4 + return i, nil +} + +func (m *Container_Runtime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Container_Runtime) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Options) > 0 { + for k, _ := range m.Options { + dAtA[i] = 0x12 + i++ + v := m.Options[k] + mapSize := 1 + len(k) + sovContainers(uint64(len(k))) + 1 + len(v) + sovContainers(uint64(len(v))) + i = encodeVarintContainers(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } return i, nil } @@ -526,11 +585,11 @@ func (m *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n4, err := m.Container.MarshalTo(dAtA[i:]) + n5, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n4 + i += n5 return i, nil } @@ -606,11 +665,11 @@ func (m *CreateContainerRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n5, err := m.Container.MarshalTo(dAtA[i:]) + n6, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n6 return i, nil } @@ -632,11 +691,11 @@ func (m *CreateContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n6, err := m.Container.MarshalTo(dAtA[i:]) + n7, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n6 + i += n7 return i, nil } @@ -658,20 +717,20 @@ func (m *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n7, err := m.Container.MarshalTo(dAtA[i:]) + n8, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n7 + i += n8 if m.UpdateMask != nil { dAtA[i] = 0x12 i++ i = encodeVarintContainers(dAtA, i, uint64(m.UpdateMask.Size())) - n8, err := m.UpdateMask.MarshalTo(dAtA[i:]) + n9, err := m.UpdateMask.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n8 + i += n9 } return i, nil } @@ -694,11 +753,11 @@ func (m *UpdateContainerResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) - n9, err := m.Container.MarshalTo(dAtA[i:]) + n10, err := m.Container.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n9 + i += n10 return i, nil } @@ -772,8 +831,8 @@ func (m *Container) Size() (n int) { if l > 0 { n += 1 + l + sovContainers(uint64(l)) } - l = len(m.Runtime) - if l > 0 { + if m.Runtime != nil { + l = m.Runtime.Size() n += 1 + l + sovContainers(uint64(l)) } if m.Spec != nil { @@ -791,6 +850,24 @@ func (m *Container) Size() (n int) { return n } +func (m *Container_Runtime) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + if len(m.Options) > 0 { + for k, v := range m.Options { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovContainers(uint64(len(k))) + 1 + len(v) + sovContainers(uint64(len(v))) + n += mapEntrySize + 1 + sovContainers(uint64(mapEntrySize)) + } + } + return n +} + func (m *GetContainerRequest) Size() (n int) { var l int _ = l @@ -908,7 +985,7 @@ func (this *Container) String() string { `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Labels:` + mapStringForLabels + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`, - `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, + `Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "Container_Runtime", "Container_Runtime", 1) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, `CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`, @@ -917,6 +994,27 @@ func (this *Container) String() string { }, "") return s } +func (this *Container_Runtime) String() string { + if this == nil { + return "nil" + } + keysForOptions := make([]string, 0, len(this.Options)) + for k, _ := range this.Options { + keysForOptions = append(keysForOptions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForOptions) + mapStringForOptions := "map[string]string{" + for _, k := range keysForOptions { + mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) + } + mapStringForOptions += "}" + s := strings.Join([]string{`&Container_Runtime{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Options:` + mapStringForOptions + `,`, + `}`, + }, "") + return s +} func (this *GetContainerRequest) String() string { if this == nil { return "nil" @@ -1223,7 +1321,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowContainers @@ -1233,22 +1331,26 @@ func (m *Container) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthContainers } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - m.Runtime = string(dAtA[iNdEx:postIndex]) + if m.Runtime == nil { + m.Runtime = &Container_Runtime{} + } + if err := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } @@ -1281,7 +1383,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RootFS", wireType) } @@ -1310,7 +1412,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { } m.RootFS = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) } @@ -1340,7 +1442,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", wireType) } @@ -1391,6 +1493,201 @@ func (m *Container) Unmarshal(dAtA []byte) error { } return nil } +func (m *Container_Runtime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Runtime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainers + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainers + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthContainers + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Options == nil { + m.Options = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthContainers + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Options[mapkey] = mapvalue + } else { + var mapvalue string + m.Options[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainers(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GetContainerRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2252,48 +2549,52 @@ func init() { } var fileDescriptorContainers = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0x93, 0xe0, 0x36, 0x13, 0x21, 0xa1, 0x25, 0x04, 0x63, 0xa4, 0x24, 0x32, 0x3f, 0xca, - 0x05, 0x1b, 0xc2, 0x85, 0x9f, 0x0a, 0xa9, 0xe9, 0x9f, 0x2a, 0x15, 0x0e, 0x6e, 0xa1, 0xdc, 0x2a, - 0x27, 0xde, 0x04, 0xab, 0x8e, 0xd7, 0x78, 0x37, 0x95, 0x72, 0xe3, 0x11, 0x90, 0x78, 0x05, 0x8e, - 0x3c, 0x48, 0x8f, 0x1c, 0x39, 0x15, 0x9a, 0x27, 0x41, 0xbb, 0x5e, 0xd7, 0xa9, 0xed, 0x50, 0x10, - 0xbd, 0xcd, 0x78, 0xbe, 0xf9, 0x32, 0xf3, 0xcd, 0x67, 0x07, 0x76, 0x46, 0x1e, 0xfb, 0x30, 0xe9, - 0x9b, 0x03, 0x32, 0xb6, 0x06, 0x24, 0x60, 0x8e, 0x17, 0xe0, 0xc8, 0x9d, 0x0f, 0x9d, 0xd0, 0xb3, - 0x28, 0x8e, 0x8e, 0xbd, 0x01, 0xa6, 0xe9, 0xf3, 0xf9, 0xd0, 0x0c, 0x23, 0xc2, 0x08, 0xba, 0x9e, - 0x36, 0x99, 0xc7, 0x4f, 0xf4, 0xfa, 0x88, 0x8c, 0x88, 0xa8, 0x58, 0x3c, 0x8a, 0x41, 0xfa, 0x9d, - 0x11, 0x21, 0x23, 0x1f, 0x5b, 0x22, 0xeb, 0x4f, 0x86, 0x96, 0x13, 0x4c, 0x65, 0xe9, 0x6e, 0xb6, - 0x84, 0xc7, 0x21, 0x4b, 0x8a, 0xed, 0x6c, 0x71, 0xe8, 0x61, 0xdf, 0x3d, 0x1c, 0x3b, 0xf4, 0x48, - 0x22, 0x5a, 0x59, 0x04, 0xf3, 0xc6, 0x98, 0x32, 0x67, 0x1c, 0x4a, 0xc0, 0xd6, 0x5f, 0xad, 0xca, - 0xa6, 0x21, 0xa6, 0x96, 0x8b, 0xe9, 0x20, 0xf2, 0x42, 0x46, 0xa2, 0xb9, 0x30, 0xe6, 0x31, 0xbe, - 0x96, 0xa1, 0xba, 0x9e, 0x34, 0xa1, 0x06, 0x94, 0x3c, 0x57, 0x53, 0xda, 0x4a, 0xa7, 0xda, 0x53, - 0x67, 0xa7, 0xad, 0xd2, 0xce, 0x86, 0x5d, 0xf2, 0x5c, 0xb4, 0x0a, 0xaa, 0xef, 0xf4, 0xb1, 0x4f, - 0xb5, 0x52, 0xbb, 0xdc, 0xa9, 0x75, 0xef, 0x9b, 0x17, 0xe4, 0x31, 0xcf, 0x19, 0xcc, 0x5d, 0x01, - 0xdb, 0x0c, 0x58, 0x34, 0xb5, 0x65, 0x0f, 0xaa, 0xc3, 0x35, 0x6f, 0xec, 0x8c, 0xb0, 0x56, 0xe6, - 0xc4, 0x76, 0x9c, 0x20, 0x0d, 0x96, 0xa3, 0x49, 0xc0, 0xf7, 0xd2, 0x2a, 0xe2, 0x79, 0x92, 0xa2, - 0x0e, 0x54, 0x68, 0x88, 0x07, 0x9a, 0xda, 0x56, 0x3a, 0xb5, 0x6e, 0xdd, 0x8c, 0xb5, 0x30, 0x13, - 0x2d, 0xcc, 0xb5, 0x60, 0x6a, 0x0b, 0x04, 0x32, 0x40, 0x8d, 0x08, 0x61, 0x43, 0xaa, 0x2d, 0x8b, - 0x99, 0x61, 0x76, 0xda, 0x52, 0x6d, 0x42, 0xd8, 0xd6, 0x9e, 0x2d, 0x2b, 0x68, 0x1d, 0x60, 0x10, - 0x61, 0x87, 0x61, 0xf7, 0xd0, 0x61, 0xda, 0x8a, 0xe0, 0xd4, 0x73, 0x9c, 0xfb, 0x89, 0xbe, 0xbd, - 0x95, 0x93, 0xd3, 0xd6, 0xd2, 0xe7, 0x9f, 0x2d, 0xc5, 0xae, 0xca, 0xbe, 0x35, 0xc6, 0x49, 0x26, - 0xa1, 0x9b, 0x90, 0x54, 0xff, 0x85, 0x44, 0xf6, 0xad, 0x31, 0xfd, 0x39, 0xd4, 0xe6, 0xe4, 0x41, - 0x37, 0xa0, 0x7c, 0x84, 0xa7, 0xb1, 0xda, 0x36, 0x0f, 0xb9, 0x50, 0xc7, 0x8e, 0x3f, 0xc1, 0x5a, - 0x29, 0x16, 0x4a, 0x24, 0x2f, 0x4a, 0xcf, 0x14, 0xe3, 0x11, 0xdc, 0xdc, 0xc6, 0xec, 0x5c, 0x66, - 0x1b, 0x7f, 0x9c, 0x60, 0xca, 0x16, 0xdd, 0xcb, 0xd8, 0x87, 0xfa, 0x45, 0x38, 0x0d, 0x49, 0x40, - 0x31, 0x5a, 0x85, 0xea, 0xf9, 0xe1, 0x44, 0x5b, 0xad, 0xab, 0x2d, 0x3a, 0x65, 0xaf, 0xc2, 0x77, - 0xb0, 0xd3, 0x06, 0xc3, 0x82, 0x5b, 0xbb, 0x1e, 0x4d, 0x69, 0x69, 0x3a, 0x86, 0x3a, 0xf4, 0x7c, - 0x26, 0x39, 0xab, 0xb6, 0xcc, 0x8c, 0xf7, 0xd0, 0xc8, 0x36, 0xc8, 0x41, 0x5e, 0x01, 0xa4, 0xaf, - 0x9c, 0xa6, 0x08, 0x53, 0x5d, 0x36, 0xc9, 0x5c, 0x87, 0xf1, 0x0e, 0x1a, 0xeb, 0xe2, 0x38, 0x39, - 0x49, 0xfe, 0x6f, 0xc5, 0x03, 0xb8, 0x9d, 0xe3, 0xbd, 0x12, 0xed, 0xbe, 0x28, 0xd0, 0x78, 0x2b, - 0x9c, 0x70, 0xb5, 0x13, 0xa3, 0x97, 0x50, 0x8b, 0x1d, 0x26, 0x3e, 0x1f, 0xc2, 0x39, 0x45, 0xd6, - 0xdc, 0xe2, 0x5f, 0x98, 0xd7, 0x0e, 0x3d, 0xb2, 0xa5, 0x91, 0x79, 0xcc, 0xd7, 0xcd, 0x0d, 0x75, - 0x25, 0xeb, 0x3e, 0x86, 0xc6, 0x06, 0xf6, 0x71, 0xc1, 0xb6, 0x0b, 0x2c, 0xdb, 0xfd, 0x56, 0x06, - 0x48, 0x8d, 0x82, 0xde, 0x40, 0x79, 0x1b, 0x33, 0x64, 0x64, 0x7e, 0xb2, 0xe0, 0x25, 0xd0, 0xef, - 0xfd, 0x11, 0x23, 0xd7, 0xd9, 0x83, 0x0a, 0xb7, 0x22, 0xca, 0x7e, 0xb9, 0x0a, 0x0d, 0xad, 0x3f, - 0xb8, 0x04, 0x25, 0x49, 0x0f, 0x40, 0x8d, 0xdd, 0x82, 0xb2, 0x0d, 0xc5, 0xe6, 0xd4, 0x1f, 0x5e, - 0x06, 0x4b, 0x89, 0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0x3d, 0x94, 0x23, 0x5e, 0x74, 0xd5, 0x6d, 0x50, - 0xe3, 0xbb, 0xe4, 0x88, 0x8b, 0xcf, 0xa5, 0x37, 0x72, 0x4e, 0xda, 0xe4, 0x7f, 0x64, 0x3d, 0xed, - 0xe4, 0xac, 0xb9, 0xf4, 0xe3, 0xac, 0xb9, 0xf4, 0x69, 0xd6, 0x54, 0x4e, 0x66, 0x4d, 0xe5, 0xfb, - 0xac, 0xa9, 0xfc, 0x9a, 0x35, 0x95, 0xbe, 0x2a, 0x90, 0x4f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, - 0xc1, 0x18, 0xeb, 0x02, 0x8d, 0x07, 0x00, 0x00, + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xda, 0x4a, + 0x14, 0x8e, 0x81, 0x98, 0x70, 0xb8, 0x8b, 0xab, 0xb9, 0x5c, 0xae, 0xaf, 0x2b, 0x01, 0x65, 0xc5, + 0xa2, 0x35, 0x2d, 0xad, 0xda, 0x24, 0x5d, 0x41, 0xfe, 0x14, 0x29, 0x6d, 0xa3, 0x69, 0xbb, 0xca, + 0x22, 0x32, 0x30, 0x10, 0x17, 0xe3, 0x71, 0x3d, 0x03, 0x12, 0xea, 0xa2, 0x7d, 0x84, 0xbe, 0x45, + 0xde, 0xa0, 0xcf, 0x90, 0x65, 0x97, 0x5d, 0xa5, 0x09, 0x4f, 0x52, 0x79, 0x3c, 0x8e, 0x29, 0x38, + 0xaa, 0x41, 0xcd, 0xee, 0x4c, 0xe6, 0x7c, 0xdf, 0xf9, 0xe6, 0x3b, 0xe7, 0x38, 0xc0, 0x61, 0xdf, + 0xe2, 0x67, 0xa3, 0xb6, 0xd1, 0xa1, 0xc3, 0x7a, 0x87, 0x3a, 0xdc, 0xb4, 0x1c, 0xe2, 0x75, 0x67, + 0x43, 0xd3, 0xb5, 0xea, 0x8c, 0x78, 0x63, 0xab, 0x43, 0x58, 0xf4, 0xf7, 0xd9, 0xd0, 0x70, 0x3d, + 0xca, 0x29, 0xba, 0x1f, 0x81, 0x8c, 0x10, 0x60, 0xcc, 0x64, 0x8d, 0x1f, 0xeb, 0x85, 0x3e, 0xed, + 0x53, 0x91, 0x5d, 0xf7, 0xa3, 0x00, 0xa8, 0xff, 0xdf, 0xa7, 0xb4, 0x6f, 0x93, 0xba, 0x38, 0xb5, + 0x47, 0xbd, 0xba, 0xe9, 0x4c, 0xe4, 0xd5, 0xbd, 0xf9, 0x2b, 0x32, 0x74, 0x79, 0x78, 0x59, 0x99, + 0xbf, 0xec, 0x59, 0xc4, 0xee, 0x9e, 0x0e, 0x4d, 0x36, 0x90, 0x19, 0xe5, 0xf9, 0x0c, 0x6e, 0x0d, + 0x09, 0xe3, 0xe6, 0xd0, 0x95, 0x09, 0xfb, 0x89, 0x9e, 0xcf, 0x27, 0x2e, 0x61, 0xf5, 0x2e, 0x61, + 0x1d, 0xcf, 0x72, 0x39, 0xf5, 0x66, 0xc2, 0x80, 0xa7, 0x7a, 0xbe, 0x0e, 0xb9, 0x9d, 0x10, 0x84, + 0x8a, 0x90, 0xb2, 0xba, 0x9a, 0x52, 0x51, 0x6a, 0xb9, 0x96, 0x3a, 0xbd, 0x2c, 0xa7, 0x0e, 0x77, + 0x71, 0xca, 0xea, 0xa2, 0x63, 0x50, 0x6d, 0xb3, 0x4d, 0x6c, 0xa6, 0xa5, 0x2a, 0xe9, 0x5a, 0xbe, + 0xb1, 0x69, 0xfc, 0xd6, 0x32, 0xe3, 0x86, 0xd5, 0x38, 0x12, 0xd0, 0x3d, 0x87, 0x7b, 0x13, 0x2c, + 0x79, 0x50, 0x01, 0xd6, 0xad, 0xa1, 0xd9, 0x27, 0x5a, 0xda, 0x2f, 0x86, 0x83, 0x03, 0x7a, 0x05, + 0x59, 0x6f, 0xe4, 0xf8, 0x6f, 0xd5, 0x32, 0x15, 0xa5, 0x96, 0x6f, 0x3c, 0x5d, 0xaa, 0x10, 0x0e, + 0xb0, 0x38, 0x24, 0x41, 0x35, 0xc8, 0x30, 0x97, 0x74, 0xb4, 0x75, 0x41, 0x56, 0x30, 0x02, 0x57, + 0x8d, 0xd0, 0x55, 0xa3, 0xe9, 0x4c, 0xb0, 0xc8, 0x40, 0x55, 0x50, 0x3d, 0x4a, 0x79, 0x8f, 0x69, + 0xaa, 0x78, 0x3d, 0x4c, 0x2f, 0xcb, 0x2a, 0xa6, 0x94, 0xef, 0xbf, 0xc1, 0xf2, 0x06, 0xed, 0x00, + 0x74, 0x3c, 0x62, 0x72, 0xd2, 0x3d, 0x35, 0xb9, 0x96, 0x15, 0x9c, 0xfa, 0x02, 0xe7, 0xdb, 0xb0, + 0x53, 0xad, 0x8d, 0x8b, 0xcb, 0xf2, 0xda, 0x97, 0x1f, 0x65, 0x05, 0xe7, 0x24, 0xae, 0xc9, 0x7d, + 0x92, 0x91, 0xdb, 0x0d, 0x49, 0x36, 0x96, 0x21, 0x91, 0xb8, 0x26, 0xd7, 0xb7, 0x20, 0x3f, 0x63, + 0x2a, 0xfa, 0x1b, 0xd2, 0x03, 0x32, 0x09, 0xfa, 0x86, 0xfd, 0xd0, 0xb7, 0x77, 0x6c, 0xda, 0x23, + 0xa2, 0xa5, 0x02, 0x7b, 0xc5, 0x61, 0x3b, 0xb5, 0xa9, 0xe8, 0x5f, 0x15, 0xc8, 0x4a, 0x9f, 0x10, + 0x82, 0x8c, 0x63, 0x0e, 0x89, 0x04, 0x8a, 0x18, 0x9d, 0x40, 0x96, 0xba, 0xdc, 0xa2, 0x4e, 0xd8, + 0xeb, 0xe6, 0x2a, 0x2d, 0x30, 0x5e, 0x07, 0x1c, 0x41, 0xd3, 0x43, 0x46, 0x7d, 0x1b, 0xfe, 0x9a, + 0xbd, 0x58, 0x46, 0x78, 0xf5, 0x21, 0xfc, 0x73, 0x40, 0xf8, 0x4d, 0x25, 0x4c, 0x3e, 0x8c, 0x08, + 0xe3, 0xb7, 0x8d, 0x6c, 0xf5, 0x0c, 0x0a, 0xbf, 0xa6, 0x33, 0x97, 0x3a, 0x8c, 0xa0, 0x63, 0xc8, + 0xdd, 0x68, 0x17, 0xb0, 0x7c, 0xe3, 0xc1, 0x32, 0x2f, 0x6c, 0x65, 0xfc, 0x86, 0xe0, 0x88, 0xa4, + 0x5a, 0x87, 0x7f, 0x8f, 0x2c, 0x16, 0x95, 0x62, 0x91, 0x34, 0xb5, 0x67, 0xd9, 0x5c, 0xd6, 0xc9, + 0x61, 0x79, 0xaa, 0xda, 0x50, 0x9c, 0x07, 0x48, 0x71, 0x18, 0x20, 0x2a, 0xab, 0x29, 0xc2, 0xff, + 0x55, 0xd4, 0xcd, 0xb0, 0x54, 0xdf, 0x43, 0x71, 0x47, 0x4c, 0xdf, 0x82, 0x75, 0x7f, 0xde, 0x8a, + 0x01, 0xfc, 0xb7, 0x50, 0xeb, 0xce, 0x7c, 0x3f, 0x57, 0xa0, 0xf8, 0x4e, 0xac, 0xc4, 0xdd, 0xbf, + 0x0c, 0xbd, 0x80, 0x7c, 0xb0, 0x7e, 0xe2, 0x2b, 0x2d, 0xa6, 0x33, 0x6e, 0x6f, 0xf7, 0xfd, 0x0f, + 0xf9, 0x4b, 0x93, 0x0d, 0xb0, 0xdc, 0x72, 0x3f, 0xf6, 0x6d, 0x59, 0x10, 0x7a, 0x67, 0xb6, 0x3c, + 0x82, 0xe2, 0x2e, 0xb1, 0x49, 0x8c, 0x2b, 0xb7, 0xac, 0x4a, 0xe3, 0x2a, 0x03, 0x10, 0x0d, 0x23, + 0x1a, 0x43, 0xfa, 0x80, 0x70, 0xf4, 0x2c, 0x81, 0x8c, 0x98, 0x85, 0xd4, 0x9f, 0x2f, 0x8d, 0x93, + 0x56, 0x7c, 0x84, 0x8c, 0xbf, 0x16, 0x28, 0xc9, 0x3f, 0x97, 0xd8, 0x85, 0xd3, 0xb7, 0x56, 0x40, + 0xca, 0xe2, 0x9f, 0x40, 0x0d, 0x26, 0x17, 0x25, 0x21, 0x89, 0x5f, 0x28, 0x7d, 0x7b, 0x15, 0x68, + 0x24, 0x20, 0x98, 0x91, 0x44, 0x02, 0xe2, 0xe7, 0x3e, 0x91, 0x80, 0xdb, 0x26, 0xf1, 0x04, 0xd4, + 0x60, 0x6e, 0x12, 0x09, 0x88, 0x1f, 0x31, 0xbd, 0xb8, 0xb0, 0x11, 0x7b, 0xfe, 0xef, 0x9e, 0x96, + 0x76, 0x71, 0x5d, 0x5a, 0xfb, 0x7e, 0x5d, 0x5a, 0xfb, 0x3c, 0x2d, 0x29, 0x17, 0xd3, 0x92, 0xf2, + 0x6d, 0x5a, 0x52, 0xae, 0xa6, 0x25, 0xa5, 0xad, 0x8a, 0xcc, 0x27, 0x3f, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xcd, 0xae, 0xd0, 0xb5, 0xd0, 0x09, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/containers/containers.proto b/vendor/github.com/containerd/containerd/api/services/containers/containers.proto index 445ebdea2f..0af83df9ef 100644 --- a/vendor/github.com/containerd/containerd/api/services/containers/containers.proto +++ b/vendor/github.com/containerd/containerd/api/services/containers/containers.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1; +package containerd.services.containers.v1; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; @@ -51,11 +51,17 @@ message Container { // If this field is updated, the spec and rootfs needed to updated, as well. string image = 3; + message Runtime { + // Name is the name of the runtime. + string name = 1; + // Options specify additional runtime initialization options. + map options = 2; + } // Runtime specifies which runtime to use for executing this container. - string runtime = 4; + Runtime runtime = 4; // Spec to be used when creating the container. This is runtime specific. - google.protobuf.Any spec = 6; + google.protobuf.Any spec = 5; // RootFS specifies the snapshot key to use for the container's root // filesystem. When starting a task from this container, a caller should @@ -65,10 +71,13 @@ message Container { // Snapshots referenced in this field will not be garbage collected. // // This field may be updated. - string rootfs = 7 [(gogoproto.customname) = "RootFS"]; + string rootfs = 6 [(gogoproto.customname) = "RootFS"]; - google.protobuf.Timestamp created_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Timestamp updated_at = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // CreatedAt is the time the container was first created. + google.protobuf.Timestamp created_at = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + + // UpdatedAt is the last time the container was mutated. + google.protobuf.Timestamp updated_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message GetContainerRequest { diff --git a/vendor/github.com/containerd/containerd/api/services/content/content.pb.go b/vendor/github.com/containerd/containerd/api/services/content/content.pb.go index 9300eea94d..32c55e3cbc 100644 --- a/vendor/github.com/containerd/containerd/api/services/content/content.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/content/content.pb.go @@ -15,13 +15,13 @@ ListContentRequest ListContentResponse DeleteContentRequest - ReadRequest - ReadResponse - StatusRequest + ReadContentRequest + ReadContentResponse Status + StatusRequest StatusResponse - WriteRequest - WriteResponse + WriteContentRequest + WriteContentResponse AbortRequest */ package content @@ -153,9 +153,9 @@ func (m *DeleteContentRequest) Reset() { *m = DeleteContentRe func (*DeleteContentRequest) ProtoMessage() {} func (*DeleteContentRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{5} } -// ReadRequest defines the fields that make up a request to read a portion of +// ReadContentRequest defines the fields that make up a request to read a portion of // data from a stored object. -type ReadRequest struct { +type ReadContentRequest struct { // Digest is the hash identity to read. Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,1,opt,name=digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"digest"` // Offset specifies the number of bytes from the start at which to begin @@ -167,27 +167,19 @@ type ReadRequest struct { Size_ int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` } -func (m *ReadRequest) Reset() { *m = ReadRequest{} } -func (*ReadRequest) ProtoMessage() {} -func (*ReadRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{6} } +func (m *ReadContentRequest) Reset() { *m = ReadContentRequest{} } +func (*ReadContentRequest) ProtoMessage() {} +func (*ReadContentRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{6} } -// ReadResponse carries byte data for a read request. -type ReadResponse struct { +// ReadContentResponse carries byte data for a read request. +type ReadContentResponse struct { Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } -func (m *ReadResponse) Reset() { *m = ReadResponse{} } -func (*ReadResponse) ProtoMessage() {} -func (*ReadResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{7} } - -type StatusRequest struct { - Regexp string `protobuf:"bytes,1,opt,name=regexp,proto3" json:"regexp,omitempty"` -} - -func (m *StatusRequest) Reset() { *m = StatusRequest{} } -func (*StatusRequest) ProtoMessage() {} -func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{8} } +func (m *ReadContentResponse) Reset() { *m = ReadContentResponse{} } +func (*ReadContentResponse) ProtoMessage() {} +func (*ReadContentResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{7} } type Status struct { StartedAt time.Time `protobuf:"bytes,1,opt,name=started_at,json=startedAt,stdtime" json:"started_at"` @@ -200,7 +192,15 @@ type Status struct { func (m *Status) Reset() { *m = Status{} } func (*Status) ProtoMessage() {} -func (*Status) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{9} } +func (*Status) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{8} } + +type StatusRequest struct { + Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (m *StatusRequest) Reset() { *m = StatusRequest{} } +func (*StatusRequest) ProtoMessage() {} +func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{9} } type StatusResponse struct { Statuses []Status `protobuf:"bytes,1,rep,name=statuses" json:"statuses"` @@ -210,8 +210,8 @@ func (m *StatusResponse) Reset() { *m = StatusResponse{} } func (*StatusResponse) ProtoMessage() {} func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{10} } -// WriteRequest writes data to the request ref at offset. -type WriteRequest struct { +// WriteContentRequest writes data to the request ref at offset. +type WriteContentRequest struct { // Action sets the behavior of the write. // // When this is a write and the ref is not yet allocated, the ref will be @@ -223,7 +223,7 @@ type WriteRequest struct { // If the action is write and there is no data, the current write status // will be returned. This works differently from status because the stream // holds a lock. - Action WriteAction `protobuf:"varint,1,opt,name=action,proto3,enum=containerd.v1.WriteAction" json:"action,omitempty"` + Action WriteAction `protobuf:"varint,1,opt,name=action,proto3,enum=containerd.services.content.v1.WriteAction" json:"action,omitempty"` // Ref identifies the pre-commit object to write to. Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"` // Total can be set to have the service validate the total size of the @@ -263,15 +263,15 @@ type WriteRequest struct { Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` } -func (m *WriteRequest) Reset() { *m = WriteRequest{} } -func (*WriteRequest) ProtoMessage() {} -func (*WriteRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{11} } +func (m *WriteContentRequest) Reset() { *m = WriteContentRequest{} } +func (*WriteContentRequest) ProtoMessage() {} +func (*WriteContentRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{11} } -// WriteResponse is returned on the culmination of a write call. -type WriteResponse struct { +// WriteContentResponse is returned on the culmination of a write call. +type WriteContentResponse struct { // Action contains the action for the final message of the stream. A writer // should confirm that they match the intended result. - Action WriteAction `protobuf:"varint,1,opt,name=action,proto3,enum=containerd.v1.WriteAction" json:"action,omitempty"` + Action WriteAction `protobuf:"varint,1,opt,name=action,proto3,enum=containerd.services.content.v1.WriteAction" json:"action,omitempty"` // StartedAt provides the time at which the write began. // // This must be set for stat and commit write actions. All other write @@ -297,9 +297,9 @@ type WriteResponse struct { Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,6,opt,name=digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"digest"` } -func (m *WriteResponse) Reset() { *m = WriteResponse{} } -func (*WriteResponse) ProtoMessage() {} -func (*WriteResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{12} } +func (m *WriteContentResponse) Reset() { *m = WriteContentResponse{} } +func (*WriteContentResponse) ProtoMessage() {} +func (*WriteContentResponse) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{12} } type AbortRequest struct { Ref string `protobuf:"bytes,1,opt,name=ref,proto3" json:"ref,omitempty"` @@ -310,21 +310,21 @@ func (*AbortRequest) ProtoMessage() {} func (*AbortRequest) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{13} } func init() { - proto.RegisterType((*Info)(nil), "containerd.v1.Info") - proto.RegisterType((*InfoRequest)(nil), "containerd.v1.InfoRequest") - proto.RegisterType((*InfoResponse)(nil), "containerd.v1.InfoResponse") - proto.RegisterType((*ListContentRequest)(nil), "containerd.v1.ListContentRequest") - proto.RegisterType((*ListContentResponse)(nil), "containerd.v1.ListContentResponse") - proto.RegisterType((*DeleteContentRequest)(nil), "containerd.v1.DeleteContentRequest") - proto.RegisterType((*ReadRequest)(nil), "containerd.v1.ReadRequest") - proto.RegisterType((*ReadResponse)(nil), "containerd.v1.ReadResponse") - proto.RegisterType((*StatusRequest)(nil), "containerd.v1.StatusRequest") - proto.RegisterType((*Status)(nil), "containerd.v1.Status") - proto.RegisterType((*StatusResponse)(nil), "containerd.v1.StatusResponse") - proto.RegisterType((*WriteRequest)(nil), "containerd.v1.WriteRequest") - proto.RegisterType((*WriteResponse)(nil), "containerd.v1.WriteResponse") - proto.RegisterType((*AbortRequest)(nil), "containerd.v1.AbortRequest") - proto.RegisterEnum("containerd.v1.WriteAction", WriteAction_name, WriteAction_value) + proto.RegisterType((*Info)(nil), "containerd.services.content.v1.Info") + proto.RegisterType((*InfoRequest)(nil), "containerd.services.content.v1.InfoRequest") + proto.RegisterType((*InfoResponse)(nil), "containerd.services.content.v1.InfoResponse") + proto.RegisterType((*ListContentRequest)(nil), "containerd.services.content.v1.ListContentRequest") + proto.RegisterType((*ListContentResponse)(nil), "containerd.services.content.v1.ListContentResponse") + proto.RegisterType((*DeleteContentRequest)(nil), "containerd.services.content.v1.DeleteContentRequest") + proto.RegisterType((*ReadContentRequest)(nil), "containerd.services.content.v1.ReadContentRequest") + proto.RegisterType((*ReadContentResponse)(nil), "containerd.services.content.v1.ReadContentResponse") + proto.RegisterType((*Status)(nil), "containerd.services.content.v1.Status") + proto.RegisterType((*StatusRequest)(nil), "containerd.services.content.v1.StatusRequest") + proto.RegisterType((*StatusResponse)(nil), "containerd.services.content.v1.StatusResponse") + proto.RegisterType((*WriteContentRequest)(nil), "containerd.services.content.v1.WriteContentRequest") + proto.RegisterType((*WriteContentResponse)(nil), "containerd.services.content.v1.WriteContentResponse") + proto.RegisterType((*AbortRequest)(nil), "containerd.services.content.v1.AbortRequest") + proto.RegisterEnum("containerd.services.content.v1.WriteAction", WriteAction_name, WriteAction_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -355,7 +355,7 @@ type ContentClient interface { // Read allows one to read an object based on the offset into the content. // // The requested data may be returned in one or more messages. - Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (Content_ReadClient, error) + Read(ctx context.Context, in *ReadContentRequest, opts ...grpc.CallOption) (Content_ReadClient, error) // Status returns the status of ongoing object ingestions, started via // Write. // @@ -395,7 +395,7 @@ func NewContentClient(cc *grpc.ClientConn) ContentClient { func (c *contentClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) { out := new(InfoResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Content/Info", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.content.v1.Content/Info", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -403,7 +403,7 @@ func (c *contentClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc. } func (c *contentClient) List(ctx context.Context, in *ListContentRequest, opts ...grpc.CallOption) (Content_ListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[0], c.cc, "/containerd.v1.Content/List", opts...) + stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[0], c.cc, "/containerd.services.content.v1.Content/List", opts...) if err != nil { return nil, err } @@ -436,15 +436,15 @@ func (x *contentListClient) Recv() (*ListContentResponse, error) { func (c *contentClient) Delete(ctx context.Context, in *DeleteContentRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) { out := new(google_protobuf2.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.Content/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.content.v1.Content/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *contentClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (Content_ReadClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[1], c.cc, "/containerd.v1.Content/Read", opts...) +func (c *contentClient) Read(ctx context.Context, in *ReadContentRequest, opts ...grpc.CallOption) (Content_ReadClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[1], c.cc, "/containerd.services.content.v1.Content/Read", opts...) if err != nil { return nil, err } @@ -459,7 +459,7 @@ func (c *contentClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc. } type Content_ReadClient interface { - Recv() (*ReadResponse, error) + Recv() (*ReadContentResponse, error) grpc.ClientStream } @@ -467,8 +467,8 @@ type contentReadClient struct { grpc.ClientStream } -func (x *contentReadClient) Recv() (*ReadResponse, error) { - m := new(ReadResponse) +func (x *contentReadClient) Recv() (*ReadContentResponse, error) { + m := new(ReadContentResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -477,7 +477,7 @@ func (x *contentReadClient) Recv() (*ReadResponse, error) { func (c *contentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { out := new(StatusResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Content/Status", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.content.v1.Content/Status", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -485,7 +485,7 @@ func (c *contentClient) Status(ctx context.Context, in *StatusRequest, opts ...g } func (c *contentClient) Write(ctx context.Context, opts ...grpc.CallOption) (Content_WriteClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[2], c.cc, "/containerd.v1.Content/Write", opts...) + stream, err := grpc.NewClientStream(ctx, &_Content_serviceDesc.Streams[2], c.cc, "/containerd.services.content.v1.Content/Write", opts...) if err != nil { return nil, err } @@ -494,8 +494,8 @@ func (c *contentClient) Write(ctx context.Context, opts ...grpc.CallOption) (Con } type Content_WriteClient interface { - Send(*WriteRequest) error - Recv() (*WriteResponse, error) + Send(*WriteContentRequest) error + Recv() (*WriteContentResponse, error) grpc.ClientStream } @@ -503,12 +503,12 @@ type contentWriteClient struct { grpc.ClientStream } -func (x *contentWriteClient) Send(m *WriteRequest) error { +func (x *contentWriteClient) Send(m *WriteContentRequest) error { return x.ClientStream.SendMsg(m) } -func (x *contentWriteClient) Recv() (*WriteResponse, error) { - m := new(WriteResponse) +func (x *contentWriteClient) Recv() (*WriteContentResponse, error) { + m := new(WriteContentResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } @@ -517,7 +517,7 @@ func (x *contentWriteClient) Recv() (*WriteResponse, error) { func (c *contentClient) Abort(ctx context.Context, in *AbortRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) { out := new(google_protobuf2.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.Content/Abort", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.content.v1.Content/Abort", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -544,7 +544,7 @@ type ContentServer interface { // Read allows one to read an object based on the offset into the content. // // The requested data may be returned in one or more messages. - Read(*ReadRequest, Content_ReadServer) error + Read(*ReadContentRequest, Content_ReadServer) error // Status returns the status of ongoing object ingestions, started via // Write. // @@ -588,7 +588,7 @@ func _Content_Info_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Content/Info", + FullMethod: "/containerd.services.content.v1.Content/Info", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContentServer).Info(ctx, req.(*InfoRequest)) @@ -627,7 +627,7 @@ func _Content_Delete_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Content/Delete", + FullMethod: "/containerd.services.content.v1.Content/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContentServer).Delete(ctx, req.(*DeleteContentRequest)) @@ -636,7 +636,7 @@ func _Content_Delete_Handler(srv interface{}, ctx context.Context, dec func(inte } func _Content_Read_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ReadRequest) + m := new(ReadContentRequest) if err := stream.RecvMsg(m); err != nil { return err } @@ -644,7 +644,7 @@ func _Content_Read_Handler(srv interface{}, stream grpc.ServerStream) error { } type Content_ReadServer interface { - Send(*ReadResponse) error + Send(*ReadContentResponse) error grpc.ServerStream } @@ -652,7 +652,7 @@ type contentReadServer struct { grpc.ServerStream } -func (x *contentReadServer) Send(m *ReadResponse) error { +func (x *contentReadServer) Send(m *ReadContentResponse) error { return x.ServerStream.SendMsg(m) } @@ -666,7 +666,7 @@ func _Content_Status_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Content/Status", + FullMethod: "/containerd.services.content.v1.Content/Status", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContentServer).Status(ctx, req.(*StatusRequest)) @@ -679,8 +679,8 @@ func _Content_Write_Handler(srv interface{}, stream grpc.ServerStream) error { } type Content_WriteServer interface { - Send(*WriteResponse) error - Recv() (*WriteRequest, error) + Send(*WriteContentResponse) error + Recv() (*WriteContentRequest, error) grpc.ServerStream } @@ -688,12 +688,12 @@ type contentWriteServer struct { grpc.ServerStream } -func (x *contentWriteServer) Send(m *WriteResponse) error { +func (x *contentWriteServer) Send(m *WriteContentResponse) error { return x.ServerStream.SendMsg(m) } -func (x *contentWriteServer) Recv() (*WriteRequest, error) { - m := new(WriteRequest) +func (x *contentWriteServer) Recv() (*WriteContentRequest, error) { + m := new(WriteContentRequest) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } @@ -710,7 +710,7 @@ func _Content_Abort_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Content/Abort", + FullMethod: "/containerd.services.content.v1.Content/Abort", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContentServer).Abort(ctx, req.(*AbortRequest)) @@ -719,7 +719,7 @@ func _Content_Abort_Handler(srv interface{}, ctx context.Context, dec func(inter } var _Content_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.Content", + ServiceName: "containerd.services.content.v1.Content", HandlerType: (*ContentServer)(nil), Methods: []grpc.MethodDesc{ { @@ -919,7 +919,7 @@ func (m *DeleteContentRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ReadRequest) Marshal() (dAtA []byte, err error) { +func (m *ReadContentRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -929,7 +929,7 @@ func (m *ReadRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ReadRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ReadContentRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -953,7 +953,7 @@ func (m *ReadRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ReadResponse) Marshal() (dAtA []byte, err error) { +func (m *ReadContentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -963,7 +963,7 @@ func (m *ReadResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ReadResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ReadContentResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -982,30 +982,6 @@ func (m *ReadResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *StatusRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Regexp) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintContent(dAtA, i, uint64(len(m.Regexp))) - i += copy(dAtA[i:], m.Regexp) - } - return i, nil -} - func (m *Status) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1062,6 +1038,30 @@ func (m *Status) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *StatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filter) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContent(dAtA, i, uint64(len(m.Filter))) + i += copy(dAtA[i:], m.Filter) + } + return i, nil +} + func (m *StatusResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1092,7 +1092,7 @@ func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *WriteRequest) Marshal() (dAtA []byte, err error) { +func (m *WriteContentRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1102,7 +1102,7 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *WriteContentRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1143,7 +1143,7 @@ func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *WriteResponse) Marshal() (dAtA []byte, err error) { +func (m *WriteContentResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1153,7 +1153,7 @@ func (m *WriteResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WriteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *WriteContentResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1310,7 +1310,7 @@ func (m *DeleteContentRequest) Size() (n int) { return n } -func (m *ReadRequest) Size() (n int) { +func (m *ReadContentRequest) Size() (n int) { var l int _ = l l = len(m.Digest) @@ -1326,7 +1326,7 @@ func (m *ReadRequest) Size() (n int) { return n } -func (m *ReadResponse) Size() (n int) { +func (m *ReadContentResponse) Size() (n int) { var l int _ = l if m.Offset != 0 { @@ -1339,16 +1339,6 @@ func (m *ReadResponse) Size() (n int) { return n } -func (m *StatusRequest) Size() (n int) { - var l int - _ = l - l = len(m.Regexp) - if l > 0 { - n += 1 + l + sovContent(uint64(l)) - } - return n -} - func (m *Status) Size() (n int) { var l int _ = l @@ -1373,6 +1363,16 @@ func (m *Status) Size() (n int) { return n } +func (m *StatusRequest) Size() (n int) { + var l int + _ = l + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovContent(uint64(l)) + } + return n +} + func (m *StatusResponse) Size() (n int) { var l int _ = l @@ -1385,7 +1385,7 @@ func (m *StatusResponse) Size() (n int) { return n } -func (m *WriteRequest) Size() (n int) { +func (m *WriteContentRequest) Size() (n int) { var l int _ = l if m.Action != 0 { @@ -1412,7 +1412,7 @@ func (m *WriteRequest) Size() (n int) { return n } -func (m *WriteResponse) Size() (n int) { +func (m *WriteContentResponse) Size() (n int) { var l int _ = l if m.Action != 0 { @@ -1519,11 +1519,11 @@ func (this *DeleteContentRequest) String() string { }, "") return s } -func (this *ReadRequest) String() string { +func (this *ReadContentRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ReadRequest{`, + s := strings.Join([]string{`&ReadContentRequest{`, `Digest:` + fmt.Sprintf("%v", this.Digest) + `,`, `Offset:` + fmt.Sprintf("%v", this.Offset) + `,`, `Size_:` + fmt.Sprintf("%v", this.Size_) + `,`, @@ -1531,27 +1531,17 @@ func (this *ReadRequest) String() string { }, "") return s } -func (this *ReadResponse) String() string { +func (this *ReadContentResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ReadResponse{`, + s := strings.Join([]string{`&ReadContentResponse{`, `Offset:` + fmt.Sprintf("%v", this.Offset) + `,`, `Data:` + fmt.Sprintf("%v", this.Data) + `,`, `}`, }, "") return s } -func (this *StatusRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&StatusRequest{`, - `Regexp:` + fmt.Sprintf("%v", this.Regexp) + `,`, - `}`, - }, "") - return s -} func (this *Status) String() string { if this == nil { return "nil" @@ -1567,6 +1557,16 @@ func (this *Status) String() string { }, "") return s } +func (this *StatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StatusRequest{`, + `Filter:` + fmt.Sprintf("%v", this.Filter) + `,`, + `}`, + }, "") + return s +} func (this *StatusResponse) String() string { if this == nil { return "nil" @@ -1577,11 +1577,11 @@ func (this *StatusResponse) String() string { }, "") return s } -func (this *WriteRequest) String() string { +func (this *WriteContentRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&WriteRequest{`, + s := strings.Join([]string{`&WriteContentRequest{`, `Action:` + fmt.Sprintf("%v", this.Action) + `,`, `Ref:` + fmt.Sprintf("%v", this.Ref) + `,`, `Total:` + fmt.Sprintf("%v", this.Total) + `,`, @@ -1592,11 +1592,11 @@ func (this *WriteRequest) String() string { }, "") return s } -func (this *WriteResponse) String() string { +func (this *WriteContentResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&WriteResponse{`, + s := strings.Join([]string{`&WriteContentResponse{`, `Action:` + fmt.Sprintf("%v", this.Action) + `,`, `StartedAt:` + strings.Replace(strings.Replace(this.StartedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, `UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, @@ -2122,7 +2122,7 @@ func (m *DeleteContentRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ReadRequest) Unmarshal(dAtA []byte) error { +func (m *ReadContentRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2145,10 +2145,10 @@ func (m *ReadRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ReadRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ReadContentRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ReadRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ReadContentRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2239,7 +2239,7 @@ func (m *ReadRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ReadResponse) Unmarshal(dAtA []byte) error { +func (m *ReadContentResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2262,10 +2262,10 @@ func (m *ReadResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ReadResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ReadContentResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ReadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ReadContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2339,85 +2339,6 @@ func (m *ReadResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *StatusRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowContent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Regexp", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowContent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthContent - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Regexp = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipContent(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthContent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Status) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2624,6 +2545,85 @@ func (m *Status) Unmarshal(dAtA []byte) error { } return nil } +func (m *StatusRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContent + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *StatusResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2705,7 +2705,7 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *WriteRequest) Unmarshal(dAtA []byte) error { +func (m *WriteContentRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2728,10 +2728,10 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WriteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: WriteContentRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WriteContentRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2901,7 +2901,7 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *WriteResponse) Unmarshal(dAtA []byte) error { +func (m *WriteContentResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2924,10 +2924,10 @@ func (m *WriteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WriteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: WriteContentResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WriteContentResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3286,59 +3286,60 @@ func init() { } var fileDescriptorContent = []byte{ - // 860 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xcf, 0xc4, 0x8e, 0x69, 0x5f, 0xd2, 0x25, 0x4c, 0xb2, 0x55, 0xe4, 0xee, 0x3a, 0x59, 0x73, - 0x20, 0x5a, 0x69, 0x9d, 0x25, 0x1c, 0x90, 0x10, 0x08, 0x25, 0x69, 0x41, 0x41, 0x2c, 0x2b, 0xb9, - 0x91, 0x2a, 0x4e, 0xc8, 0x49, 0x26, 0xc6, 0x52, 0xe3, 0x31, 0xf6, 0xa4, 0x2a, 0x9c, 0xb8, 0x20, - 0xa1, 0x9e, 0xf8, 0x02, 0xbd, 0x00, 0x77, 0xee, 0x7c, 0x01, 0x7a, 0xe4, 0x88, 0x38, 0x14, 0x9a, - 0x03, 0x1f, 0x80, 0x4f, 0x80, 0x3c, 0x33, 0x76, 0x9c, 0x3f, 0x45, 0xf4, 0x0f, 0xa7, 0xcc, 0xcc, - 0xfb, 0xbd, 0x9f, 0xdf, 0x9f, 0x5f, 0xdf, 0x2b, 0xf4, 0x5c, 0x8f, 0x7d, 0x3e, 0x1b, 0x5a, 0x23, - 0x3a, 0x6d, 0x8d, 0xa8, 0xcf, 0x1c, 0xcf, 0x27, 0xe1, 0x38, 0x7b, 0x74, 0x02, 0xaf, 0x15, 0x91, - 0xf0, 0xc4, 0x1b, 0x91, 0x88, 0xbf, 0x13, 0x9f, 0x25, 0xbf, 0x56, 0x10, 0x52, 0x46, 0xf1, 0xce, - 0x02, 0x6e, 0x9d, 0xbc, 0xa9, 0x57, 0x5d, 0xea, 0x52, 0x6e, 0x69, 0xc5, 0x27, 0x01, 0xd2, 0xeb, - 0x2e, 0xa5, 0xee, 0x31, 0x69, 0xf1, 0xdb, 0x70, 0x36, 0x69, 0x31, 0x6f, 0x4a, 0x22, 0xe6, 0x4c, - 0x03, 0x09, 0xd8, 0x5b, 0x05, 0x90, 0x69, 0xc0, 0xbe, 0x14, 0x46, 0xf3, 0x27, 0x04, 0x6a, 0xdf, - 0x9f, 0x50, 0xfc, 0x11, 0x68, 0x63, 0xcf, 0x25, 0x11, 0xab, 0xa1, 0x06, 0x6a, 0x6e, 0x77, 0xdb, - 0x17, 0x97, 0xf5, 0xdc, 0xef, 0x97, 0xf5, 0xa7, 0x99, 0x44, 0x68, 0x40, 0xfc, 0x34, 0xa4, 0xa8, - 0xe5, 0xd2, 0x67, 0xc2, 0xc5, 0xda, 0xe7, 0x3f, 0xb6, 0x64, 0xc0, 0x18, 0xd4, 0xc8, 0xfb, 0x8a, - 0xd4, 0xf2, 0x0d, 0xd4, 0x54, 0x6c, 0x7e, 0xc6, 0x1f, 0x42, 0x69, 0x44, 0xa7, 0x53, 0x8f, 0x31, - 0x32, 0xfe, 0xcc, 0x61, 0x35, 0xa5, 0x81, 0x9a, 0xc5, 0xb6, 0x6e, 0x89, 0xe0, 0xac, 0x24, 0x38, - 0x6b, 0x90, 0x44, 0xdf, 0xdd, 0x8a, 0x23, 0xf8, 0xee, 0x8f, 0x3a, 0xb2, 0x8b, 0xa9, 0x67, 0x87, - 0x99, 0x9f, 0x42, 0x31, 0x0e, 0xd8, 0x26, 0x5f, 0xcc, 0xe2, 0x6f, 0xdd, 0x63, 0xdc, 0xe6, 0x7b, - 0x50, 0x12, 0xd4, 0x51, 0x40, 0xfd, 0x88, 0xe0, 0x67, 0xa0, 0x7a, 0xfe, 0x84, 0x72, 0xe6, 0x62, - 0xbb, 0x62, 0x2d, 0xb5, 0xc3, 0x8a, 0xa1, 0x5d, 0x35, 0xfe, 0x9c, 0xcd, 0x61, 0x66, 0x15, 0xf0, - 0xc7, 0x5e, 0xc4, 0x7a, 0xa2, 0x87, 0x32, 0x40, 0x73, 0x1f, 0x2a, 0x4b, 0xaf, 0x6b, 0xdc, 0xca, - 0x7f, 0xe1, 0x1e, 0x42, 0x75, 0x9f, 0x1c, 0x13, 0x46, 0x96, 0xd9, 0xef, 0x35, 0xfd, 0x6f, 0x10, - 0x14, 0x6d, 0xe2, 0x8c, 0xff, 0x07, 0x6e, 0xbc, 0x0b, 0x1a, 0x9d, 0x4c, 0x22, 0xc2, 0xa4, 0x28, - 0xe4, 0x2d, 0x95, 0x8a, 0xb2, 0x90, 0x8a, 0xf9, 0x0e, 0x94, 0x44, 0x18, 0xb2, 0x54, 0x0b, 0x5f, - 0xb4, 0xea, 0x3b, 0x76, 0x98, 0xc3, 0x19, 0x4b, 0x36, 0x3f, 0x9b, 0x6f, 0xc0, 0xce, 0x21, 0x73, - 0xd8, 0x2c, 0x4a, 0x92, 0xd8, 0x05, 0x2d, 0x24, 0x2e, 0x39, 0x0d, 0x44, 0x12, 0xb6, 0xbc, 0x99, - 0xdf, 0xe7, 0x41, 0x13, 0x48, 0xdc, 0x03, 0x88, 0x98, 0x13, 0x4a, 0x61, 0xa2, 0x1b, 0x08, 0x73, - 0x5b, 0xfa, 0x75, 0x58, 0x4c, 0x32, 0x0b, 0xc6, 0x8e, 0x24, 0xc9, 0xdf, 0x84, 0x44, 0xfa, 0x75, - 0x18, 0x2e, 0x83, 0x12, 0x92, 0x09, 0x2f, 0xc6, 0xb6, 0x1d, 0x1f, 0x33, 0xb9, 0xab, 0x4b, 0xb9, - 0x57, 0xa1, 0xc0, 0x28, 0x73, 0x8e, 0x6b, 0x05, 0xfe, 0x2c, 0x2e, 0xf8, 0x13, 0xd8, 0x22, 0xa7, - 0x01, 0x19, 0x31, 0x32, 0xae, 0x69, 0xb7, 0xee, 0x59, 0xca, 0x61, 0xf6, 0xe1, 0x41, 0x52, 0x4d, - 0xd9, 0x8b, 0xb7, 0x61, 0x2b, 0xe2, 0x2f, 0x24, 0x92, 0xd2, 0x7d, 0xb8, 0x22, 0x5d, 0xe1, 0x20, - 0xc5, 0x9b, 0x82, 0xcd, 0xbf, 0x10, 0x94, 0x8e, 0x42, 0x8f, 0x91, 0xa4, 0x31, 0x6d, 0xd0, 0x9c, - 0x11, 0xf3, 0xa8, 0xcf, 0x2b, 0xfe, 0xa0, 0xad, 0xaf, 0xf0, 0x70, 0x70, 0x87, 0x23, 0x6c, 0x89, - 0x4c, 0xea, 0x93, 0x5f, 0xd4, 0x27, 0xad, 0x83, 0x72, 0x5d, 0x1d, 0xd4, 0xbb, 0xd7, 0x21, 0xd3, - 0x85, 0xc2, 0x46, 0x05, 0x6a, 0x19, 0x05, 0xfe, 0x92, 0x87, 0x1d, 0x99, 0xa8, 0xac, 0xd9, 0x6d, - 0x32, 0x5d, 0xd6, 0x64, 0xfe, 0x3e, 0x34, 0xa9, 0xdc, 0x4e, 0x93, 0x37, 0x53, 0xe0, 0x62, 0x66, - 0x68, 0x77, 0x9e, 0x47, 0x0d, 0x28, 0x75, 0x86, 0x34, 0x4c, 0x67, 0x9d, 0xec, 0x3e, 0x4a, 0xbb, - 0xff, 0x34, 0x9e, 0x58, 0x99, 0xea, 0xe1, 0xc7, 0xa0, 0x1e, 0x0e, 0x3a, 0x83, 0x72, 0x4e, 0xaf, - 0x9c, 0x9d, 0x37, 0x5e, 0xcd, 0x98, 0x62, 0x55, 0xe2, 0x3a, 0x14, 0x8e, 0xec, 0xfe, 0xe0, 0xa0, - 0x8c, 0xf4, 0xea, 0xd9, 0x79, 0xa3, 0x9c, 0xb1, 0xf3, 0x23, 0x7e, 0x02, 0x5a, 0xef, 0xe5, 0x8b, - 0x17, 0xfd, 0x41, 0x39, 0xaf, 0x3f, 0x3c, 0x3b, 0x6f, 0xbc, 0x96, 0x41, 0xf4, 0xf8, 0x0e, 0xd2, - 0x2b, 0xdf, 0xfe, 0x60, 0xe4, 0x7e, 0xfe, 0xd1, 0xc8, 0x7e, 0xb7, 0xfd, 0xb7, 0x02, 0xaf, 0xc8, - 0xc1, 0x8c, 0xdf, 0x97, 0x0b, 0x55, 0xdf, 0x30, 0xd2, 0x65, 0x26, 0xfa, 0xde, 0x46, 0x9b, 0x94, - 0xcb, 0x4b, 0x50, 0xe3, 0x85, 0x81, 0x9f, 0xac, 0x80, 0xd6, 0x77, 0x8b, 0x6e, 0xfe, 0x1b, 0x44, - 0xd0, 0x3d, 0x47, 0xf8, 0x00, 0x34, 0xb1, 0x3b, 0xf0, 0xeb, 0x2b, 0xf8, 0x4d, 0x2b, 0x45, 0xdf, - 0x5d, 0x53, 0xc8, 0x41, 0xfc, 0x0f, 0x03, 0xee, 0x80, 0x1a, 0x8f, 0xe5, 0xb5, 0xc4, 0x32, 0x2b, - 0x63, 0x2d, 0xb1, 0xec, 0x1c, 0x17, 0x91, 0xc8, 0x99, 0xfb, 0x68, 0xe3, 0xd4, 0x48, 0x68, 0x1e, - 0x5f, 0x63, 0x95, 0x15, 0xfa, 0x00, 0x0a, 0xa2, 0x5f, 0x7b, 0x9b, 0xfe, 0x92, 0x12, 0x92, 0x47, - 0x9b, 0x8d, 0x82, 0xa3, 0x89, 0x9e, 0x23, 0xfc, 0x2e, 0x14, 0xb8, 0xc0, 0xd6, 0x78, 0xb2, 0xb2, - 0xbb, 0xae, 0x1e, 0xdd, 0xda, 0xc5, 0x95, 0x91, 0xfb, 0xed, 0xca, 0xc8, 0x7d, 0x3d, 0x37, 0xd0, - 0xc5, 0xdc, 0x40, 0xbf, 0xce, 0x0d, 0xf4, 0xe7, 0xdc, 0x40, 0x43, 0x8d, 0x23, 0xdf, 0xfa, 0x27, - 0x00, 0x00, 0xff, 0xff, 0xbc, 0x66, 0xb9, 0xa0, 0x05, 0x0a, 0x00, 0x00, + // 866 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0x2a, 0x55, + 0x18, 0xe6, 0xc0, 0x30, 0xb6, 0x2f, 0x78, 0xc5, 0x03, 0x36, 0x64, 0x8c, 0x03, 0x4e, 0x8c, 0x92, + 0x7b, 0xbd, 0x43, 0xa5, 0x77, 0x6d, 0x02, 0xb4, 0xd1, 0x1a, 0x5b, 0x93, 0x29, 0xda, 0xe8, 0xc6, + 0x0c, 0x70, 0x18, 0x27, 0x81, 0x39, 0xd3, 0x99, 0x43, 0xa3, 0xae, 0xdc, 0x98, 0x98, 0xc6, 0x85, + 0x7f, 0xa0, 0x1b, 0x75, 0xef, 0xde, 0x5f, 0xd0, 0xa5, 0x4b, 0xd3, 0x45, 0x6b, 0xf9, 0x21, 0xc6, + 0xcc, 0x99, 0x33, 0xc3, 0x50, 0x5a, 0x81, 0x96, 0xbb, 0xe2, 0x7c, 0xbc, 0xcf, 0xf3, 0x7e, 0x3d, + 0x73, 0x5e, 0xa0, 0x6d, 0xd9, 0xec, 0x9b, 0x71, 0x57, 0xef, 0xd1, 0x51, 0xbd, 0x47, 0x1d, 0x66, + 0xda, 0x0e, 0xf1, 0xfa, 0xc9, 0xa5, 0xe9, 0xda, 0x75, 0x9f, 0x78, 0xa7, 0x76, 0x8f, 0xf8, 0xfc, + 0x9c, 0x38, 0x2c, 0xfa, 0xd5, 0x5d, 0x8f, 0x32, 0x8a, 0xd5, 0xa9, 0xb9, 0x1e, 0x99, 0xea, 0x91, + 0xc9, 0xe9, 0x07, 0x4a, 0xc9, 0xa2, 0x16, 0xe5, 0xa6, 0xf5, 0x60, 0x15, 0xa2, 0x94, 0x8a, 0x45, + 0xa9, 0x35, 0x24, 0x75, 0xbe, 0xeb, 0x8e, 0x07, 0x75, 0x66, 0x8f, 0x88, 0xcf, 0xcc, 0x91, 0x2b, + 0x0c, 0xde, 0xbc, 0x6d, 0x40, 0x46, 0x2e, 0xfb, 0x2e, 0xbc, 0xd4, 0xfe, 0x40, 0x20, 0xed, 0x3b, + 0x03, 0x8a, 0x3f, 0x01, 0xb9, 0x6f, 0x5b, 0xc4, 0x67, 0x65, 0x54, 0x45, 0xb5, 0xcd, 0x56, 0xe3, + 0xe2, 0xaa, 0x92, 0xba, 0xbc, 0xaa, 0x3c, 0x4d, 0x64, 0x46, 0x5d, 0xe2, 0xc4, 0x31, 0xfa, 0x75, + 0x8b, 0x3e, 0x0f, 0x21, 0xfa, 0x2e, 0xff, 0x31, 0x04, 0x03, 0xc6, 0x20, 0xf9, 0xf6, 0xf7, 0xa4, + 0x9c, 0xae, 0xa2, 0x5a, 0xc6, 0xe0, 0x6b, 0xfc, 0x11, 0xe4, 0x7b, 0x74, 0x34, 0xb2, 0x19, 0x23, + 0xfd, 0xaf, 0x4d, 0x56, 0xce, 0x54, 0x51, 0x2d, 0xd7, 0x50, 0xf4, 0x30, 0x38, 0x3d, 0x0a, 0x4e, + 0xef, 0x44, 0xd1, 0xb7, 0x36, 0x82, 0x08, 0x7e, 0xb9, 0xae, 0x20, 0x23, 0x17, 0x23, 0x9b, 0x4c, + 0xfb, 0x12, 0x72, 0x41, 0xc0, 0x06, 0x39, 0x19, 0x07, 0xbe, 0xd6, 0x18, 0xb7, 0x76, 0x08, 0xf9, + 0x90, 0xda, 0x77, 0xa9, 0xe3, 0x13, 0xfc, 0x21, 0x48, 0xb6, 0x33, 0xa0, 0x9c, 0x39, 0xd7, 0x78, + 0x47, 0xff, 0xff, 0xfe, 0xe8, 0x01, 0xb6, 0x25, 0x05, 0xfe, 0x0d, 0x8e, 0xd3, 0x4a, 0x80, 0x3f, + 0xb5, 0x7d, 0xd6, 0x0e, 0x4d, 0x44, 0xc4, 0xda, 0xe7, 0x50, 0x9c, 0x39, 0x9d, 0x73, 0x96, 0x79, + 0x90, 0xb3, 0x2e, 0x94, 0x76, 0xc9, 0x90, 0x30, 0x32, 0xeb, 0x6e, 0xad, 0x05, 0xfa, 0x19, 0x01, + 0x36, 0x88, 0xd9, 0x7f, 0x79, 0x2e, 0xf0, 0x16, 0xc8, 0x74, 0x30, 0xf0, 0x09, 0x13, 0xea, 0x11, + 0xbb, 0x58, 0x53, 0x99, 0xa9, 0xa6, 0xb4, 0x26, 0x14, 0x67, 0xa2, 0x11, 0x95, 0x9c, 0x52, 0xa0, + 0xdb, 0x14, 0x7d, 0x93, 0x99, 0x9c, 0x38, 0x6f, 0xf0, 0xb5, 0xf6, 0x6b, 0x1a, 0xe4, 0x23, 0x66, + 0xb2, 0xb1, 0x8f, 0xdb, 0x00, 0x3e, 0x33, 0x3d, 0xa1, 0x4f, 0xb4, 0x82, 0x3e, 0x37, 0x05, 0xae, + 0xc9, 0x02, 0x92, 0xb1, 0xdb, 0x37, 0x05, 0x49, 0x7a, 0x15, 0x12, 0x81, 0x6b, 0x32, 0x5c, 0x80, + 0x8c, 0x47, 0x06, 0x3c, 0xd5, 0x4d, 0x23, 0x58, 0x26, 0x52, 0x92, 0x66, 0x52, 0x2a, 0x41, 0x96, + 0x51, 0x66, 0x0e, 0xcb, 0x59, 0x7e, 0x1c, 0x6e, 0xf0, 0x21, 0x6c, 0x90, 0x6f, 0x5d, 0xd2, 0x63, + 0xa4, 0x5f, 0x96, 0x1f, 0xdc, 0x91, 0x98, 0x43, 0x7b, 0x0f, 0x5e, 0x0d, 0x6b, 0x14, 0x35, 0x7c, + 0x0b, 0xe4, 0x81, 0x3d, 0x64, 0xc4, 0x0b, 0x1b, 0x6e, 0x88, 0x9d, 0xf6, 0x15, 0x3c, 0x89, 0x0c, + 0x45, 0x2f, 0x3e, 0x86, 0x0d, 0x9f, 0x9f, 0x10, 0x5f, 0x28, 0xfb, 0xdd, 0x45, 0xca, 0x0e, 0x19, + 0x84, 0xb6, 0x63, 0xb4, 0xf6, 0x2f, 0x82, 0xe2, 0xb1, 0x67, 0xcf, 0xe9, 0xbb, 0x0d, 0xb2, 0xd9, + 0x63, 0x36, 0x75, 0x78, 0x2c, 0x4f, 0x1a, 0xcf, 0x16, 0xf1, 0x73, 0x92, 0x26, 0x87, 0x18, 0x02, + 0x1a, 0x55, 0x3c, 0x3d, 0xad, 0x78, 0x5c, 0xd9, 0xcc, 0x7d, 0x95, 0x95, 0x1e, 0x5f, 0xd9, 0x44, + 0x5f, 0xb3, 0x77, 0x4a, 0x55, 0x4e, 0x48, 0xf5, 0x3a, 0x0d, 0xa5, 0xd9, 0x02, 0x88, 0x1a, 0xaf, + 0xa5, 0x02, 0xb3, 0xea, 0x4f, 0xaf, 0x43, 0xfd, 0x99, 0x87, 0xa9, 0x7f, 0x35, 0xad, 0x4f, 0xdf, + 0x1e, 0xf9, 0xd1, 0xcf, 0x5b, 0x15, 0xf2, 0xcd, 0x2e, 0xf5, 0x62, 0x69, 0x09, 0x55, 0xa0, 0x58, + 0x15, 0x4f, 0x7f, 0x44, 0x90, 0x4b, 0x54, 0x0f, 0xbf, 0x05, 0xd2, 0x51, 0xa7, 0xd9, 0x29, 0xa4, + 0x94, 0xe2, 0xd9, 0x79, 0xf5, 0xb5, 0xc4, 0x55, 0xa0, 0x62, 0x5c, 0x81, 0xec, 0xb1, 0xb1, 0xdf, + 0xd9, 0x2b, 0x20, 0xa5, 0x74, 0x76, 0x5e, 0x2d, 0x24, 0xee, 0xf9, 0x12, 0xbf, 0x0d, 0x72, 0xfb, + 0xb3, 0x83, 0x83, 0xfd, 0x4e, 0x21, 0xad, 0xbc, 0x71, 0x76, 0x5e, 0x7d, 0x3d, 0x61, 0xd1, 0xe6, + 0x43, 0x4f, 0x29, 0xfe, 0xf4, 0x9b, 0x9a, 0xfa, 0xf3, 0x77, 0x35, 0xe9, 0xb7, 0x71, 0x99, 0x85, + 0x57, 0x84, 0x0c, 0xb0, 0x29, 0x26, 0xf8, 0xb3, 0x65, 0x46, 0x86, 0x48, 0x4d, 0x79, 0x7f, 0x39, + 0x63, 0xa1, 0xb0, 0x13, 0x90, 0x82, 0x91, 0x85, 0x1b, 0x8b, 0x50, 0xf3, 0xe3, 0x4e, 0xd9, 0x59, + 0x09, 0x13, 0x3a, 0xdc, 0x46, 0xf8, 0x0b, 0x90, 0xc3, 0x71, 0x86, 0x5f, 0x2c, 0x22, 0xb8, 0x6b, + 0xec, 0x29, 0x5b, 0x73, 0xb2, 0xdb, 0x0b, 0xfe, 0xf6, 0x04, 0xa9, 0x04, 0x33, 0x63, 0x71, 0x2a, + 0xf3, 0x73, 0x6e, 0x71, 0x2a, 0x77, 0x4c, 0xa3, 0x6d, 0x84, 0xad, 0x78, 0xc4, 0x3c, 0x5f, 0xee, + 0xed, 0x8b, 0xfc, 0xe9, 0xcb, 0x9a, 0x8b, 0x36, 0x9d, 0x42, 0x36, 0x94, 0xd5, 0xce, 0x52, 0x2f, + 0xc0, 0xad, 0xec, 0x5e, 0xac, 0x06, 0x0a, 0x7d, 0xd6, 0xd0, 0x36, 0xc2, 0x07, 0x90, 0xe5, 0xdf, + 0x0d, 0x5e, 0xa8, 0xaa, 0xe4, 0xe7, 0x75, 0x5f, 0x8b, 0x5a, 0xe5, 0x8b, 0x1b, 0x35, 0xf5, 0xf7, + 0x8d, 0x9a, 0xfa, 0x61, 0xa2, 0xa2, 0x8b, 0x89, 0x8a, 0xfe, 0x9a, 0xa8, 0xe8, 0x9f, 0x89, 0x8a, + 0xba, 0x32, 0xb7, 0xdc, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x80, 0xb2, 0x0e, 0x45, 0x6f, 0x0b, + 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/content/content.proto b/vendor/github.com/containerd/containerd/api/services/content/content.proto index dd250c8300..52b5f63dc0 100644 --- a/vendor/github.com/containerd/containerd/api/services/content/content.proto +++ b/vendor/github.com/containerd/containerd/api/services/content/content.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1; +package containerd.services.content.v1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; @@ -28,7 +28,7 @@ service Content { // Read allows one to read an object based on the offset into the content. // // The requested data may be returned in one or more messages. - rpc Read(ReadRequest) returns (stream ReadResponse); + rpc Read(ReadContentRequest) returns (stream ReadContentResponse); // Status returns the status of ongoing object ingestions, started via // Write. @@ -54,7 +54,7 @@ service Content { // // When completed, the commit flag should be set to true. If expected size // or digest is set, the content will be validated against those values. - rpc Write(stream WriteRequest) returns (stream WriteResponse); + rpc Write(stream WriteContentRequest) returns (stream WriteContentResponse); // Abort cancels the ongoing write named in the request. Any resources // associated with the write will be collected. @@ -91,9 +91,9 @@ message DeleteContentRequest { string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; } -// ReadRequest defines the fields that make up a request to read a portion of +// ReadContentRequest defines the fields that make up a request to read a portion of // data from a stored object. -message ReadRequest { +message ReadContentRequest { // Digest is the hash identity to read. string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; @@ -107,16 +107,12 @@ message ReadRequest { int64 size = 3; } -// ReadResponse carries byte data for a read request. -message ReadResponse { +// ReadContentResponse carries byte data for a read request. +message ReadContentResponse { int64 offset = 1; // offset of the returned data bytes data = 2; // actual data } -message StatusRequest { - string regexp = 1; -} - message Status { google.protobuf.Timestamp started_at = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp updated_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; @@ -126,6 +122,10 @@ message Status { string expected = 6 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; } +message StatusRequest { + string filter = 1; +} + message StatusResponse { repeated Status statuses = 1 [(gogoproto.nullable) = false]; } @@ -157,8 +157,8 @@ enum WriteAction { COMMIT = 2 [(gogoproto.enumvalue_customname) = "WriteActionCommit"]; } -// WriteRequest writes data to the request ref at offset. -message WriteRequest { +// WriteContentRequest writes data to the request ref at offset. +message WriteContentRequest { // Action sets the behavior of the write. // // When this is a write and the ref is not yet allocated, the ref will be @@ -215,8 +215,8 @@ message WriteRequest { bytes data = 6; } -// WriteResponse is returned on the culmination of a write call. -message WriteResponse { +// WriteContentResponse is returned on the culmination of a write call. +message WriteContentResponse { // Action contains the action for the final message of the stream. A writer // should confirm that they match the intended result. WriteAction action = 1; diff --git a/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go b/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go index 1891bac5e6..991e02682a 100644 --- a/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/diff/diff.pb.go @@ -96,10 +96,10 @@ func (*DiffResponse) ProtoMessage() {} func (*DiffResponse) Descriptor() ([]byte, []int) { return fileDescriptorDiff, []int{3} } func init() { - proto.RegisterType((*ApplyRequest)(nil), "containerd.v1.ApplyRequest") - proto.RegisterType((*ApplyResponse)(nil), "containerd.v1.ApplyResponse") - proto.RegisterType((*DiffRequest)(nil), "containerd.v1.DiffRequest") - proto.RegisterType((*DiffResponse)(nil), "containerd.v1.DiffResponse") + proto.RegisterType((*ApplyRequest)(nil), "containerd.services.diff.v1.ApplyRequest") + proto.RegisterType((*ApplyResponse)(nil), "containerd.services.diff.v1.ApplyResponse") + proto.RegisterType((*DiffRequest)(nil), "containerd.services.diff.v1.DiffRequest") + proto.RegisterType((*DiffResponse)(nil), "containerd.services.diff.v1.DiffResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -132,7 +132,7 @@ func NewDiffClient(cc *grpc.ClientConn) DiffClient { func (c *diffClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.CallOption) (*ApplyResponse, error) { out := new(ApplyResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Diff/Apply", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.diff.v1.Diff/Apply", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -141,7 +141,7 @@ func (c *diffClient) Apply(ctx context.Context, in *ApplyRequest, opts ...grpc.C func (c *diffClient) Diff(ctx context.Context, in *DiffRequest, opts ...grpc.CallOption) (*DiffResponse, error) { out := new(DiffResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Diff/Diff", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.diff.v1.Diff/Diff", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -174,7 +174,7 @@ func _Diff_Apply_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Diff/Apply", + FullMethod: "/containerd.services.diff.v1.Diff/Apply", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DiffServer).Apply(ctx, req.(*ApplyRequest)) @@ -192,7 +192,7 @@ func _Diff_Diff_Handler(srv interface{}, ctx context.Context, dec func(interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Diff/Diff", + FullMethod: "/containerd.services.diff.v1.Diff/Diff", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DiffServer).Diff(ctx, req.(*DiffRequest)) @@ -201,7 +201,7 @@ func _Diff_Diff_Handler(srv interface{}, ctx context.Context, dec func(interface } var _Diff_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.Diff", + ServiceName: "containerd.services.diff.v1.Diff", HandlerType: (*DiffServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1081,31 +1081,32 @@ func init() { } var fileDescriptorDiff = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0xcf, 0x93, 0x40, - 0x10, 0xfd, 0x56, 0xda, 0xcf, 0x74, 0xdb, 0x26, 0x66, 0xe3, 0x81, 0x50, 0xa5, 0x0d, 0xa7, 0x9e, - 0x40, 0xe9, 0xc9, 0x44, 0x63, 0xac, 0x8d, 0x07, 0x13, 0x2f, 0xc4, 0xbb, 0xa1, 0x30, 0xd0, 0x4d, - 0x80, 0x5d, 0xd9, 0xa5, 0x86, 0x9b, 0x77, 0xff, 0x84, 0x3f, 0xa7, 0x47, 0x8f, 0x1e, 0x2d, 0xbf, - 0xc4, 0xb0, 0x6c, 0x15, 0x9b, 0x26, 0xb6, 0x97, 0xcd, 0xb0, 0xef, 0xcd, 0x9b, 0x37, 0x8f, 0xc5, - 0xaf, 0x52, 0x2a, 0x77, 0xd5, 0xd6, 0x8d, 0x58, 0xee, 0x45, 0xac, 0x90, 0x21, 0x2d, 0xa0, 0x8c, - 0xfb, 0x65, 0xc8, 0xa9, 0x27, 0xa0, 0xdc, 0xd3, 0x08, 0x84, 0x17, 0xd3, 0x24, 0x51, 0x87, 0xcb, - 0x4b, 0x26, 0x19, 0x99, 0xfe, 0x25, 0xba, 0xfb, 0xe7, 0xd6, 0xe3, 0x94, 0xa5, 0x4c, 0x21, 0x5e, - 0x5b, 0x75, 0x24, 0x6b, 0x96, 0x32, 0x96, 0x66, 0xe0, 0xa9, 0xaf, 0x6d, 0x95, 0x78, 0x90, 0x73, - 0x59, 0x6b, 0x70, 0x7e, 0x0e, 0x4a, 0x9a, 0x83, 0x90, 0x61, 0xce, 0x35, 0xe1, 0xe5, 0x55, 0x0e, - 0x65, 0xcd, 0x41, 0x78, 0x39, 0xab, 0x0a, 0xd9, 0x9d, 0xba, 0xfb, 0xdd, 0x0d, 0xdd, 0x31, 0x88, - 0xa8, 0xa4, 0x5c, 0xb2, 0xb2, 0x57, 0x76, 0x3a, 0xce, 0x17, 0x3c, 0x79, 0xc3, 0x79, 0x56, 0x07, - 0xf0, 0xb9, 0x02, 0x21, 0xc9, 0x0a, 0x0f, 0xda, 0x18, 0x4c, 0xb4, 0x40, 0xcb, 0xb1, 0x3f, 0x77, - 0xff, 0xc9, 0xc1, 0x55, 0x7a, 0xee, 0xe6, 0x8f, 0x48, 0xa0, 0xc8, 0xc4, 0xc7, 0xf7, 0xca, 0x9b, - 0x30, 0x1f, 0x2c, 0x8c, 0xe5, 0xd8, 0xb7, 0x2e, 0xb6, 0x7d, 0x68, 0x29, 0x81, 0x66, 0x3a, 0xef, - 0xf1, 0x54, 0x0f, 0x16, 0x9c, 0x15, 0x02, 0xc8, 0x0b, 0xfc, 0x30, 0xe4, 0x3c, 0xa3, 0x10, 0x5f, - 0x3b, 0xfc, 0xc4, 0x77, 0xbe, 0x23, 0x3c, 0xde, 0xd0, 0x24, 0x39, 0x2d, 0xe1, 0xe2, 0x41, 0x06, - 0x89, 0x34, 0xd1, 0x7f, 0xdd, 0x28, 0x1e, 0x79, 0x86, 0x87, 0x25, 0x4d, 0x77, 0xf2, 0x0a, 0xfb, - 0x1d, 0x91, 0x3c, 0xc5, 0x38, 0x87, 0x98, 0x86, 0x9f, 0x5a, 0xcc, 0x34, 0x16, 0x68, 0x39, 0x0a, - 0x46, 0xea, 0xe6, 0x63, 0xcd, 0x81, 0x3c, 0xc2, 0x46, 0x09, 0x89, 0x39, 0x54, 0xf7, 0x6d, 0xe9, - 0xbc, 0xc5, 0x93, 0xce, 0xa1, 0xde, 0xf6, 0x94, 0xb3, 0x71, 0x43, 0xce, 0xfe, 0x37, 0x84, 0x07, - 0xad, 0x0a, 0x59, 0xe3, 0xa1, 0x0a, 0x8f, 0xcc, 0xce, 0x1a, 0xfb, 0xff, 0xd2, 0x7a, 0x72, 0x19, - 0xd4, 0x0e, 0x5e, 0x6b, 0xad, 0xf3, 0x6d, 0x7b, 0x41, 0x5a, 0xb3, 0x8b, 0x58, 0x27, 0xb0, 0x36, - 0x0f, 0x47, 0xfb, 0xee, 0xe7, 0xd1, 0xbe, 0xfb, 0xda, 0xd8, 0xe8, 0xd0, 0xd8, 0xe8, 0x47, 0x63, - 0xa3, 0x5f, 0x8d, 0x8d, 0xb6, 0xf7, 0xea, 0x6d, 0xad, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x61, - 0x65, 0x17, 0x47, 0x85, 0x03, 0x00, 0x00, + // 420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x31, 0x8f, 0x94, 0x40, + 0x14, 0xc7, 0x6f, 0x64, 0xf7, 0xcc, 0xcd, 0x9e, 0x89, 0x99, 0x58, 0x10, 0x2e, 0x72, 0x1b, 0x2a, + 0xce, 0x62, 0xf0, 0xb8, 0xca, 0x44, 0x0b, 0xf5, 0x62, 0x61, 0x62, 0x43, 0xec, 0x4c, 0x34, 0x2c, + 0x3c, 0xb8, 0x49, 0x80, 0x19, 0x99, 0x61, 0x0d, 0x9d, 0x1f, 0xc5, 0xef, 0x62, 0x73, 0xa5, 0xa5, + 0xa5, 0xcb, 0x27, 0x31, 0x0c, 0x83, 0x12, 0x63, 0xf6, 0xd8, 0x66, 0xf2, 0x98, 0xf7, 0x7b, 0xef, + 0xfd, 0xdf, 0x9f, 0xc1, 0x2f, 0x72, 0xa6, 0x6e, 0x9a, 0x0d, 0x4d, 0x78, 0x19, 0x24, 0xbc, 0x52, + 0x31, 0xab, 0xa0, 0x4e, 0xa7, 0x61, 0x2c, 0x58, 0x20, 0xa1, 0xde, 0xb2, 0x04, 0x64, 0x90, 0xb2, + 0x2c, 0xd3, 0x07, 0x15, 0x35, 0x57, 0x9c, 0x9c, 0xfd, 0x05, 0xe9, 0x08, 0x51, 0x9d, 0xdf, 0x5e, + 0x3a, 0x8f, 0x72, 0x9e, 0x73, 0xcd, 0x05, 0x7d, 0x34, 0x94, 0x38, 0x67, 0x39, 0xe7, 0x79, 0x01, + 0x81, 0xfe, 0xda, 0x34, 0x59, 0x00, 0xa5, 0x50, 0xad, 0x49, 0x9e, 0xff, 0x9b, 0x54, 0xac, 0x04, + 0xa9, 0xe2, 0x52, 0x18, 0xe0, 0xf9, 0x2c, 0xbd, 0xaa, 0x15, 0x20, 0x83, 0x92, 0x37, 0x95, 0x1a, + 0x4e, 0x53, 0xfd, 0xe6, 0x80, 0xea, 0x14, 0x64, 0x52, 0x33, 0xa1, 0x78, 0x3d, 0x09, 0x87, 0x3e, + 0xde, 0x17, 0x7c, 0xfa, 0x52, 0x88, 0xa2, 0x8d, 0xe0, 0x73, 0x03, 0x52, 0x91, 0x2b, 0xbc, 0xe8, + 0x97, 0xb6, 0xd1, 0x1a, 0xf9, 0xab, 0xf0, 0x9c, 0x4e, 0x5c, 0xd9, 0x5e, 0x52, 0xdd, 0x8f, 0x5e, + 0xff, 0x69, 0x12, 0x69, 0x98, 0x84, 0xf8, 0x58, 0x6b, 0x93, 0xf6, 0xbd, 0xb5, 0xe5, 0xaf, 0x42, + 0xe7, 0xbf, 0x65, 0xef, 0x7a, 0x24, 0x32, 0xa4, 0xf7, 0x16, 0x3f, 0x30, 0x83, 0xa5, 0xe0, 0x95, + 0x04, 0xf2, 0x0c, 0xdf, 0x8f, 0x85, 0x28, 0x18, 0xa4, 0x73, 0x87, 0x8f, 0xbc, 0xf7, 0x0d, 0xe1, + 0xd5, 0x35, 0xcb, 0xb2, 0x71, 0x09, 0x8a, 0x17, 0x05, 0x64, 0xca, 0x46, 0x77, 0xaa, 0xd1, 0x1c, + 0x79, 0x8a, 0x97, 0x35, 0xcb, 0x6f, 0xd4, 0x0c, 0xf9, 0x03, 0x48, 0x1e, 0x63, 0x5c, 0x42, 0xca, + 0xe2, 0x4f, 0x7d, 0xce, 0xb6, 0xd6, 0xc8, 0x3f, 0x89, 0x4e, 0xf4, 0xcd, 0xfb, 0x56, 0x00, 0x79, + 0x88, 0xad, 0x1a, 0x32, 0x7b, 0xa9, 0xef, 0xfb, 0xd0, 0x7b, 0x8d, 0x4f, 0x07, 0x85, 0x66, 0xdb, + 0xd1, 0x67, 0xeb, 0x00, 0x9f, 0xc3, 0xef, 0x08, 0x2f, 0xfa, 0x2e, 0xe4, 0x23, 0x5e, 0x6a, 0xf3, + 0xc8, 0x05, 0xdd, 0xf3, 0x6c, 0xe9, 0xf4, 0xcf, 0x3a, 0x4f, 0xe6, 0xa0, 0x46, 0xdd, 0x07, 0x33, + 0xc7, 0xdf, 0x5b, 0x33, 0xb1, 0xdc, 0xb9, 0x98, 0x41, 0x0e, 0xcd, 0x5f, 0xd9, 0xb7, 0x3b, 0xf7, + 0xe8, 0xe7, 0xce, 0x3d, 0xfa, 0xda, 0xb9, 0xe8, 0xb6, 0x73, 0xd1, 0x8f, 0xce, 0x45, 0xbf, 0x3a, + 0x17, 0x6d, 0x8e, 0xf5, 0x9b, 0xbc, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xee, 0xae, 0xcf, + 0xcb, 0x03, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/diff/diff.proto b/vendor/github.com/containerd/containerd/api/services/diff/diff.proto index 757eb27cbd..ef3fd03957 100644 --- a/vendor/github.com/containerd/containerd/api/services/diff/diff.proto +++ b/vendor/github.com/containerd/containerd/api/services/diff/diff.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1; +package containerd.services.diff.v1; import "gogoproto/gogo.proto"; import "google/protobuf/empty.proto"; diff --git a/vendor/github.com/containerd/containerd/api/services/events/events.pb.go b/vendor/github.com/containerd/containerd/api/services/events/events.pb.go new file mode 100644 index 0000000000..724f048c59 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/events/events.pb.go @@ -0,0 +1,407 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/events/events.proto +// DO NOT EDIT! + +/* + Package events is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/events/events.proto + + It has these top-level messages: + StreamEventsRequest +*/ +package events + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import containerd_v1_types "github.com/containerd/containerd/api/types/event" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type StreamEventsRequest struct { +} + +func (m *StreamEventsRequest) Reset() { *m = StreamEventsRequest{} } +func (*StreamEventsRequest) ProtoMessage() {} +func (*StreamEventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorEvents, []int{0} } + +func init() { + proto.RegisterType((*StreamEventsRequest)(nil), "containerd.services.events.v1.StreamEventsRequest") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Events service + +type EventsClient interface { + Stream(ctx context.Context, in *StreamEventsRequest, opts ...grpc.CallOption) (Events_StreamClient, error) +} + +type eventsClient struct { + cc *grpc.ClientConn +} + +func NewEventsClient(cc *grpc.ClientConn) EventsClient { + return &eventsClient{cc} +} + +func (c *eventsClient) Stream(ctx context.Context, in *StreamEventsRequest, opts ...grpc.CallOption) (Events_StreamClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Events_serviceDesc.Streams[0], c.cc, "/containerd.services.events.v1.Events/Stream", opts...) + if err != nil { + return nil, err + } + x := &eventsStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Events_StreamClient interface { + Recv() (*containerd_v1_types.Envelope, error) + grpc.ClientStream +} + +type eventsStreamClient struct { + grpc.ClientStream +} + +func (x *eventsStreamClient) Recv() (*containerd_v1_types.Envelope, error) { + m := new(containerd_v1_types.Envelope) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Events service + +type EventsServer interface { + Stream(*StreamEventsRequest, Events_StreamServer) error +} + +func RegisterEventsServer(s *grpc.Server, srv EventsServer) { + s.RegisterService(&_Events_serviceDesc, srv) +} + +func _Events_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(StreamEventsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(EventsServer).Stream(m, &eventsStreamServer{stream}) +} + +type Events_StreamServer interface { + Send(*containerd_v1_types.Envelope) error + grpc.ServerStream +} + +type eventsStreamServer struct { + grpc.ServerStream +} + +func (x *eventsStreamServer) Send(m *containerd_v1_types.Envelope) error { + return x.ServerStream.SendMsg(m) +} + +var _Events_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.events.v1.Events", + HandlerType: (*EventsServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _Events_Stream_Handler, + ServerStreams: true, + }, + }, + Metadata: "github.com/containerd/containerd/api/services/events/events.proto", +} + +func (m *StreamEventsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StreamEventsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func encodeFixed64Events(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Events(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *StreamEventsRequest) Size() (n int) { + var l int + _ = l + return n +} + +func sovEvents(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StreamEventsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StreamEventsRequest{`, + `}`, + }, "") + return s +} +func valueToStringEvents(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *StreamEventsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StreamEventsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StreamEventsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEvents + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEvents(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/events/events.proto", fileDescriptorEvents) +} + +var fileDescriptorEvents = []byte{ + // 194 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4c, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, + 0xa7, 0x96, 0xa5, 0xe6, 0x95, 0xc0, 0x28, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x59, 0x84, + 0x62, 0x3d, 0x98, 0x42, 0x3d, 0xa8, 0x8a, 0x32, 0x43, 0x29, 0x1b, 0xa2, 0x6c, 0x28, 0xa9, 0x2c, + 0x80, 0x19, 0x0f, 0x21, 0x21, 0x86, 0x2b, 0x89, 0x72, 0x09, 0x07, 0x97, 0x14, 0xa5, 0x26, 0xe6, + 0xba, 0x82, 0x0d, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x31, 0x4a, 0xe7, 0x62, 0x83, 0x08, + 0x08, 0xc5, 0x72, 0xb1, 0x41, 0x14, 0x08, 0x19, 0xe9, 0xe1, 0x75, 0x88, 0x1e, 0x16, 0x73, 0xa4, + 0x64, 0x91, 0xf5, 0x94, 0x19, 0xea, 0x81, 0x9d, 0xa1, 0xe7, 0x9a, 0x57, 0x96, 0x9a, 0x93, 0x5f, + 0x90, 0x6a, 0xc0, 0xe8, 0x24, 0x71, 0xe2, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d, 0x8f, + 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x24, + 0x36, 0xb0, 0x03, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0x06, 0x73, 0x76, 0x42, 0x01, + 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/services/events/events.proto b/vendor/github.com/containerd/containerd/api/services/events/events.proto new file mode 100644 index 0000000000..ddbecefa9f --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/services/events/events.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package containerd.services.events.v1; + +import "github.com/containerd/containerd/api/types/event/event.proto"; + +service Events { + rpc Stream(StreamEventsRequest) returns (stream containerd.v1.types.Envelope); +} + +message StreamEventsRequest {} diff --git a/vendor/github.com/containerd/containerd/api/services/images/images.pb.go b/vendor/github.com/containerd/containerd/api/services/images/images.pb.go index 451a9a1d14..5f82fd7e8b 100644 --- a/vendor/github.com/containerd/containerd/api/services/images/images.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/images/images.pb.go @@ -10,12 +10,13 @@ It has these top-level messages: Image - GetRequest - GetResponse - PutRequest - ListRequest - ListResponse - DeleteRequest + GetImageRequest + GetImageResponse + UpdateImageRequest + UpdateImageResponse + ListImagesRequest + ListImagesResponse + DeleteImageRequest */ package images @@ -24,8 +25,7 @@ import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" -import _ "github.com/containerd/containerd/api/types/mount" -import containerd_v1_types1 "github.com/containerd/containerd/api/types/descriptor" +import containerd_v1_types "github.com/containerd/containerd/api/types/descriptor" import ( context "golang.org/x/net/context" @@ -34,6 +34,7 @@ import ( import strings "strings" import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import io "io" @@ -49,70 +50,80 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type Image struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Labels string `protobuf:"bytes,2,opt,name=labels,proto3" json:"labels,omitempty"` - Target containerd_v1_types1.Descriptor `protobuf:"bytes,3,opt,name=target" json:"target"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Target containerd_v1_types.Descriptor `protobuf:"bytes,3,opt,name=target" json:"target"` } func (m *Image) Reset() { *m = Image{} } func (*Image) ProtoMessage() {} func (*Image) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{0} } -type GetRequest struct { +type GetImageRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (*GetRequest) ProtoMessage() {} -func (*GetRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{1} } +func (m *GetImageRequest) Reset() { *m = GetImageRequest{} } +func (*GetImageRequest) ProtoMessage() {} +func (*GetImageRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{1} } -type GetResponse struct { +type GetImageResponse struct { Image *Image `protobuf:"bytes,1,opt,name=image" json:"image,omitempty"` } -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (*GetResponse) ProtoMessage() {} -func (*GetResponse) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{2} } +func (m *GetImageResponse) Reset() { *m = GetImageResponse{} } +func (*GetImageResponse) ProtoMessage() {} +func (*GetImageResponse) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{2} } -type PutRequest struct { +type UpdateImageRequest struct { Image Image `protobuf:"bytes,1,opt,name=image" json:"image"` } -func (m *PutRequest) Reset() { *m = PutRequest{} } -func (*PutRequest) ProtoMessage() {} -func (*PutRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{3} } +func (m *UpdateImageRequest) Reset() { *m = UpdateImageRequest{} } +func (*UpdateImageRequest) ProtoMessage() {} +func (*UpdateImageRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{3} } -type ListRequest struct { +type UpdateImageResponse struct { + Image Image `protobuf:"bytes,1,opt,name=image" json:"image"` +} + +func (m *UpdateImageResponse) Reset() { *m = UpdateImageResponse{} } +func (*UpdateImageResponse) ProtoMessage() {} +func (*UpdateImageResponse) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{4} } + +type ListImagesRequest struct { + Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` } -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{4} } +func (m *ListImagesRequest) Reset() { *m = ListImagesRequest{} } +func (*ListImagesRequest) ProtoMessage() {} +func (*ListImagesRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{5} } -type ListResponse struct { +type ListImagesResponse struct { Images []Image `protobuf:"bytes,1,rep,name=images" json:"images"` } -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{5} } +func (m *ListImagesResponse) Reset() { *m = ListImagesResponse{} } +func (*ListImagesResponse) ProtoMessage() {} +func (*ListImagesResponse) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{6} } -type DeleteRequest struct { +type DeleteImageRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{6} } +func (m *DeleteImageRequest) Reset() { *m = DeleteImageRequest{} } +func (*DeleteImageRequest) ProtoMessage() {} +func (*DeleteImageRequest) Descriptor() ([]byte, []int) { return fileDescriptorImages, []int{7} } func init() { - proto.RegisterType((*Image)(nil), "containerd.v1.Image") - proto.RegisterType((*GetRequest)(nil), "containerd.v1.GetRequest") - proto.RegisterType((*GetResponse)(nil), "containerd.v1.GetResponse") - proto.RegisterType((*PutRequest)(nil), "containerd.v1.PutRequest") - proto.RegisterType((*ListRequest)(nil), "containerd.v1.ListRequest") - proto.RegisterType((*ListResponse)(nil), "containerd.v1.ListResponse") - proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.DeleteRequest") + proto.RegisterType((*Image)(nil), "containerd.services.images.v1.Image") + proto.RegisterType((*GetImageRequest)(nil), "containerd.services.images.v1.GetImageRequest") + proto.RegisterType((*GetImageResponse)(nil), "containerd.services.images.v1.GetImageResponse") + proto.RegisterType((*UpdateImageRequest)(nil), "containerd.services.images.v1.UpdateImageRequest") + proto.RegisterType((*UpdateImageResponse)(nil), "containerd.services.images.v1.UpdateImageResponse") + proto.RegisterType((*ListImagesRequest)(nil), "containerd.services.images.v1.ListImagesRequest") + proto.RegisterType((*ListImagesResponse)(nil), "containerd.services.images.v1.ListImagesResponse") + proto.RegisterType((*DeleteImageRequest)(nil), "containerd.services.images.v1.DeleteImageRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -127,14 +138,14 @@ const _ = grpc.SupportPackageIsVersion4 type ImagesClient interface { // Get returns an image by name. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + Get(ctx context.Context, in *GetImageRequest, opts ...grpc.CallOption) (*GetImageResponse, error) // List returns a list of all images known to containerd. - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) - // Put assigns the name to a given target image based on the provided + List(ctx context.Context, in *ListImagesRequest, opts ...grpc.CallOption) (*ListImagesResponse, error) + // Update assigns the name to a given target image based on the provided // image. - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Update(ctx context.Context, in *UpdateImageRequest, opts ...grpc.CallOption) (*UpdateImageResponse, error) // Delete deletes the image by name. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Delete(ctx context.Context, in *DeleteImageRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } type imagesClient struct { @@ -145,36 +156,36 @@ func NewImagesClient(cc *grpc.ClientConn) ImagesClient { return &imagesClient{cc} } -func (c *imagesClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { - out := new(GetResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Images/Get", in, out, c.cc, opts...) +func (c *imagesClient) Get(ctx context.Context, in *GetImageRequest, opts ...grpc.CallOption) (*GetImageResponse, error) { + out := new(GetImageResponse) + err := grpc.Invoke(ctx, "/containerd.services.images.v1.Images/Get", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *imagesClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Images/List", in, out, c.cc, opts...) +func (c *imagesClient) List(ctx context.Context, in *ListImagesRequest, opts ...grpc.CallOption) (*ListImagesResponse, error) { + out := new(ListImagesResponse) + err := grpc.Invoke(ctx, "/containerd.services.images.v1.Images/List", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *imagesClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { - out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.Images/Put", in, out, c.cc, opts...) +func (c *imagesClient) Update(ctx context.Context, in *UpdateImageRequest, opts ...grpc.CallOption) (*UpdateImageResponse, error) { + out := new(UpdateImageResponse) + err := grpc.Invoke(ctx, "/containerd.services.images.v1.Images/Update", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *imagesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *imagesClient) Delete(ctx context.Context, in *DeleteImageRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.Images/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.images.v1.Images/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -185,14 +196,14 @@ func (c *imagesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...gr type ImagesServer interface { // Get returns an image by name. - Get(context.Context, *GetRequest) (*GetResponse, error) + Get(context.Context, *GetImageRequest) (*GetImageResponse, error) // List returns a list of all images known to containerd. - List(context.Context, *ListRequest) (*ListResponse, error) - // Put assigns the name to a given target image based on the provided + List(context.Context, *ListImagesRequest) (*ListImagesResponse, error) + // Update assigns the name to a given target image based on the provided // image. - Put(context.Context, *PutRequest) (*google_protobuf1.Empty, error) + Update(context.Context, *UpdateImageRequest) (*UpdateImageResponse, error) // Delete deletes the image by name. - Delete(context.Context, *DeleteRequest) (*google_protobuf1.Empty, error) + Delete(context.Context, *DeleteImageRequest) (*google_protobuf1.Empty, error) } func RegisterImagesServer(s *grpc.Server, srv ImagesServer) { @@ -200,7 +211,7 @@ func RegisterImagesServer(s *grpc.Server, srv ImagesServer) { } func _Images_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) + in := new(GetImageRequest) if err := dec(in); err != nil { return nil, err } @@ -209,16 +220,16 @@ func _Images_Get_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Images/Get", + FullMethod: "/containerd.services.images.v1.Images/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImagesServer).Get(ctx, req.(*GetRequest)) + return srv.(ImagesServer).Get(ctx, req.(*GetImageRequest)) } return interceptor(ctx, in, info, handler) } func _Images_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) + in := new(ListImagesRequest) if err := dec(in); err != nil { return nil, err } @@ -227,34 +238,34 @@ func _Images_List_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Images/List", + FullMethod: "/containerd.services.images.v1.Images/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImagesServer).List(ctx, req.(*ListRequest)) + return srv.(ImagesServer).List(ctx, req.(*ListImagesRequest)) } return interceptor(ctx, in, info, handler) } -func _Images_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) +func _Images_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateImageRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ImagesServer).Put(ctx, in) + return srv.(ImagesServer).Update(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Images/Put", + FullMethod: "/containerd.services.images.v1.Images/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImagesServer).Put(ctx, req.(*PutRequest)) + return srv.(ImagesServer).Update(ctx, req.(*UpdateImageRequest)) } return interceptor(ctx, in, info, handler) } func _Images_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) + in := new(DeleteImageRequest) if err := dec(in); err != nil { return nil, err } @@ -263,16 +274,16 @@ func _Images_Delete_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Images/Delete", + FullMethod: "/containerd.services.images.v1.Images/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImagesServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(ImagesServer).Delete(ctx, req.(*DeleteImageRequest)) } return interceptor(ctx, in, info, handler) } var _Images_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.Images", + ServiceName: "containerd.services.images.v1.Images", HandlerType: (*ImagesServer)(nil), Methods: []grpc.MethodDesc{ { @@ -284,8 +295,8 @@ var _Images_serviceDesc = grpc.ServiceDesc{ Handler: _Images_List_Handler, }, { - MethodName: "Put", - Handler: _Images_Put_Handler, + MethodName: "Update", + Handler: _Images_Update_Handler, }, { MethodName: "Delete", @@ -318,10 +329,21 @@ func (m *Image) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], m.Name) } if len(m.Labels) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintImages(dAtA, i, uint64(len(m.Labels))) - i += copy(dAtA[i:], m.Labels) + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovImages(uint64(len(k))) + 1 + len(v) + sovImages(uint64(len(v))) + i = encodeVarintImages(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintImages(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintImages(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } } dAtA[i] = 0x1a i++ @@ -334,7 +356,7 @@ func (m *Image) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *GetRequest) Marshal() (dAtA []byte, err error) { +func (m *GetImageRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -344,7 +366,7 @@ func (m *GetRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetImageRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -358,7 +380,7 @@ func (m *GetRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *GetResponse) Marshal() (dAtA []byte, err error) { +func (m *GetImageResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -368,7 +390,7 @@ func (m *GetResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetImageResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -386,7 +408,7 @@ func (m *GetResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *PutRequest) Marshal() (dAtA []byte, err error) { +func (m *UpdateImageRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -396,7 +418,7 @@ func (m *PutRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *UpdateImageRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -412,7 +434,33 @@ func (m *PutRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ListRequest) Marshal() (dAtA []byte, err error) { +func (m *UpdateImageResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateImageResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintImages(dAtA, i, uint64(m.Image.Size())) + n4, err := m.Image.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + return i, nil +} + +func (m *ListImagesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -422,15 +470,21 @@ func (m *ListRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListImagesRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l + if len(m.Filter) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintImages(dAtA, i, uint64(len(m.Filter))) + i += copy(dAtA[i:], m.Filter) + } return i, nil } -func (m *ListResponse) Marshal() (dAtA []byte, err error) { +func (m *ListImagesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -440,7 +494,7 @@ func (m *ListResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListImagesResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -460,7 +514,7 @@ func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { +func (m *DeleteImageRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -470,7 +524,7 @@ func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *DeleteImageRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -518,16 +572,20 @@ func (m *Image) Size() (n int) { if l > 0 { n += 1 + l + sovImages(uint64(l)) } - l = len(m.Labels) - if l > 0 { - n += 1 + l + sovImages(uint64(l)) + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovImages(uint64(len(k))) + 1 + len(v) + sovImages(uint64(len(v))) + n += mapEntrySize + 1 + sovImages(uint64(mapEntrySize)) + } } l = m.Target.Size() n += 1 + l + sovImages(uint64(l)) return n } -func (m *GetRequest) Size() (n int) { +func (m *GetImageRequest) Size() (n int) { var l int _ = l l = len(m.Name) @@ -537,7 +595,7 @@ func (m *GetRequest) Size() (n int) { return n } -func (m *GetResponse) Size() (n int) { +func (m *GetImageResponse) Size() (n int) { var l int _ = l if m.Image != nil { @@ -547,7 +605,7 @@ func (m *GetResponse) Size() (n int) { return n } -func (m *PutRequest) Size() (n int) { +func (m *UpdateImageRequest) Size() (n int) { var l int _ = l l = m.Image.Size() @@ -555,13 +613,25 @@ func (m *PutRequest) Size() (n int) { return n } -func (m *ListRequest) Size() (n int) { +func (m *UpdateImageResponse) Size() (n int) { var l int _ = l + l = m.Image.Size() + n += 1 + l + sovImages(uint64(l)) return n } -func (m *ListResponse) Size() (n int) { +func (m *ListImagesRequest) Size() (n int) { + var l int + _ = l + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovImages(uint64(l)) + } + return n +} + +func (m *ListImagesResponse) Size() (n int) { var l int _ = l if len(m.Images) > 0 { @@ -573,7 +643,7 @@ func (m *ListResponse) Size() (n int) { return n } -func (m *DeleteRequest) Size() (n int) { +func (m *DeleteImageRequest) Size() (n int) { var l int _ = l l = len(m.Name) @@ -600,68 +670,89 @@ func (this *Image) String() string { if this == nil { return "nil" } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" s := strings.Join([]string{`&Image{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "Descriptor", "containerd_v1_types1.Descriptor", 1), `&`, ``, 1) + `,`, + `Labels:` + mapStringForLabels + `,`, + `Target:` + strings.Replace(strings.Replace(this.Target.String(), "Descriptor", "containerd_v1_types.Descriptor", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *GetRequest) String() string { +func (this *GetImageRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&GetRequest{`, + s := strings.Join([]string{`&GetImageRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `}`, }, "") return s } -func (this *GetResponse) String() string { +func (this *GetImageResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&GetResponse{`, + s := strings.Join([]string{`&GetImageResponse{`, `Image:` + strings.Replace(fmt.Sprintf("%v", this.Image), "Image", "Image", 1) + `,`, `}`, }, "") return s } -func (this *PutRequest) String() string { +func (this *UpdateImageRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PutRequest{`, + s := strings.Join([]string{`&UpdateImageRequest{`, `Image:` + strings.Replace(strings.Replace(this.Image.String(), "Image", "Image", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *ListRequest) String() string { +func (this *UpdateImageResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListRequest{`, + s := strings.Join([]string{`&UpdateImageResponse{`, + `Image:` + strings.Replace(strings.Replace(this.Image.String(), "Image", "Image", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *ListResponse) String() string { +func (this *ListImagesRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListResponse{`, + s := strings.Join([]string{`&ListImagesRequest{`, + `Filter:` + fmt.Sprintf("%v", this.Filter) + `,`, + `}`, + }, "") + return s +} +func (this *ListImagesResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListImagesResponse{`, `Images:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Images), "Image", "Image", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *DeleteRequest) String() string { +func (this *DeleteImageRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&DeleteRequest{`, + s := strings.Join([]string{`&DeleteImageRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `}`, }, "") @@ -737,7 +828,7 @@ func (m *Image) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowImages @@ -747,20 +838,107 @@ func (m *Image) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthImages } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - m.Labels = string(dAtA[iNdEx:postIndex]) + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthImages + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthImages + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } iNdEx = postIndex case 3: if wireType != 2 { @@ -813,7 +991,7 @@ func (m *Image) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetRequest) Unmarshal(dAtA []byte) error { +func (m *GetImageRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -836,10 +1014,10 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetImageRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetImageRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -892,7 +1070,7 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetResponse) Unmarshal(dAtA []byte) error { +func (m *GetImageResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -915,10 +1093,10 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetImageResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetImageResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -975,7 +1153,7 @@ func (m *GetResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *PutRequest) Unmarshal(dAtA []byte) error { +func (m *UpdateImageRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -998,10 +1176,10 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PutRequest: wiretype end group for non-group") + return fmt.Errorf("proto: UpdateImageRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UpdateImageRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1055,7 +1233,7 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListRequest) Unmarshal(dAtA []byte) error { +func (m *UpdateImageResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1078,12 +1256,121 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + return fmt.Errorf("proto: UpdateImageResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: UpdateImageResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthImages + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Image.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipImages(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthImages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListImagesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ListImagesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListImagesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthImages + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipImages(dAtA[iNdEx:]) @@ -1105,7 +1392,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListResponse) Unmarshal(dAtA []byte) error { +func (m *ListImagesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1128,10 +1415,10 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListImagesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListImagesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1186,7 +1473,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { +func (m *DeleteImageRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1209,10 +1496,10 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: DeleteImageRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeleteImageRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1375,32 +1662,38 @@ func init() { } var fileDescriptorImages = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x6f, 0x94, 0x40, - 0x14, 0xde, 0xe9, 0x6e, 0x49, 0x7c, 0xb8, 0x97, 0x49, 0xd3, 0x20, 0x35, 0x94, 0xe0, 0xa5, 0xf1, - 0x30, 0x28, 0x5e, 0x34, 0xa9, 0x35, 0x6e, 0xaa, 0x8d, 0x89, 0x87, 0x86, 0x7f, 0x00, 0xf4, 0x89, - 0x24, 0xc0, 0x20, 0x33, 0x34, 0xe9, 0x4d, 0xff, 0xdd, 0x1e, 0x3d, 0x7a, 0x32, 0x96, 0x5f, 0x62, - 0x98, 0x99, 0xee, 0x6e, 0x71, 0xd5, 0xf6, 0x02, 0xef, 0xcd, 0xfb, 0xbe, 0xef, 0xbd, 0xef, 0xe5, - 0xc1, 0xdb, 0xbc, 0x90, 0x9f, 0xbb, 0x94, 0x65, 0xbc, 0x0a, 0x33, 0x5e, 0xcb, 0xa4, 0xa8, 0xb1, - 0xbd, 0xd8, 0x0c, 0x93, 0xa6, 0x08, 0x05, 0xb6, 0x97, 0x45, 0x86, 0x22, 0x2c, 0xaa, 0x24, 0x5f, - 0xfd, 0x58, 0xd3, 0x72, 0xc9, 0xe9, 0x7c, 0x0d, 0x66, 0x97, 0xcf, 0xdd, 0xbd, 0x9c, 0xe7, 0x5c, - 0x55, 0xc2, 0x21, 0xd2, 0x20, 0xf7, 0x20, 0xe7, 0x3c, 0x2f, 0x31, 0x54, 0x59, 0xda, 0x7d, 0x0a, - 0xb1, 0x6a, 0xe4, 0x95, 0x29, 0x1e, 0xdf, 0x69, 0x08, 0x79, 0xd5, 0xa0, 0x08, 0x2b, 0xde, 0xd5, - 0x52, 0x7f, 0x0d, 0xfb, 0xfd, 0x3d, 0xd8, 0x17, 0x28, 0xb2, 0xb6, 0x68, 0x24, 0x6f, 0x37, 0x42, - 0xad, 0x13, 0xb4, 0xb0, 0xfb, 0x61, 0xf0, 0x45, 0x29, 0xcc, 0xea, 0xa4, 0x42, 0x87, 0xf8, 0xe4, - 0xe8, 0x41, 0xac, 0x62, 0xba, 0x0f, 0x56, 0x99, 0xa4, 0x58, 0x0a, 0x67, 0x47, 0xbd, 0x9a, 0x8c, - 0xbe, 0x06, 0x4b, 0x26, 0x6d, 0x8e, 0xd2, 0x99, 0xfa, 0xe4, 0xc8, 0x8e, 0x0e, 0xd9, 0xad, 0x6d, - 0x30, 0xd5, 0x96, 0x9d, 0xae, 0x7a, 0x2d, 0x66, 0xcb, 0x9f, 0x87, 0x93, 0xd8, 0x90, 0x02, 0x1f, - 0xe0, 0x0c, 0x65, 0x8c, 0x5f, 0x3a, 0x14, 0x72, 0x5b, 0xe3, 0xe0, 0x15, 0xd8, 0x0a, 0x21, 0x1a, - 0x5e, 0x0b, 0xa4, 0x4f, 0x61, 0x57, 0x2d, 0x5f, 0x61, 0xec, 0x68, 0x6f, 0xd4, 0x4e, 0x19, 0x88, - 0x35, 0x24, 0x38, 0x01, 0x38, 0xef, 0x56, 0xe2, 0xcf, 0xee, 0xc0, 0x34, 0xd3, 0x19, 0xfe, 0x1c, - 0xec, 0x8f, 0x85, 0xb8, 0x11, 0x08, 0x16, 0xf0, 0x50, 0xa7, 0x66, 0x94, 0x08, 0x2c, 0x7d, 0x07, - 0x0e, 0xf1, 0xa7, 0xff, 0x51, 0x34, 0xc8, 0xe0, 0x09, 0xcc, 0x4f, 0xb1, 0x44, 0x89, 0xff, 0xb0, - 0x1c, 0x7d, 0xdb, 0x01, 0x4b, 0x91, 0x05, 0x3d, 0x86, 0xe9, 0x19, 0x4a, 0xfa, 0x68, 0x24, 0xbd, - 0xde, 0x99, 0xeb, 0x6e, 0x2b, 0x99, 0x09, 0xdf, 0xc0, 0x6c, 0x98, 0x98, 0x8e, 0x31, 0x1b, 0xae, - 0xdc, 0x83, 0xad, 0x35, 0x23, 0xf0, 0x12, 0xa6, 0xe7, 0xdd, 0x9f, 0xed, 0xd7, 0x5b, 0x75, 0xf7, - 0x99, 0x3e, 0x6c, 0x76, 0x73, 0xd8, 0xec, 0xdd, 0x70, 0xd8, 0xf4, 0x04, 0x2c, 0x6d, 0x94, 0x3e, - 0x1e, 0x91, 0x6f, 0xf9, 0xff, 0x1b, 0x7f, 0xe1, 0x2c, 0xaf, 0xbd, 0xc9, 0x8f, 0x6b, 0x6f, 0xf2, - 0xb5, 0xf7, 0xc8, 0xb2, 0xf7, 0xc8, 0xf7, 0xde, 0x23, 0xbf, 0x7a, 0x8f, 0xa4, 0x96, 0x42, 0xbe, - 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x7b, 0xe2, 0xcf, 0xa0, 0xba, 0x03, 0x00, 0x00, + // 513 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xed, 0xe6, 0xc3, 0x12, 0x93, 0x03, 0x65, 0xa9, 0x2a, 0xcb, 0x08, 0x37, 0xb2, 0x40, 0x8a, + 0x84, 0xb4, 0x26, 0xe6, 0x02, 0x95, 0x90, 0x20, 0x6a, 0x29, 0x48, 0x15, 0x07, 0x23, 0x3e, 0xae, + 0x4e, 0x32, 0x31, 0x56, 0x1d, 0xaf, 0xf1, 0x6e, 0x22, 0xe5, 0xc6, 0x7f, 0xe1, 0xcf, 0xe4, 0xc8, + 0x91, 0x13, 0xd0, 0xfc, 0x12, 0xe4, 0xdd, 0x4d, 0xeb, 0x36, 0x15, 0x49, 0xe0, 0xe4, 0x59, 0xfb, + 0xbd, 0x37, 0x6f, 0xde, 0xae, 0x17, 0x5e, 0xc6, 0x89, 0xfc, 0x3c, 0xe9, 0xb3, 0x01, 0x1f, 0xfb, + 0x03, 0x9e, 0xc9, 0x28, 0xc9, 0xb0, 0x18, 0x56, 0xcb, 0x28, 0x4f, 0x7c, 0x81, 0xc5, 0x34, 0x19, + 0xa0, 0xf0, 0x93, 0x71, 0x14, 0x5f, 0x3c, 0x58, 0x5e, 0x70, 0xc9, 0xe9, 0xfd, 0x4b, 0x30, 0x5b, + 0x02, 0x99, 0x41, 0x4c, 0xbb, 0xce, 0x5e, 0xcc, 0x63, 0xae, 0x90, 0x7e, 0x59, 0x69, 0x92, 0x73, + 0x2f, 0xe6, 0x3c, 0x4e, 0xd1, 0x57, 0xab, 0xfe, 0x64, 0xe4, 0xe3, 0x38, 0x97, 0x33, 0xf3, 0xf1, + 0xd5, 0x46, 0xa6, 0xe4, 0x2c, 0x47, 0xe1, 0x0f, 0x51, 0x0c, 0x8a, 0x24, 0x97, 0xbc, 0xa8, 0x94, + 0x5a, 0xc7, 0xfb, 0x45, 0xa0, 0xf9, 0xa6, 0x34, 0x42, 0x29, 0x34, 0xb2, 0x68, 0x8c, 0x36, 0x69, + 0x93, 0xce, 0xad, 0x50, 0xd5, 0xf4, 0x35, 0x58, 0x69, 0xd4, 0xc7, 0x54, 0xd8, 0xb5, 0x76, 0xbd, + 0xd3, 0x0a, 0x1e, 0xb3, 0xbf, 0x0e, 0xc2, 0x94, 0x12, 0x3b, 0x55, 0x94, 0xe3, 0x4c, 0x16, 0xb3, + 0xd0, 0xf0, 0xe9, 0x73, 0xb0, 0x64, 0x54, 0xc4, 0x28, 0xed, 0x7a, 0x9b, 0x74, 0x5a, 0xc1, 0x41, + 0x55, 0x69, 0xda, 0x65, 0xca, 0x29, 0x3b, 0xba, 0xb0, 0xd7, 0x6b, 0xcc, 0x7f, 0x1e, 0xec, 0x84, + 0x86, 0xe4, 0x3c, 0x83, 0x56, 0x45, 0x95, 0xee, 0x42, 0xfd, 0x0c, 0x67, 0xc6, 0x6a, 0x59, 0xd2, + 0x3d, 0x68, 0x4e, 0xa3, 0x74, 0x82, 0x76, 0x4d, 0xbd, 0xd3, 0x8b, 0xc3, 0xda, 0x53, 0xe2, 0x3d, + 0x84, 0xdb, 0x27, 0x28, 0x95, 0xb3, 0x10, 0xbf, 0x4c, 0x50, 0xc8, 0x9b, 0x46, 0xf5, 0xde, 0xc2, + 0xee, 0x25, 0x4c, 0xe4, 0x3c, 0x13, 0x48, 0x0f, 0xa1, 0xa9, 0x66, 0x53, 0xc0, 0x56, 0xf0, 0x60, + 0x93, 0xe9, 0x43, 0x4d, 0xf1, 0x3e, 0x00, 0x7d, 0x9f, 0x0f, 0x23, 0x89, 0x57, 0x3a, 0xbf, 0xf8, + 0x07, 0x45, 0x13, 0x85, 0xd1, 0xfd, 0x08, 0x77, 0xaf, 0xe8, 0x1a, 0xab, 0xff, 0x2f, 0xfc, 0x08, + 0xee, 0x9c, 0x26, 0x42, 0x27, 0x20, 0x96, 0x7e, 0xf7, 0xc1, 0x1a, 0x25, 0xa9, 0xc4, 0xc2, 0x64, + 0x65, 0x56, 0xde, 0x27, 0xa0, 0x55, 0xb0, 0x31, 0xd1, 0x03, 0x4b, 0xb7, 0xb0, 0x89, 0x3a, 0x2e, + 0xdb, 0xb8, 0x30, 0x4c, 0xaf, 0x03, 0xf4, 0x08, 0x53, 0xbc, 0x96, 0xdb, 0x0d, 0x3b, 0x16, 0x7c, + 0xab, 0x83, 0xa5, 0x0d, 0xd0, 0x11, 0xd4, 0x4f, 0x50, 0x52, 0xb6, 0xa6, 0xdf, 0xb5, 0x73, 0xe0, + 0xf8, 0x1b, 0xe3, 0xcd, 0x80, 0x67, 0xd0, 0x28, 0xc7, 0xa6, 0xeb, 0xfe, 0x83, 0x95, 0x20, 0x9d, + 0xee, 0x16, 0x0c, 0xd3, 0x8c, 0x83, 0xa5, 0x77, 0x9a, 0xae, 0x23, 0xaf, 0x1e, 0x34, 0x27, 0xd8, + 0x86, 0x62, 0x1a, 0xbe, 0x03, 0x4b, 0x47, 0xbf, 0xb6, 0xe1, 0xea, 0x0e, 0x39, 0xfb, 0x4c, 0x5f, + 0x57, 0x6c, 0x79, 0x5d, 0xb1, 0xe3, 0xf2, 0xba, 0xea, 0xd9, 0xf3, 0x73, 0x77, 0xe7, 0xc7, 0xb9, + 0xbb, 0xf3, 0x75, 0xe1, 0x92, 0xf9, 0xc2, 0x25, 0xdf, 0x17, 0x2e, 0xf9, 0xbd, 0x70, 0x49, 0xdf, + 0x52, 0xc8, 0x27, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x75, 0x19, 0x85, 0xd6, 0x60, 0x05, 0x00, + 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/images/images.proto b/vendor/github.com/containerd/containerd/api/services/images/images.proto index 176caccb61..a1ceb7203d 100644 --- a/vendor/github.com/containerd/containerd/api/services/images/images.proto +++ b/vendor/github.com/containerd/containerd/api/services/images/images.proto @@ -1,10 +1,9 @@ syntax = "proto3"; -package containerd.v1; +package containerd.services.images.v1; import "gogoproto/gogo.proto"; import "google/protobuf/empty.proto"; -import "github.com/containerd/containerd/api/types/mount/mount.proto"; import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; // Images is a service that allows one to register images with containerd. @@ -20,59 +19,49 @@ import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; // As such, this can really be considered a "metadata service". service Images { // Get returns an image by name. - rpc Get(GetRequest) returns (GetResponse); + rpc Get(GetImageRequest) returns (GetImageResponse); // List returns a list of all images known to containerd. - rpc List(ListRequest) returns (ListResponse); + rpc List(ListImagesRequest) returns (ListImagesResponse); - // Put assigns the name to a given target image based on the provided + // Update assigns the name to a given target image based on the provided // image. - rpc Put(PutRequest) returns (google.protobuf.Empty); + rpc Update(UpdateImageRequest) returns (UpdateImageResponse); // Delete deletes the image by name. - rpc Delete(DeleteRequest) returns (google.protobuf.Empty); + rpc Delete(DeleteImageRequest) returns (google.protobuf.Empty); } message Image { string name = 1; - string labels = 2; - types.Descriptor target = 3 [(gogoproto.nullable) = false]; + map labels = 2; + containerd.v1.types.Descriptor target = 3 [(gogoproto.nullable) = false]; } -message GetRequest { +message GetImageRequest { string name = 1; - - // TODO(stevvooe): Consider that we may want to have multiple images under - // the same name or multiple names for the same image. This mapping could - // be truly many to many but we'll need a way to identify an entry. - // - // For now, we consider it unique but an intermediary index could be - // created to allow for a dispatch of images. } -message GetResponse { +message GetImageResponse { Image image = 1; } -message PutRequest { +message UpdateImageRequest { Image image = 1 [(gogoproto.nullable) = false]; } -message ListRequest { - // TODO(stevvooe): empty for now, need to ad filtration - // Some common use cases we might consider: - // - // 1. Select by multiple names. - // 2. Select by platform. - // 3. Select by annotations. +message UpdateImageResponse { + Image image = 1 [(gogoproto.nullable) = false]; } -message ListResponse { - repeated Image images = 1 [(gogoproto.nullable) = false]; +message ListImagesRequest { + string filter = 1; +} - // TODO(stevvooe): Add pagination. +message ListImagesResponse { + repeated Image images = 1 [(gogoproto.nullable) = false]; } -message DeleteRequest { +message DeleteImageRequest { string name = 1; } diff --git a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go index 28a9e3db48..f791d85b70 100644 --- a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.pb.go @@ -152,16 +152,16 @@ func (*DeleteNamespaceRequest) ProtoMessage() {} func (*DeleteNamespaceRequest) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{9} } func init() { - proto.RegisterType((*Namespace)(nil), "containerd.v1.namespaces.Namespace") - proto.RegisterType((*GetNamespaceRequest)(nil), "containerd.v1.namespaces.GetNamespaceRequest") - proto.RegisterType((*GetNamespaceResponse)(nil), "containerd.v1.namespaces.GetNamespaceResponse") - proto.RegisterType((*ListNamespacesRequest)(nil), "containerd.v1.namespaces.ListNamespacesRequest") - proto.RegisterType((*ListNamespacesResponse)(nil), "containerd.v1.namespaces.ListNamespacesResponse") - proto.RegisterType((*CreateNamespaceRequest)(nil), "containerd.v1.namespaces.CreateNamespaceRequest") - proto.RegisterType((*CreateNamespaceResponse)(nil), "containerd.v1.namespaces.CreateNamespaceResponse") - proto.RegisterType((*UpdateNamespaceRequest)(nil), "containerd.v1.namespaces.UpdateNamespaceRequest") - proto.RegisterType((*UpdateNamespaceResponse)(nil), "containerd.v1.namespaces.UpdateNamespaceResponse") - proto.RegisterType((*DeleteNamespaceRequest)(nil), "containerd.v1.namespaces.DeleteNamespaceRequest") + proto.RegisterType((*Namespace)(nil), "containerd.services.namespaces.v1.Namespace") + proto.RegisterType((*GetNamespaceRequest)(nil), "containerd.services.namespaces.v1.GetNamespaceRequest") + proto.RegisterType((*GetNamespaceResponse)(nil), "containerd.services.namespaces.v1.GetNamespaceResponse") + proto.RegisterType((*ListNamespacesRequest)(nil), "containerd.services.namespaces.v1.ListNamespacesRequest") + proto.RegisterType((*ListNamespacesResponse)(nil), "containerd.services.namespaces.v1.ListNamespacesResponse") + proto.RegisterType((*CreateNamespaceRequest)(nil), "containerd.services.namespaces.v1.CreateNamespaceRequest") + proto.RegisterType((*CreateNamespaceResponse)(nil), "containerd.services.namespaces.v1.CreateNamespaceResponse") + proto.RegisterType((*UpdateNamespaceRequest)(nil), "containerd.services.namespaces.v1.UpdateNamespaceRequest") + proto.RegisterType((*UpdateNamespaceResponse)(nil), "containerd.services.namespaces.v1.UpdateNamespaceResponse") + proto.RegisterType((*DeleteNamespaceRequest)(nil), "containerd.services.namespaces.v1.DeleteNamespaceRequest") } // Reference imports to suppress errors if they are not otherwise used. @@ -192,7 +192,7 @@ func NewNamespacesClient(cc *grpc.ClientConn) NamespacesClient { func (c *namespacesClient) Get(ctx context.Context, in *GetNamespaceRequest, opts ...grpc.CallOption) (*GetNamespaceResponse, error) { out := new(GetNamespaceResponse) - err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Get", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.namespaces.v1.Namespaces/Get", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -201,7 +201,7 @@ func (c *namespacesClient) Get(ctx context.Context, in *GetNamespaceRequest, opt func (c *namespacesClient) List(ctx context.Context, in *ListNamespacesRequest, opts ...grpc.CallOption) (*ListNamespacesResponse, error) { out := new(ListNamespacesResponse) - err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/List", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.namespaces.v1.Namespaces/List", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -210,7 +210,7 @@ func (c *namespacesClient) List(ctx context.Context, in *ListNamespacesRequest, func (c *namespacesClient) Create(ctx context.Context, in *CreateNamespaceRequest, opts ...grpc.CallOption) (*CreateNamespaceResponse, error) { out := new(CreateNamespaceResponse) - err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Create", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.namespaces.v1.Namespaces/Create", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -219,7 +219,7 @@ func (c *namespacesClient) Create(ctx context.Context, in *CreateNamespaceReques func (c *namespacesClient) Update(ctx context.Context, in *UpdateNamespaceRequest, opts ...grpc.CallOption) (*UpdateNamespaceResponse, error) { out := new(UpdateNamespaceResponse) - err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Update", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.namespaces.v1.Namespaces/Update", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -228,7 +228,7 @@ func (c *namespacesClient) Update(ctx context.Context, in *UpdateNamespaceReques func (c *namespacesClient) Delete(ctx context.Context, in *DeleteNamespaceRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.namespaces.Namespaces/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.namespaces.v1.Namespaces/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -259,7 +259,7 @@ func _Namespaces_Get_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.namespaces.Namespaces/Get", + FullMethod: "/containerd.services.namespaces.v1.Namespaces/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NamespacesServer).Get(ctx, req.(*GetNamespaceRequest)) @@ -277,7 +277,7 @@ func _Namespaces_List_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.namespaces.Namespaces/List", + FullMethod: "/containerd.services.namespaces.v1.Namespaces/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NamespacesServer).List(ctx, req.(*ListNamespacesRequest)) @@ -295,7 +295,7 @@ func _Namespaces_Create_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.namespaces.Namespaces/Create", + FullMethod: "/containerd.services.namespaces.v1.Namespaces/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NamespacesServer).Create(ctx, req.(*CreateNamespaceRequest)) @@ -313,7 +313,7 @@ func _Namespaces_Update_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.namespaces.Namespaces/Update", + FullMethod: "/containerd.services.namespaces.v1.Namespaces/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NamespacesServer).Update(ctx, req.(*UpdateNamespaceRequest)) @@ -331,7 +331,7 @@ func _Namespaces_Delete_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.namespaces.Namespaces/Delete", + FullMethod: "/containerd.services.namespaces.v1.Namespaces/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NamespacesServer).Delete(ctx, req.(*DeleteNamespaceRequest)) @@ -340,7 +340,7 @@ func _Namespaces_Delete_Handler(srv interface{}, ctx context.Context, dec func(i } var _Namespaces_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.namespaces.Namespaces", + ServiceName: "containerd.services.namespaces.v1.Namespaces", HandlerType: (*NamespacesServer)(nil), Methods: []grpc.MethodDesc{ { @@ -1971,38 +1971,39 @@ func init() { } var fileDescriptorNamespace = []byte{ - // 528 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xbd, 0x8e, 0xd3, 0x4c, - 0x14, 0xcd, 0x24, 0xf9, 0x2c, 0xe5, 0xba, 0xf9, 0x34, 0x04, 0x63, 0x19, 0xc9, 0x44, 0xa6, 0x59, - 0x24, 0x18, 0xb3, 0xa1, 0xe1, 0xa7, 0x5b, 0x58, 0x02, 0xd2, 0x42, 0x61, 0x89, 0x7a, 0x35, 0x4e, - 0x26, 0xc6, 0x8a, 0xff, 0xf0, 0x8c, 0x23, 0xa5, 0xe3, 0x0d, 0x78, 0x03, 0x1a, 0x5e, 0x26, 0x25, - 0x25, 0x15, 0x62, 0xf3, 0x24, 0xc8, 0x63, 0x27, 0xce, 0x6e, 0x1c, 0x2b, 0x2b, 0x85, 0xee, 0x8e, - 0x7d, 0x8e, 0xcf, 0xb9, 0xd7, 0xe7, 0x0e, 0xbc, 0xf3, 0x7c, 0xf1, 0x39, 0x73, 0xc9, 0x38, 0x0e, - 0xed, 0x71, 0x1c, 0x09, 0xea, 0x47, 0x2c, 0x9d, 0x6c, 0x97, 0x34, 0xf1, 0x6d, 0xce, 0xd2, 0xb9, - 0x3f, 0x66, 0xdc, 0x8e, 0x68, 0xc8, 0x78, 0x42, 0xaf, 0x95, 0x24, 0x49, 0x63, 0x11, 0x63, 0xbd, - 0xe2, 0x90, 0xf9, 0x29, 0xa9, 0x90, 0x46, 0xdf, 0x8b, 0xbd, 0x58, 0x82, 0xec, 0xbc, 0x2a, 0xf0, - 0xc6, 0x7d, 0x2f, 0x8e, 0xbd, 0x80, 0xd9, 0xf2, 0xe4, 0x66, 0x53, 0x9b, 0x85, 0x89, 0x58, 0x94, - 0x2f, 0x07, 0x37, 0x5f, 0x4e, 0x7d, 0x16, 0x4c, 0x2e, 0x43, 0xca, 0x67, 0x05, 0xc2, 0xfa, 0x81, - 0xa0, 0xf7, 0x71, 0xad, 0x81, 0x31, 0x74, 0x73, 0x41, 0x1d, 0x0d, 0xd0, 0x49, 0xcf, 0x91, 0x35, - 0x1e, 0x81, 0x12, 0x50, 0x97, 0x05, 0x5c, 0x6f, 0x0f, 0x3a, 0x27, 0xea, 0xd0, 0x26, 0xfb, 0x1c, - 0x92, 0xcd, 0x87, 0xc8, 0x85, 0x64, 0x9c, 0x47, 0x22, 0x5d, 0x38, 0x25, 0xdd, 0x78, 0x01, 0xea, - 0xd6, 0x63, 0xfc, 0x3f, 0x74, 0x66, 0x6c, 0x51, 0x4a, 0xe5, 0x25, 0xee, 0xc3, 0x7f, 0x73, 0x1a, - 0x64, 0x4c, 0x6f, 0xcb, 0x67, 0xc5, 0xe1, 0x65, 0xfb, 0x39, 0xb2, 0x1e, 0xc1, 0x9d, 0x11, 0x13, - 0x9b, 0xcf, 0x3b, 0xec, 0x4b, 0xc6, 0xb8, 0xa8, 0xb3, 0x6b, 0x5d, 0x42, 0xff, 0x3a, 0x94, 0x27, - 0x71, 0xc4, 0xf3, 0x36, 0x7a, 0x1b, 0xa7, 0x92, 0xa0, 0x0e, 0x1f, 0x1e, 0xd0, 0xc9, 0x59, 0x77, - 0xf9, 0xfb, 0x41, 0xcb, 0xa9, 0xb8, 0x96, 0x0d, 0x77, 0x2f, 0x7c, 0x5e, 0x29, 0xf0, 0xb5, 0x1b, - 0x0d, 0x94, 0xa9, 0x1f, 0x08, 0x96, 0x96, 0x7e, 0xca, 0x93, 0x35, 0x06, 0xed, 0x26, 0xa1, 0xf4, - 0xf4, 0x1e, 0xa0, 0xd2, 0xd4, 0x91, 0x1c, 0xef, 0x2d, 0x4c, 0x6d, 0x91, 0x2d, 0x0a, 0xda, 0xeb, - 0x94, 0x51, 0xc1, 0x76, 0x86, 0x74, 0xb4, 0xc6, 0x5d, 0xb8, 0xb7, 0x23, 0x71, 0xec, 0xe1, 0x7e, - 0x47, 0xa0, 0x7d, 0x4a, 0x26, 0xff, 0xb2, 0x0f, 0xfc, 0x0a, 0xd4, 0x4c, 0x4a, 0xc8, 0x3d, 0x90, - 0x61, 0x53, 0x87, 0x06, 0x29, 0x56, 0x85, 0xac, 0x57, 0x85, 0xbc, 0xcd, 0x57, 0xe5, 0x03, 0xe5, - 0x33, 0x07, 0x0a, 0x78, 0x5e, 0xe7, 0x43, 0xd8, 0xf1, 0x77, 0xec, 0x21, 0x3c, 0x06, 0xed, 0x0d, - 0x0b, 0x58, 0xcd, 0x0c, 0x6a, 0x02, 0x3f, 0xfc, 0xd6, 0x05, 0xa8, 0xb2, 0x85, 0x27, 0xd0, 0x19, - 0x31, 0x81, 0x9f, 0xec, 0x57, 0xae, 0xd9, 0x24, 0x83, 0x1c, 0x0a, 0x2f, 0x7b, 0xf5, 0xa1, 0x9b, - 0x67, 0x1a, 0x37, 0x5c, 0x06, 0xb5, 0x4b, 0x62, 0x3c, 0x3d, 0x9c, 0x50, 0x4a, 0x85, 0xa0, 0x14, - 0xb1, 0xc3, 0x0d, 0xdc, 0xfa, 0xec, 0x1b, 0xa7, 0xb7, 0x60, 0x54, 0x72, 0xc5, 0x0f, 0x6e, 0x92, - 0xab, 0x8f, 0x68, 0x93, 0xdc, 0xbe, 0xd0, 0x38, 0xa0, 0x14, 0xff, 0xba, 0x49, 0xae, 0x3e, 0x0d, - 0x86, 0xb6, 0x93, 0xd9, 0xf3, 0xfc, 0xee, 0x3f, 0xd3, 0x97, 0x57, 0x66, 0xeb, 0xd7, 0x95, 0xd9, - 0xfa, 0xba, 0x32, 0xd1, 0x72, 0x65, 0xa2, 0x9f, 0x2b, 0x13, 0xfd, 0x59, 0x99, 0xc8, 0x55, 0x24, - 0xf2, 0xd9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x2e, 0xc3, 0x29, 0xaf, 0x06, 0x00, 0x00, + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xcd, 0x26, 0x21, 0x52, 0xc6, 0x17, 0xb4, 0x04, 0x63, 0x19, 0xc9, 0x04, 0x9f, 0x8a, 0x54, + 0xad, 0x45, 0x90, 0xa0, 0x2d, 0xb7, 0x42, 0x29, 0x87, 0x82, 0x90, 0x25, 0x4e, 0x1c, 0x90, 0x93, + 0x4c, 0x5c, 0x13, 0xc7, 0x36, 0xde, 0x75, 0xa4, 0x88, 0x03, 0xfc, 0x0d, 0x17, 0x3e, 0x24, 0x47, + 0x8e, 0x9c, 0x50, 0x9b, 0x2f, 0x41, 0x5e, 0x3b, 0x71, 0xda, 0x18, 0xe1, 0x46, 0xb4, 0xb7, 0x59, + 0xef, 0xcc, 0xbc, 0xb7, 0x4f, 0xef, 0x25, 0xf0, 0xda, 0xf5, 0xc4, 0x69, 0xd2, 0x67, 0x83, 0x70, + 0x62, 0x0d, 0xc2, 0x40, 0x38, 0x5e, 0x80, 0xf1, 0x70, 0xbd, 0x74, 0x22, 0xcf, 0xe2, 0x18, 0x4f, + 0xbd, 0x01, 0x72, 0x2b, 0x70, 0x26, 0xc8, 0x23, 0xe7, 0x42, 0xc9, 0xa2, 0x38, 0x14, 0x21, 0x7d, + 0x58, 0xcc, 0xb0, 0x65, 0x3f, 0x2b, 0xfa, 0xd9, 0xf4, 0xb1, 0xde, 0x71, 0x43, 0x37, 0x94, 0xdd, + 0x56, 0x5a, 0x65, 0x83, 0xfa, 0x7d, 0x37, 0x0c, 0x5d, 0x1f, 0x2d, 0x79, 0xea, 0x27, 0x23, 0x0b, + 0x27, 0x91, 0x98, 0xe5, 0x97, 0xdd, 0xcb, 0x97, 0x23, 0x0f, 0xfd, 0xe1, 0xc7, 0x89, 0xc3, 0xc7, + 0x59, 0x87, 0xf9, 0x83, 0x40, 0xfb, 0xed, 0x12, 0x86, 0x52, 0x68, 0xa6, 0x98, 0x1a, 0xe9, 0x92, + 0x9d, 0xb6, 0x2d, 0x6b, 0xfa, 0x0e, 0x5a, 0xbe, 0xd3, 0x47, 0x9f, 0x6b, 0xf5, 0x6e, 0x63, 0x47, + 0xe9, 0xed, 0xb1, 0x7f, 0x52, 0x65, 0xab, 0x8d, 0xec, 0x44, 0x8e, 0x1e, 0x05, 0x22, 0x9e, 0xd9, + 0xf9, 0x1e, 0x7d, 0x1f, 0x94, 0xb5, 0xcf, 0xf4, 0x36, 0x34, 0xc6, 0x38, 0xcb, 0x31, 0xd3, 0x92, + 0x76, 0xe0, 0xd6, 0xd4, 0xf1, 0x13, 0xd4, 0xea, 0xf2, 0x5b, 0x76, 0x38, 0xa8, 0xef, 0x11, 0xf3, + 0x11, 0xdc, 0x39, 0x46, 0xb1, 0x5a, 0x6f, 0xe3, 0xe7, 0x04, 0xb9, 0x28, 0xe3, 0x6d, 0x9e, 0x42, + 0xe7, 0x62, 0x2b, 0x8f, 0xc2, 0x80, 0xa7, 0xef, 0x69, 0xaf, 0xc8, 0xca, 0x01, 0xa5, 0xb7, 0x7b, + 0x95, 0x27, 0x1d, 0x36, 0xe7, 0xbf, 0x1f, 0xd4, 0xec, 0x62, 0x89, 0x69, 0xc1, 0xdd, 0x13, 0x8f, + 0x17, 0x50, 0x7c, 0x49, 0x4b, 0x85, 0xd6, 0xc8, 0xf3, 0x05, 0xc6, 0x39, 0xb1, 0xfc, 0x64, 0xfa, + 0xa0, 0x5e, 0x1e, 0xc8, 0xc9, 0xd9, 0x00, 0x05, 0xac, 0x46, 0xa4, 0xe0, 0xdb, 0xb0, 0x5b, 0xdb, + 0x62, 0x7e, 0x02, 0xf5, 0x45, 0x8c, 0x8e, 0xc0, 0x0d, 0xd9, 0xfe, 0xbf, 0x14, 0x63, 0xb8, 0xb7, + 0x81, 0x75, 0x6d, 0xba, 0x7f, 0x27, 0xa0, 0xbe, 0x8f, 0x86, 0x37, 0xf2, 0x32, 0xfa, 0x1c, 0x94, + 0x44, 0x62, 0xc9, 0xf4, 0x48, 0x67, 0x2a, 0x3d, 0x9d, 0x65, 0x01, 0x63, 0xcb, 0x80, 0xb1, 0x57, + 0x69, 0xc0, 0xde, 0x38, 0x7c, 0x6c, 0x43, 0xd6, 0x9e, 0xd6, 0xa9, 0x2c, 0x1b, 0x44, 0xaf, 0x4d, + 0x96, 0x5d, 0x50, 0x5f, 0xa2, 0x8f, 0x25, 0xaa, 0x94, 0xc4, 0xa4, 0x77, 0xd6, 0x04, 0x28, 0x8c, + 0x48, 0xa7, 0xd0, 0x38, 0x46, 0x41, 0x9f, 0x56, 0xa0, 0x50, 0x12, 0x44, 0xfd, 0xd9, 0x95, 0xe7, + 0x72, 0x19, 0xbe, 0x40, 0x33, 0x8d, 0x04, 0xad, 0xf2, 0xeb, 0x52, 0x1a, 0x36, 0x7d, 0x7f, 0x8b, + 0xc9, 0x1c, 0xfc, 0x2b, 0xb4, 0x32, 0xd7, 0xd2, 0x2a, 0x4b, 0xca, 0xc3, 0xa4, 0x1f, 0x6c, 0x33, + 0x5a, 0x10, 0xc8, 0xfc, 0x51, 0x89, 0x40, 0xb9, 0xe7, 0x2b, 0x11, 0xf8, 0x9b, 0x0b, 0x3f, 0x40, + 0x2b, 0xf3, 0x4c, 0x25, 0x02, 0xe5, 0xf6, 0xd2, 0xd5, 0x8d, 0x34, 0x1c, 0xa5, 0xff, 0x45, 0x87, + 0xda, 0xfc, 0xdc, 0xa8, 0xfd, 0x3a, 0x37, 0x6a, 0xdf, 0x16, 0x06, 0x99, 0x2f, 0x0c, 0xf2, 0x73, + 0x61, 0x90, 0xb3, 0x85, 0x41, 0xfa, 0x2d, 0xd9, 0xf9, 0xe4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x88, 0x7f, 0xdb, 0x9f, 0x48, 0x07, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto index 4927cff852..7e8d378ca9 100644 --- a/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto +++ b/vendor/github.com/containerd/containerd/api/services/namespaces/namespace.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1.namespaces; +package containerd.services.namespaces.v1; import "gogoproto/gogo.proto"; import "google/protobuf/empty.proto"; @@ -44,7 +44,7 @@ message GetNamespaceResponse { } message ListNamespacesRequest { - string filter = 1; // TODO(stevvooe): Define a filtering syntax to make these queries. + string filter = 1; } message ListNamespacesResponse { diff --git a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go index 2ee996ba1b..a1b16686a9 100644 --- a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.pb.go @@ -9,16 +9,19 @@ github.com/containerd/containerd/api/services/snapshot/snapshots.proto It has these top-level messages: - PrepareRequest + PrepareSnapshotRequest + PrepareSnapshotResponse + ViewSnapshotRequest + ViewSnapshotResponse MountsRequest MountsResponse - RemoveRequest - CommitRequest - StatRequest + RemoveSnapshotRequest + CommitSnapshotRequest + StatSnapshotRequest Info - StatResponse - ListRequest - ListResponse + StatSnapshotResponse + ListSnapshotsRequest + ListSnapshotsResponse UsageRequest UsageResponse */ @@ -73,14 +76,39 @@ func (x Kind) String() string { } func (Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{0} } -type PrepareRequest struct { +type PrepareSnapshotRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` } -func (m *PrepareRequest) Reset() { *m = PrepareRequest{} } -func (*PrepareRequest) ProtoMessage() {} -func (*PrepareRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{0} } +func (m *PrepareSnapshotRequest) Reset() { *m = PrepareSnapshotRequest{} } +func (*PrepareSnapshotRequest) ProtoMessage() {} +func (*PrepareSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{0} } + +type PrepareSnapshotResponse struct { + Mounts []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=mounts" json:"mounts,omitempty"` +} + +func (m *PrepareSnapshotResponse) Reset() { *m = PrepareSnapshotResponse{} } +func (*PrepareSnapshotResponse) ProtoMessage() {} +func (*PrepareSnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{1} } + +type ViewSnapshotRequest struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` +} + +func (m *ViewSnapshotRequest) Reset() { *m = ViewSnapshotRequest{} } +func (*ViewSnapshotRequest) ProtoMessage() {} +func (*ViewSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{2} } + +type ViewSnapshotResponse struct { + Mounts []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=mounts" json:"mounts,omitempty"` +} + +func (m *ViewSnapshotResponse) Reset() { *m = ViewSnapshotResponse{} } +func (*ViewSnapshotResponse) ProtoMessage() {} +func (*ViewSnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{3} } type MountsRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` @@ -88,7 +116,7 @@ type MountsRequest struct { func (m *MountsRequest) Reset() { *m = MountsRequest{} } func (*MountsRequest) ProtoMessage() {} -func (*MountsRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{1} } +func (*MountsRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{4} } type MountsResponse struct { Mounts []*containerd_v1_types.Mount `protobuf:"bytes,1,rep,name=mounts" json:"mounts,omitempty"` @@ -96,66 +124,66 @@ type MountsResponse struct { func (m *MountsResponse) Reset() { *m = MountsResponse{} } func (*MountsResponse) ProtoMessage() {} -func (*MountsResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{2} } +func (*MountsResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{5} } -type RemoveRequest struct { +type RemoveSnapshotRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` } -func (m *RemoveRequest) Reset() { *m = RemoveRequest{} } -func (*RemoveRequest) ProtoMessage() {} -func (*RemoveRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{3} } +func (m *RemoveSnapshotRequest) Reset() { *m = RemoveSnapshotRequest{} } +func (*RemoveSnapshotRequest) ProtoMessage() {} +func (*RemoveSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{6} } -type CommitRequest struct { +type CommitSnapshotRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` } -func (m *CommitRequest) Reset() { *m = CommitRequest{} } -func (*CommitRequest) ProtoMessage() {} -func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{4} } +func (m *CommitSnapshotRequest) Reset() { *m = CommitSnapshotRequest{} } +func (*CommitSnapshotRequest) ProtoMessage() {} +func (*CommitSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{7} } -type StatRequest struct { +type StatSnapshotRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` } -func (m *StatRequest) Reset() { *m = StatRequest{} } -func (*StatRequest) ProtoMessage() {} -func (*StatRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{5} } +func (m *StatSnapshotRequest) Reset() { *m = StatSnapshotRequest{} } +func (*StatSnapshotRequest) ProtoMessage() {} +func (*StatSnapshotRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{8} } type Info struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` - Kind Kind `protobuf:"varint,3,opt,name=kind,proto3,enum=containerd.v1.snapshot.Kind" json:"kind,omitempty"` + Kind Kind `protobuf:"varint,3,opt,name=kind,proto3,enum=containerd.services.snapshots.v1.Kind" json:"kind,omitempty"` Readonly bool `protobuf:"varint,4,opt,name=readonly,proto3" json:"readonly,omitempty"` } func (m *Info) Reset() { *m = Info{} } func (*Info) ProtoMessage() {} -func (*Info) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{6} } +func (*Info) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{9} } -type StatResponse struct { +type StatSnapshotResponse struct { Info Info `protobuf:"bytes,1,opt,name=info" json:"info"` } -func (m *StatResponse) Reset() { *m = StatResponse{} } -func (*StatResponse) ProtoMessage() {} -func (*StatResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{7} } +func (m *StatSnapshotResponse) Reset() { *m = StatSnapshotResponse{} } +func (*StatSnapshotResponse) ProtoMessage() {} +func (*StatSnapshotResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{10} } -type ListRequest struct { +type ListSnapshotsRequest struct { } -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{8} } +func (m *ListSnapshotsRequest) Reset() { *m = ListSnapshotsRequest{} } +func (*ListSnapshotsRequest) ProtoMessage() {} +func (*ListSnapshotsRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{11} } -type ListResponse struct { +type ListSnapshotsResponse struct { Info []Info `protobuf:"bytes,1,rep,name=info" json:"info"` } -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{9} } +func (m *ListSnapshotsResponse) Reset() { *m = ListSnapshotsResponse{} } +func (*ListSnapshotsResponse) ProtoMessage() {} +func (*ListSnapshotsResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{12} } type UsageRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` @@ -163,31 +191,34 @@ type UsageRequest struct { func (m *UsageRequest) Reset() { *m = UsageRequest{} } func (*UsageRequest) ProtoMessage() {} -func (*UsageRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{10} } +func (*UsageRequest) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{13} } type UsageResponse struct { - Inodes int64 `protobuf:"varint,2,opt,name=inodes,proto3" json:"inodes,omitempty"` Size_ int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + Inodes int64 `protobuf:"varint,2,opt,name=inodes,proto3" json:"inodes,omitempty"` } func (m *UsageResponse) Reset() { *m = UsageResponse{} } func (*UsageResponse) ProtoMessage() {} -func (*UsageResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{11} } +func (*UsageResponse) Descriptor() ([]byte, []int) { return fileDescriptorSnapshots, []int{14} } func init() { - proto.RegisterType((*PrepareRequest)(nil), "containerd.v1.snapshot.PrepareRequest") - proto.RegisterType((*MountsRequest)(nil), "containerd.v1.snapshot.MountsRequest") - proto.RegisterType((*MountsResponse)(nil), "containerd.v1.snapshot.MountsResponse") - proto.RegisterType((*RemoveRequest)(nil), "containerd.v1.snapshot.RemoveRequest") - proto.RegisterType((*CommitRequest)(nil), "containerd.v1.snapshot.CommitRequest") - proto.RegisterType((*StatRequest)(nil), "containerd.v1.snapshot.StatRequest") - proto.RegisterType((*Info)(nil), "containerd.v1.snapshot.Info") - proto.RegisterType((*StatResponse)(nil), "containerd.v1.snapshot.StatResponse") - proto.RegisterType((*ListRequest)(nil), "containerd.v1.snapshot.ListRequest") - proto.RegisterType((*ListResponse)(nil), "containerd.v1.snapshot.ListResponse") - proto.RegisterType((*UsageRequest)(nil), "containerd.v1.snapshot.UsageRequest") - proto.RegisterType((*UsageResponse)(nil), "containerd.v1.snapshot.UsageResponse") - proto.RegisterEnum("containerd.v1.snapshot.Kind", Kind_name, Kind_value) + proto.RegisterType((*PrepareSnapshotRequest)(nil), "containerd.services.snapshots.v1.PrepareSnapshotRequest") + proto.RegisterType((*PrepareSnapshotResponse)(nil), "containerd.services.snapshots.v1.PrepareSnapshotResponse") + proto.RegisterType((*ViewSnapshotRequest)(nil), "containerd.services.snapshots.v1.ViewSnapshotRequest") + proto.RegisterType((*ViewSnapshotResponse)(nil), "containerd.services.snapshots.v1.ViewSnapshotResponse") + proto.RegisterType((*MountsRequest)(nil), "containerd.services.snapshots.v1.MountsRequest") + proto.RegisterType((*MountsResponse)(nil), "containerd.services.snapshots.v1.MountsResponse") + proto.RegisterType((*RemoveSnapshotRequest)(nil), "containerd.services.snapshots.v1.RemoveSnapshotRequest") + proto.RegisterType((*CommitSnapshotRequest)(nil), "containerd.services.snapshots.v1.CommitSnapshotRequest") + proto.RegisterType((*StatSnapshotRequest)(nil), "containerd.services.snapshots.v1.StatSnapshotRequest") + proto.RegisterType((*Info)(nil), "containerd.services.snapshots.v1.Info") + proto.RegisterType((*StatSnapshotResponse)(nil), "containerd.services.snapshots.v1.StatSnapshotResponse") + proto.RegisterType((*ListSnapshotsRequest)(nil), "containerd.services.snapshots.v1.ListSnapshotsRequest") + proto.RegisterType((*ListSnapshotsResponse)(nil), "containerd.services.snapshots.v1.ListSnapshotsResponse") + proto.RegisterType((*UsageRequest)(nil), "containerd.services.snapshots.v1.UsageRequest") + proto.RegisterType((*UsageResponse)(nil), "containerd.services.snapshots.v1.UsageResponse") + proto.RegisterEnum("containerd.services.snapshots.v1.Kind", Kind_name, Kind_value) } // Reference imports to suppress errors if they are not otherwise used. @@ -198,87 +229,87 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for Snapshot service +// Client API for Snapshots service -type SnapshotClient interface { - Prepare(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) - View(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) +type SnapshotsClient interface { + Prepare(ctx context.Context, in *PrepareSnapshotRequest, opts ...grpc.CallOption) (*PrepareSnapshotResponse, error) + View(ctx context.Context, in *ViewSnapshotRequest, opts ...grpc.CallOption) (*ViewSnapshotResponse, error) Mounts(ctx context.Context, in *MountsRequest, opts ...grpc.CallOption) (*MountsResponse, error) - Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (Snapshot_ListClient, error) + Commit(ctx context.Context, in *CommitSnapshotRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Remove(ctx context.Context, in *RemoveSnapshotRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) + Stat(ctx context.Context, in *StatSnapshotRequest, opts ...grpc.CallOption) (*StatSnapshotResponse, error) + List(ctx context.Context, in *ListSnapshotsRequest, opts ...grpc.CallOption) (Snapshots_ListClient, error) Usage(ctx context.Context, in *UsageRequest, opts ...grpc.CallOption) (*UsageResponse, error) } -type snapshotClient struct { +type snapshotsClient struct { cc *grpc.ClientConn } -func NewSnapshotClient(cc *grpc.ClientConn) SnapshotClient { - return &snapshotClient{cc} +func NewSnapshotsClient(cc *grpc.ClientConn) SnapshotsClient { + return &snapshotsClient{cc} } -func (c *snapshotClient) Prepare(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) { - out := new(MountsResponse) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Prepare", in, out, c.cc, opts...) +func (c *snapshotsClient) Prepare(ctx context.Context, in *PrepareSnapshotRequest, opts ...grpc.CallOption) (*PrepareSnapshotResponse, error) { + out := new(PrepareSnapshotResponse) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Prepare", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) View(ctx context.Context, in *PrepareRequest, opts ...grpc.CallOption) (*MountsResponse, error) { - out := new(MountsResponse) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/View", in, out, c.cc, opts...) +func (c *snapshotsClient) View(ctx context.Context, in *ViewSnapshotRequest, opts ...grpc.CallOption) (*ViewSnapshotResponse, error) { + out := new(ViewSnapshotResponse) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/View", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) Mounts(ctx context.Context, in *MountsRequest, opts ...grpc.CallOption) (*MountsResponse, error) { +func (c *snapshotsClient) Mounts(ctx context.Context, in *MountsRequest, opts ...grpc.CallOption) (*MountsResponse, error) { out := new(MountsResponse) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Mounts", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Mounts", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *snapshotsClient) Commit(ctx context.Context, in *CommitSnapshotRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Commit", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Commit", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { +func (c *snapshotsClient) Remove(ctx context.Context, in *RemoveSnapshotRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Remove", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Remove", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { - out := new(StatResponse) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Stat", in, out, c.cc, opts...) +func (c *snapshotsClient) Stat(ctx context.Context, in *StatSnapshotRequest, opts ...grpc.CallOption) (*StatSnapshotResponse, error) { + out := new(StatSnapshotResponse) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Stat", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *snapshotClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (Snapshot_ListClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Snapshot_serviceDesc.Streams[0], c.cc, "/containerd.v1.snapshot.Snapshot/List", opts...) +func (c *snapshotsClient) List(ctx context.Context, in *ListSnapshotsRequest, opts ...grpc.CallOption) (Snapshots_ListClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Snapshots_serviceDesc.Streams[0], c.cc, "/containerd.services.snapshots.v1.Snapshots/List", opts...) if err != nil { return nil, err } - x := &snapshotListClient{stream} + x := &snapshotsListClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -288,240 +319,300 @@ func (c *snapshotClient) List(ctx context.Context, in *ListRequest, opts ...grpc return x, nil } -type Snapshot_ListClient interface { - Recv() (*ListResponse, error) +type Snapshots_ListClient interface { + Recv() (*ListSnapshotsResponse, error) grpc.ClientStream } -type snapshotListClient struct { +type snapshotsListClient struct { grpc.ClientStream } -func (x *snapshotListClient) Recv() (*ListResponse, error) { - m := new(ListResponse) +func (x *snapshotsListClient) Recv() (*ListSnapshotsResponse, error) { + m := new(ListSnapshotsResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } -func (c *snapshotClient) Usage(ctx context.Context, in *UsageRequest, opts ...grpc.CallOption) (*UsageResponse, error) { +func (c *snapshotsClient) Usage(ctx context.Context, in *UsageRequest, opts ...grpc.CallOption) (*UsageResponse, error) { out := new(UsageResponse) - err := grpc.Invoke(ctx, "/containerd.v1.snapshot.Snapshot/Usage", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.snapshots.v1.Snapshots/Usage", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// Server API for Snapshot service +// Server API for Snapshots service -type SnapshotServer interface { - Prepare(context.Context, *PrepareRequest) (*MountsResponse, error) - View(context.Context, *PrepareRequest) (*MountsResponse, error) +type SnapshotsServer interface { + Prepare(context.Context, *PrepareSnapshotRequest) (*PrepareSnapshotResponse, error) + View(context.Context, *ViewSnapshotRequest) (*ViewSnapshotResponse, error) Mounts(context.Context, *MountsRequest) (*MountsResponse, error) - Commit(context.Context, *CommitRequest) (*google_protobuf1.Empty, error) - Remove(context.Context, *RemoveRequest) (*google_protobuf1.Empty, error) - Stat(context.Context, *StatRequest) (*StatResponse, error) - List(*ListRequest, Snapshot_ListServer) error + Commit(context.Context, *CommitSnapshotRequest) (*google_protobuf1.Empty, error) + Remove(context.Context, *RemoveSnapshotRequest) (*google_protobuf1.Empty, error) + Stat(context.Context, *StatSnapshotRequest) (*StatSnapshotResponse, error) + List(*ListSnapshotsRequest, Snapshots_ListServer) error Usage(context.Context, *UsageRequest) (*UsageResponse, error) } -func RegisterSnapshotServer(s *grpc.Server, srv SnapshotServer) { - s.RegisterService(&_Snapshot_serviceDesc, srv) +func RegisterSnapshotsServer(s *grpc.Server, srv SnapshotsServer) { + s.RegisterService(&_Snapshots_serviceDesc, srv) } -func _Snapshot_Prepare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrepareRequest) +func _Snapshots_Prepare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareSnapshotRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Prepare(ctx, in) + return srv.(SnapshotsServer).Prepare(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Prepare", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Prepare", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Prepare(ctx, req.(*PrepareRequest)) + return srv.(SnapshotsServer).Prepare(ctx, req.(*PrepareSnapshotRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_View_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrepareRequest) +func _Snapshots_View_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ViewSnapshotRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).View(ctx, in) + return srv.(SnapshotsServer).View(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/View", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/View", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).View(ctx, req.(*PrepareRequest)) + return srv.(SnapshotsServer).View(ctx, req.(*ViewSnapshotRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_Mounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Snapshots_Mounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MountsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Mounts(ctx, in) + return srv.(SnapshotsServer).Mounts(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Mounts", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Mounts", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Mounts(ctx, req.(*MountsRequest)) + return srv.(SnapshotsServer).Mounts(ctx, req.(*MountsRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CommitRequest) +func _Snapshots_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommitSnapshotRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Commit(ctx, in) + return srv.(SnapshotsServer).Commit(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Commit", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Commit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Commit(ctx, req.(*CommitRequest)) + return srv.(SnapshotsServer).Commit(ctx, req.(*CommitSnapshotRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveRequest) +func _Snapshots_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveSnapshotRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Remove(ctx, in) + return srv.(SnapshotsServer).Remove(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Remove", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Remove", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Remove(ctx, req.(*RemoveRequest)) + return srv.(SnapshotsServer).Remove(ctx, req.(*RemoveSnapshotRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatRequest) +func _Snapshots_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatSnapshotRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Stat(ctx, in) + return srv.(SnapshotsServer).Stat(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Stat", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Stat", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Stat(ctx, req.(*StatRequest)) + return srv.(SnapshotsServer).Stat(ctx, req.(*StatSnapshotRequest)) } return interceptor(ctx, in, info, handler) } -func _Snapshot_List_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListRequest) +func _Snapshots_List_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListSnapshotsRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(SnapshotServer).List(m, &snapshotListServer{stream}) + return srv.(SnapshotsServer).List(m, &snapshotsListServer{stream}) } -type Snapshot_ListServer interface { - Send(*ListResponse) error +type Snapshots_ListServer interface { + Send(*ListSnapshotsResponse) error grpc.ServerStream } -type snapshotListServer struct { +type snapshotsListServer struct { grpc.ServerStream } -func (x *snapshotListServer) Send(m *ListResponse) error { +func (x *snapshotsListServer) Send(m *ListSnapshotsResponse) error { return x.ServerStream.SendMsg(m) } -func _Snapshot_Usage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Snapshots_Usage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UsageRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SnapshotServer).Usage(ctx, in) + return srv.(SnapshotsServer).Usage(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.snapshot.Snapshot/Usage", + FullMethod: "/containerd.services.snapshots.v1.Snapshots/Usage", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SnapshotServer).Usage(ctx, req.(*UsageRequest)) + return srv.(SnapshotsServer).Usage(ctx, req.(*UsageRequest)) } return interceptor(ctx, in, info, handler) } -var _Snapshot_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.snapshot.Snapshot", - HandlerType: (*SnapshotServer)(nil), +var _Snapshots_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.snapshots.v1.Snapshots", + HandlerType: (*SnapshotsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Prepare", - Handler: _Snapshot_Prepare_Handler, + Handler: _Snapshots_Prepare_Handler, }, { MethodName: "View", - Handler: _Snapshot_View_Handler, + Handler: _Snapshots_View_Handler, }, { MethodName: "Mounts", - Handler: _Snapshot_Mounts_Handler, + Handler: _Snapshots_Mounts_Handler, }, { MethodName: "Commit", - Handler: _Snapshot_Commit_Handler, + Handler: _Snapshots_Commit_Handler, }, { MethodName: "Remove", - Handler: _Snapshot_Remove_Handler, + Handler: _Snapshots_Remove_Handler, }, { MethodName: "Stat", - Handler: _Snapshot_Stat_Handler, + Handler: _Snapshots_Stat_Handler, }, { MethodName: "Usage", - Handler: _Snapshot_Usage_Handler, + Handler: _Snapshots_Usage_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "List", - Handler: _Snapshot_List_Handler, + Handler: _Snapshots_List_Handler, ServerStreams: true, }, }, Metadata: "github.com/containerd/containerd/api/services/snapshot/snapshots.proto", } -func (m *PrepareRequest) Marshal() (dAtA []byte, err error) { +func (m *PrepareSnapshotRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrepareSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Parent) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(len(m.Parent))) + i += copy(dAtA[i:], m.Parent) + } + return i, nil +} + +func (m *PrepareSnapshotResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PrepareSnapshotResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ViewSnapshotRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -531,7 +622,7 @@ func (m *PrepareRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PrepareRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ViewSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -551,6 +642,36 @@ func (m *PrepareRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *ViewSnapshotResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ViewSnapshotResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Mounts) > 0 { + for _, msg := range m.Mounts { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshots(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + func (m *MountsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -605,7 +726,7 @@ func (m *MountsResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *RemoveRequest) Marshal() (dAtA []byte, err error) { +func (m *RemoveSnapshotRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -615,7 +736,7 @@ func (m *RemoveRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RemoveRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *RemoveSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -629,7 +750,7 @@ func (m *RemoveRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CommitRequest) Marshal() (dAtA []byte, err error) { +func (m *CommitSnapshotRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -639,7 +760,7 @@ func (m *CommitRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CommitRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CommitSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -659,7 +780,7 @@ func (m *CommitRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *StatRequest) Marshal() (dAtA []byte, err error) { +func (m *StatSnapshotRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -669,7 +790,7 @@ func (m *StatRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StatRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *StatSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -728,7 +849,7 @@ func (m *Info) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *StatResponse) Marshal() (dAtA []byte, err error) { +func (m *StatSnapshotResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -738,7 +859,7 @@ func (m *StatResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StatResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *StatSnapshotResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -754,7 +875,7 @@ func (m *StatResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ListRequest) Marshal() (dAtA []byte, err error) { +func (m *ListSnapshotsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -764,7 +885,7 @@ func (m *ListRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListSnapshotsRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -772,7 +893,7 @@ func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ListResponse) Marshal() (dAtA []byte, err error) { +func (m *ListSnapshotsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -782,7 +903,7 @@ func (m *ListResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListSnapshotsResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -881,7 +1002,7 @@ func encodeVarintSnapshots(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *PrepareRequest) Size() (n int) { +func (m *PrepareSnapshotRequest) Size() (n int) { var l int _ = l l = len(m.Key) @@ -895,6 +1016,44 @@ func (m *PrepareRequest) Size() (n int) { return n } +func (m *PrepareSnapshotResponse) Size() (n int) { + var l int + _ = l + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovSnapshots(uint64(l)) + } + } + return n +} + +func (m *ViewSnapshotRequest) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + l = len(m.Parent) + if l > 0 { + n += 1 + l + sovSnapshots(uint64(l)) + } + return n +} + +func (m *ViewSnapshotResponse) Size() (n int) { + var l int + _ = l + if len(m.Mounts) > 0 { + for _, e := range m.Mounts { + l = e.Size() + n += 1 + l + sovSnapshots(uint64(l)) + } + } + return n +} + func (m *MountsRequest) Size() (n int) { var l int _ = l @@ -917,7 +1076,7 @@ func (m *MountsResponse) Size() (n int) { return n } -func (m *RemoveRequest) Size() (n int) { +func (m *RemoveSnapshotRequest) Size() (n int) { var l int _ = l l = len(m.Key) @@ -927,7 +1086,7 @@ func (m *RemoveRequest) Size() (n int) { return n } -func (m *CommitRequest) Size() (n int) { +func (m *CommitSnapshotRequest) Size() (n int) { var l int _ = l l = len(m.Name) @@ -941,7 +1100,7 @@ func (m *CommitRequest) Size() (n int) { return n } -func (m *StatRequest) Size() (n int) { +func (m *StatSnapshotRequest) Size() (n int) { var l int _ = l l = len(m.Key) @@ -971,7 +1130,7 @@ func (m *Info) Size() (n int) { return n } -func (m *StatResponse) Size() (n int) { +func (m *StatSnapshotResponse) Size() (n int) { var l int _ = l l = m.Info.Size() @@ -979,13 +1138,13 @@ func (m *StatResponse) Size() (n int) { return n } -func (m *ListRequest) Size() (n int) { +func (m *ListSnapshotsRequest) Size() (n int) { var l int _ = l return n } -func (m *ListResponse) Size() (n int) { +func (m *ListSnapshotsResponse) Size() (n int) { var l int _ = l if len(m.Info) > 0 { @@ -1032,17 +1191,48 @@ func sovSnapshots(x uint64) (n int) { func sozSnapshots(x uint64) (n int) { return sovSnapshots(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *PrepareRequest) String() string { +func (this *PrepareSnapshotRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PrepareSnapshotRequest{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Parent:` + fmt.Sprintf("%v", this.Parent) + `,`, + `}`, + }, "") + return s +} +func (this *PrepareSnapshotResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PrepareSnapshotResponse{`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ViewSnapshotRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PrepareRequest{`, + s := strings.Join([]string{`&ViewSnapshotRequest{`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `Parent:` + fmt.Sprintf("%v", this.Parent) + `,`, `}`, }, "") return s } +func (this *ViewSnapshotResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ViewSnapshotResponse{`, + `Mounts:` + strings.Replace(fmt.Sprintf("%v", this.Mounts), "Mount", "containerd_v1_types.Mount", 1) + `,`, + `}`, + }, "") + return s +} func (this *MountsRequest) String() string { if this == nil { return "nil" @@ -1063,32 +1253,32 @@ func (this *MountsResponse) String() string { }, "") return s } -func (this *RemoveRequest) String() string { +func (this *RemoveSnapshotRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&RemoveRequest{`, + s := strings.Join([]string{`&RemoveSnapshotRequest{`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `}`, }, "") return s } -func (this *CommitRequest) String() string { +func (this *CommitSnapshotRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CommitRequest{`, + s := strings.Join([]string{`&CommitSnapshotRequest{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `}`, }, "") return s } -func (this *StatRequest) String() string { +func (this *StatSnapshotRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&StatRequest{`, + s := strings.Join([]string{`&StatSnapshotRequest{`, `Key:` + fmt.Sprintf("%v", this.Key) + `,`, `}`, }, "") @@ -1107,30 +1297,30 @@ func (this *Info) String() string { }, "") return s } -func (this *StatResponse) String() string { +func (this *StatSnapshotResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&StatResponse{`, + s := strings.Join([]string{`&StatSnapshotResponse{`, `Info:` + strings.Replace(strings.Replace(this.Info.String(), "Info", "Info", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } -func (this *ListRequest) String() string { +func (this *ListSnapshotsRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListRequest{`, + s := strings.Join([]string{`&ListSnapshotsRequest{`, `}`, }, "") return s } -func (this *ListResponse) String() string { +func (this *ListSnapshotsResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListResponse{`, + s := strings.Join([]string{`&ListSnapshotsResponse{`, `Info:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Info), "Info", "Info", 1), `&`, ``, 1) + `,`, `}`, }, "") @@ -1165,7 +1355,115 @@ func valueToStringSnapshots(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *PrepareRequest) Unmarshal(dAtA []byte) error { +func (m *PrepareSnapshotRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PrepareSnapshotRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrepareSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrepareSnapshotResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1188,10 +1486,91 @@ func (m *PrepareRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PrepareRequest: wiretype end group for non-group") + return fmt.Errorf("proto: PrepareSnapshotResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PrepareRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PrepareSnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &containerd_v1_types.Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ViewSnapshotRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ViewSnapshotRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ViewSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1273,6 +1652,87 @@ func (m *PrepareRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *ViewSnapshotResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ViewSnapshotResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ViewSnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshots + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSnapshots + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Mounts = append(m.Mounts, &containerd_v1_types.Mount{}) + if err := m.Mounts[len(m.Mounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshots(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshots + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MountsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1433,7 +1893,7 @@ func (m *MountsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *RemoveRequest) Unmarshal(dAtA []byte) error { +func (m *RemoveSnapshotRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1456,10 +1916,10 @@ func (m *RemoveRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RemoveRequest: wiretype end group for non-group") + return fmt.Errorf("proto: RemoveSnapshotRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RemoveRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RemoveSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1512,7 +1972,7 @@ func (m *RemoveRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CommitRequest) Unmarshal(dAtA []byte) error { +func (m *CommitSnapshotRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1535,10 +1995,10 @@ func (m *CommitRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CommitRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CommitSnapshotRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CommitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CommitSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1620,7 +2080,7 @@ func (m *CommitRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *StatRequest) Unmarshal(dAtA []byte) error { +func (m *StatSnapshotRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1643,10 +2103,10 @@ func (m *StatRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StatRequest: wiretype end group for non-group") + return fmt.Errorf("proto: StatSnapshotRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StatRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StatSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1846,7 +2306,7 @@ func (m *Info) Unmarshal(dAtA []byte) error { } return nil } -func (m *StatResponse) Unmarshal(dAtA []byte) error { +func (m *StatSnapshotResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1869,10 +2329,10 @@ func (m *StatResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StatResponse: wiretype end group for non-group") + return fmt.Errorf("proto: StatSnapshotResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StatResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StatSnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1926,7 +2386,7 @@ func (m *StatResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListRequest) Unmarshal(dAtA []byte) error { +func (m *ListSnapshotsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1949,10 +2409,10 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ListSnapshotsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListSnapshotsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1976,7 +2436,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListResponse) Unmarshal(dAtA []byte) error { +func (m *ListSnapshotsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1999,10 +2459,10 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListSnapshotsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListSnapshotsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2334,46 +2794,50 @@ func init() { } var fileDescriptorSnapshots = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0xcd, 0x6e, 0x13, 0x31, - 0x10, 0xc7, 0xb3, 0xcd, 0x36, 0xb4, 0x93, 0x26, 0x2a, 0x16, 0xaa, 0xa2, 0x05, 0x6d, 0x97, 0x40, - 0x51, 0xc4, 0x61, 0xb7, 0x04, 0xc1, 0x01, 0xb8, 0xf4, 0x13, 0x55, 0xa5, 0x02, 0xb6, 0xa1, 0x88, - 0xe3, 0x36, 0x71, 0x53, 0xab, 0x5d, 0x7b, 0x89, 0x9d, 0xa0, 0x70, 0xea, 0x11, 0xf5, 0x1d, 0x7a, - 0x02, 0xf1, 0x10, 0x3c, 0x41, 0x8f, 0x1c, 0x39, 0x21, 0x9a, 0x27, 0x41, 0xb6, 0x77, 0xdb, 0x04, - 0xea, 0x96, 0x4a, 0x5c, 0x56, 0x33, 0xf6, 0x7f, 0x7e, 0x1e, 0xcf, 0xce, 0x18, 0x56, 0xdb, 0x44, - 0xec, 0x76, 0xb7, 0xfd, 0x26, 0x8b, 0x83, 0x26, 0xa3, 0x22, 0x22, 0x14, 0x77, 0x5a, 0xc3, 0x66, - 0x94, 0x90, 0x80, 0xe3, 0x4e, 0x8f, 0x34, 0x31, 0x0f, 0x38, 0x8d, 0x12, 0xbe, 0xcb, 0xc4, 0xa9, - 0xc1, 0xfd, 0xa4, 0xc3, 0x04, 0x43, 0x33, 0x67, 0x11, 0x7e, 0xef, 0x81, 0x9f, 0x6d, 0x3b, 0x37, - 0xda, 0xac, 0xcd, 0x94, 0x24, 0x90, 0x96, 0x56, 0x3b, 0x37, 0xdb, 0x8c, 0xb5, 0xf7, 0x71, 0xa0, - 0xbc, 0xed, 0xee, 0x4e, 0x80, 0xe3, 0x44, 0xf4, 0xd3, 0xcd, 0x67, 0xff, 0x94, 0x92, 0xe8, 0x27, - 0x98, 0x07, 0x31, 0xeb, 0x52, 0xa1, 0xbf, 0x3a, 0xba, 0xfa, 0x04, 0xca, 0xaf, 0x3a, 0x38, 0x89, - 0x3a, 0x38, 0xc4, 0xef, 0xbb, 0x98, 0x0b, 0x34, 0x0d, 0xf9, 0x3d, 0xdc, 0xaf, 0x58, 0x9e, 0x55, - 0x9b, 0x0c, 0xa5, 0x89, 0x66, 0xa0, 0x20, 0x05, 0x54, 0x54, 0xc6, 0xd4, 0x62, 0xea, 0x55, 0x6f, - 0x43, 0x69, 0x43, 0xa2, 0xb8, 0x31, 0xb4, 0xba, 0x0c, 0xe5, 0x4c, 0xc2, 0x13, 0x46, 0x39, 0x46, - 0x75, 0x28, 0xa8, 0xf3, 0x79, 0xc5, 0xf2, 0xf2, 0xb5, 0x62, 0xdd, 0xf1, 0x47, 0x4b, 0xa1, 0x12, - 0xf5, 0x55, 0x50, 0x98, 0x2a, 0xe5, 0x41, 0x21, 0x8e, 0x59, 0xcf, 0x9c, 0x63, 0xf5, 0x11, 0x94, - 0x96, 0x58, 0x1c, 0x13, 0x91, 0x49, 0x10, 0xd8, 0x34, 0x8a, 0x71, 0xaa, 0x51, 0x76, 0x16, 0x36, - 0x76, 0x16, 0x36, 0x0b, 0xc5, 0x4d, 0x11, 0x09, 0x33, 0xf7, 0xc0, 0x02, 0x7b, 0x8d, 0xee, 0xb0, - 0x73, 0x79, 0x86, 0xc2, 0xa0, 0x79, 0xb0, 0xf7, 0x08, 0x6d, 0x55, 0xf2, 0x9e, 0x55, 0x2b, 0xd7, - 0x6f, 0xf9, 0xe7, 0xff, 0x6c, 0x7f, 0x9d, 0xd0, 0x56, 0xa8, 0x94, 0xc8, 0x81, 0x89, 0x0e, 0x8e, - 0x5a, 0x8c, 0xee, 0xf7, 0x2b, 0xb6, 0x67, 0xd5, 0x26, 0xc2, 0x53, 0xbf, 0xba, 0x0a, 0x53, 0x3a, - 0xc7, 0xb4, 0x82, 0x8f, 0xc1, 0x26, 0x74, 0x87, 0xa9, 0x4c, 0x8a, 0x66, 0xba, 0xcc, 0x7a, 0xd1, - 0x3e, 0xfe, 0x39, 0x9b, 0x0b, 0x95, 0xbe, 0x5a, 0x82, 0xe2, 0x0b, 0xc2, 0xb3, 0xbb, 0x4a, 0xac, - 0x76, 0xff, 0xc2, 0xe6, 0xaf, 0x84, 0xf5, 0x60, 0xea, 0x0d, 0x8f, 0xda, 0x17, 0xfc, 0x9b, 0xa7, - 0x50, 0x4a, 0x15, 0xe9, 0x51, 0x08, 0x6c, 0x4e, 0x3e, 0xea, 0x5a, 0xe6, 0x43, 0x65, 0xcb, 0x5a, - 0x12, 0xca, 0x5a, 0x98, 0xab, 0x5a, 0xe6, 0xc3, 0xd4, 0xbb, 0x1f, 0x82, 0xbd, 0xae, 0x2b, 0x54, - 0x58, 0x58, 0x6a, 0xac, 0x6d, 0xad, 0x4c, 0xe7, 0x9c, 0xf2, 0xe1, 0x91, 0x07, 0x72, 0x75, 0xa1, - 0x29, 0x48, 0x0f, 0x23, 0x0f, 0x26, 0x97, 0x5e, 0x6e, 0x6c, 0xac, 0x35, 0x1a, 0x2b, 0xcb, 0xd3, - 0x96, 0x73, 0xfd, 0xf0, 0xc8, 0x2b, 0xc9, 0x6d, 0xdd, 0x11, 0x02, 0xb7, 0x9c, 0xa9, 0x4f, 0x9f, - 0xdd, 0xdc, 0xb7, 0x2f, 0xae, 0x62, 0xd5, 0xbf, 0x8e, 0xc3, 0xc4, 0x66, 0x7a, 0x21, 0xf4, 0x0e, - 0xae, 0xa5, 0x13, 0x80, 0xee, 0x99, 0x2e, 0x3d, 0x3a, 0x22, 0x8e, 0x51, 0xf7, 0x47, 0xaf, 0x6f, - 0x81, 0xbd, 0x45, 0xf0, 0x87, 0xff, 0xce, 0x7d, 0x0b, 0x05, 0xbd, 0x82, 0xe6, 0x2e, 0x8b, 0xb8, - 0x1a, 0xf8, 0x39, 0x14, 0x74, 0xcd, 0xcc, 0xe0, 0x91, 0x29, 0x73, 0x66, 0x7c, 0xfd, 0x34, 0xf9, - 0xd9, 0xd3, 0xe4, 0xaf, 0xc8, 0xa7, 0x49, 0x82, 0xf4, 0xc4, 0x9a, 0x41, 0x23, 0x13, 0x6d, 0x04, - 0xbd, 0x06, 0x5b, 0x36, 0x3f, 0xba, 0x63, 0xc2, 0x0c, 0x8d, 0xaf, 0x73, 0xf7, 0x62, 0x51, 0x7a, - 0xc9, 0x4d, 0xb0, 0x65, 0xe3, 0x9b, 0x91, 0x43, 0x53, 0x62, 0x46, 0x0e, 0xcf, 0xce, 0xbc, 0x85, - 0x1a, 0x30, 0xae, 0x7a, 0x1c, 0x19, 0x03, 0x86, 0x87, 0xc4, 0x99, 0xbb, 0x44, 0xa5, 0xb9, 0x8b, - 0x95, 0xe3, 0x13, 0x37, 0xf7, 0xe3, 0xc4, 0xcd, 0x1d, 0x0c, 0x5c, 0xeb, 0x78, 0xe0, 0x5a, 0xdf, - 0x07, 0xae, 0xf5, 0x6b, 0xe0, 0x5a, 0xdb, 0x05, 0x55, 0xa7, 0x87, 0xbf, 0x03, 0x00, 0x00, 0xff, - 0xff, 0xed, 0x08, 0xd9, 0xe9, 0x91, 0x06, 0x00, 0x00, + // 710 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4b, 0x6f, 0xd3, 0x4e, + 0x10, 0x8f, 0x1b, 0xff, 0xd3, 0x76, 0xfa, 0x50, 0xff, 0xdb, 0x34, 0x44, 0x46, 0x32, 0xc6, 0x07, + 0x08, 0x1c, 0xec, 0x36, 0x08, 0xca, 0x53, 0xd0, 0x17, 0x52, 0x29, 0x11, 0xc8, 0x2d, 0x15, 0x3d, + 0xba, 0xc9, 0x36, 0xb5, 0x5a, 0x7b, 0x4d, 0x76, 0x13, 0x14, 0x0e, 0x08, 0x6e, 0xa8, 0xdf, 0xa1, + 0x27, 0xf8, 0x14, 0x7c, 0x82, 0x1e, 0x39, 0x72, 0x42, 0x34, 0x9f, 0x04, 0xed, 0x7a, 0x93, 0xbe, + 0x1c, 0xd9, 0x4d, 0x2f, 0xd1, 0xec, 0xe6, 0xf7, 0x18, 0xcf, 0x78, 0xc6, 0xf0, 0xb2, 0xee, 0xb1, + 0xdd, 0xe6, 0xb6, 0x55, 0x25, 0xbe, 0x5d, 0x25, 0x01, 0x73, 0xbd, 0x00, 0x37, 0x6a, 0xa7, 0x43, + 0x37, 0xf4, 0x6c, 0x8a, 0x1b, 0x2d, 0xaf, 0x8a, 0xa9, 0x4d, 0x03, 0x37, 0xa4, 0xbb, 0x84, 0xf5, + 0x02, 0x6a, 0x85, 0x0d, 0xc2, 0x08, 0x32, 0x4e, 0x18, 0x56, 0x17, 0x6d, 0x9d, 0x80, 0x5a, 0x73, + 0x5a, 0xbe, 0x4e, 0xea, 0x44, 0x80, 0x6d, 0x1e, 0x45, 0x3c, 0xed, 0x7a, 0x9d, 0x90, 0xfa, 0x3e, + 0xb6, 0xc5, 0x69, 0xbb, 0xb9, 0x63, 0x63, 0x3f, 0x64, 0x6d, 0xf9, 0xe7, 0xd3, 0x54, 0xc9, 0xb1, + 0x76, 0x88, 0xa9, 0xed, 0x93, 0x66, 0xc0, 0xa2, 0xdf, 0x88, 0x6d, 0x2e, 0x42, 0xe1, 0x6d, 0x03, + 0x87, 0x6e, 0x03, 0xaf, 0xcb, 0x3c, 0x1c, 0xfc, 0xa1, 0x89, 0x29, 0x43, 0x53, 0x90, 0xdd, 0xc3, + 0xed, 0xa2, 0x62, 0x28, 0xa5, 0x51, 0x87, 0x87, 0xa8, 0x00, 0x39, 0x0e, 0x0c, 0x58, 0x71, 0x48, + 0x5c, 0xca, 0x93, 0x59, 0x81, 0x6b, 0x17, 0x34, 0x68, 0x48, 0x02, 0x8a, 0x51, 0x19, 0x72, 0xc2, + 0x8d, 0x16, 0x15, 0x23, 0x5b, 0x1a, 0x2b, 0x6b, 0xd6, 0xa9, 0x12, 0xb4, 0xe6, 0x2c, 0x91, 0x96, + 0x55, 0xe1, 0x10, 0x47, 0x22, 0xcd, 0xe7, 0x30, 0xbd, 0xe9, 0xe1, 0x8f, 0x83, 0xe7, 0xf3, 0x0a, + 0xf2, 0x67, 0x05, 0xae, 0x90, 0xcc, 0x4d, 0x98, 0x10, 0x17, 0xb4, 0x6f, 0x1a, 0xe6, 0x32, 0x4c, + 0x76, 0x21, 0x57, 0x30, 0xba, 0x03, 0x33, 0x0e, 0xf6, 0x49, 0x2b, 0xb9, 0x0f, 0xe6, 0x33, 0x98, + 0x59, 0x22, 0xbe, 0xef, 0xb1, 0xf3, 0x50, 0x04, 0x6a, 0xe0, 0xfa, 0x58, 0x62, 0x45, 0xdc, 0xa5, + 0x0f, 0x9d, 0xd0, 0x6f, 0xc3, 0xf4, 0x3a, 0x73, 0x59, 0xb2, 0xcf, 0x81, 0x02, 0xea, 0x6a, 0xb0, + 0x43, 0x62, 0x75, 0xfb, 0x14, 0x1f, 0x3d, 0x06, 0x75, 0xcf, 0x0b, 0x6a, 0xc5, 0xac, 0xa1, 0x94, + 0x26, 0xcb, 0xb7, 0xac, 0xa4, 0x57, 0xde, 0x5a, 0xf3, 0x82, 0x9a, 0x23, 0x38, 0x48, 0x83, 0x91, + 0x06, 0x76, 0x6b, 0x24, 0xd8, 0x6f, 0x17, 0x55, 0x43, 0x29, 0x8d, 0x38, 0xbd, 0xb3, 0xf9, 0x1e, + 0xf2, 0x67, 0xb3, 0x96, 0xb5, 0x7e, 0x01, 0xaa, 0x17, 0xec, 0x10, 0x91, 0xdb, 0x58, 0x1a, 0x3f, + 0xfe, 0x44, 0x8b, 0xea, 0xd1, 0x9f, 0x1b, 0x19, 0x47, 0x30, 0xcd, 0x02, 0xe4, 0x5f, 0x7b, 0xb4, + 0xa7, 0xdc, 0xed, 0xb4, 0xb9, 0x05, 0x33, 0xe7, 0xee, 0x2f, 0x58, 0x66, 0x07, 0xb4, 0x34, 0x60, + 0xfc, 0x1d, 0x75, 0xeb, 0xb8, 0x7f, 0xed, 0x9f, 0xc0, 0x84, 0x44, 0x48, 0x53, 0x04, 0x2a, 0xf5, + 0x3e, 0x45, 0x3d, 0xc8, 0x3a, 0x22, 0xe6, 0x3d, 0xf0, 0x02, 0x52, 0xc3, 0x54, 0xf4, 0x20, 0xeb, + 0xc8, 0xd3, 0x5d, 0x07, 0xd4, 0xb5, 0xa8, 0x9e, 0xb9, 0x85, 0xa5, 0x8d, 0xd5, 0xcd, 0x95, 0xa9, + 0x8c, 0x36, 0x79, 0x70, 0x68, 0x00, 0xbf, 0x5d, 0xa8, 0x32, 0xaf, 0x85, 0x91, 0x01, 0xa3, 0x4b, + 0x6f, 0x2a, 0x95, 0xd5, 0x8d, 0x8d, 0x95, 0xe5, 0x29, 0x45, 0xfb, 0xff, 0xe0, 0xd0, 0x98, 0xe0, + 0x7f, 0x47, 0x6f, 0x16, 0xc3, 0x35, 0x6d, 0xfc, 0xdb, 0x77, 0x3d, 0xf3, 0xf3, 0x87, 0x2e, 0xb4, + 0xca, 0x5f, 0x87, 0x61, 0xb4, 0x57, 0x0a, 0xf4, 0x19, 0x86, 0xe5, 0xc8, 0xa3, 0x87, 0xc9, 0xcf, + 0x1f, 0xbf, 0x61, 0xb4, 0x47, 0x03, 0x30, 0x65, 0x35, 0x9a, 0xa0, 0xf2, 0x11, 0x47, 0xf7, 0x93, + 0x25, 0x62, 0x76, 0x89, 0xf6, 0xe0, 0xb2, 0x34, 0x69, 0xbb, 0x07, 0xb9, 0x68, 0xd4, 0x91, 0x9d, + 0xac, 0x70, 0x66, 0x6f, 0x68, 0xb3, 0xe9, 0x09, 0xd2, 0x6c, 0x0b, 0x72, 0x51, 0x33, 0xd0, 0x7c, + 0x32, 0x37, 0x76, 0x21, 0x68, 0x05, 0x2b, 0xfa, 0x72, 0x58, 0xdd, 0x2f, 0x87, 0xb5, 0xc2, 0xbf, + 0x1c, 0x5c, 0x3a, 0x5a, 0x36, 0x69, 0xa4, 0x63, 0xd7, 0x52, 0x5f, 0xe9, 0x26, 0xa8, 0x7c, 0x4e, + 0xd3, 0x74, 0x26, 0x66, 0x0b, 0xa5, 0xe9, 0x4c, 0xec, 0x1a, 0x68, 0x83, 0xca, 0x87, 0x15, 0xa5, + 0xe0, 0xc7, 0x0d, 0xbb, 0x36, 0x7f, 0x69, 0x5e, 0x64, 0x3c, 0xab, 0xa0, 0x5d, 0xf8, 0x4f, 0x8c, + 0x2a, 0xb2, 0x92, 0x35, 0x4e, 0x4f, 0xbd, 0x66, 0xa7, 0xc6, 0x47, 0x5e, 0x8b, 0xc5, 0xa3, 0x63, + 0x3d, 0xf3, 0xfb, 0x58, 0xcf, 0x7c, 0xe9, 0xe8, 0xca, 0x51, 0x47, 0x57, 0x7e, 0x75, 0x74, 0xe5, + 0x6f, 0x47, 0x57, 0xb6, 0x73, 0xa2, 0x0b, 0xf7, 0xfe, 0x05, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xee, + 0xc9, 0x12, 0xaa, 0x08, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto index 76c27e4b1a..5d3aa82d96 100644 --- a/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto +++ b/vendor/github.com/containerd/containerd/api/services/snapshot/snapshots.proto @@ -1,29 +1,41 @@ syntax = "proto3"; -package containerd.v1.snapshot; +package containerd.services.snapshots.v1; import "gogoproto/gogo.proto"; import "google/protobuf/empty.proto"; import "github.com/containerd/containerd/api/types/mount/mount.proto"; // Snapshot service manages snapshots -service Snapshot { - rpc Prepare(PrepareRequest) returns (MountsResponse); - rpc View(PrepareRequest) returns (MountsResponse); +service Snapshots { + rpc Prepare(PrepareSnapshotRequest) returns (PrepareSnapshotResponse); + rpc View(ViewSnapshotRequest) returns (ViewSnapshotResponse); rpc Mounts(MountsRequest) returns (MountsResponse); - rpc Commit(CommitRequest) returns (google.protobuf.Empty); - rpc Remove(RemoveRequest) returns (google.protobuf.Empty); - rpc Stat(StatRequest) returns (StatResponse); - rpc List(ListRequest) returns (stream ListResponse); + rpc Commit(CommitSnapshotRequest) returns (google.protobuf.Empty); + rpc Remove(RemoveSnapshotRequest) returns (google.protobuf.Empty); + rpc Stat(StatSnapshotRequest) returns (StatSnapshotResponse); + rpc List(ListSnapshotsRequest) returns (stream ListSnapshotsResponse); rpc Usage(UsageRequest) returns (UsageResponse); - // "Snapshot" prepares a new set of mounts from existing name } -message PrepareRequest { +message PrepareSnapshotRequest { string key = 1; string parent = 2; } +message PrepareSnapshotResponse { + repeated containerd.v1.types.Mount mounts = 1; +} + +message ViewSnapshotRequest { + string key = 1; + string parent = 2; +} + +message ViewSnapshotResponse { + repeated containerd.v1.types.Mount mounts = 1; +} + message MountsRequest { string key = 1; } @@ -32,16 +44,16 @@ message MountsResponse { repeated containerd.v1.types.Mount mounts = 1; } -message RemoveRequest { +message RemoveSnapshotRequest { string key = 1; } -message CommitRequest { +message CommitSnapshotRequest { string name = 1; string key = 2; } -message StatRequest { +message StatSnapshotRequest { string key = 1; } @@ -61,13 +73,14 @@ message Info { bool readonly = 4; } -message StatResponse { +message StatSnapshotResponse { Info info = 1 [(gogoproto.nullable) = false]; } -message ListRequest{} +message ListSnapshotsRequest{ +} -message ListResponse { +message ListSnapshotsResponse { repeated Info info = 1 [(gogoproto.nullable) = false]; } @@ -76,6 +89,6 @@ message UsageRequest { } message UsageResponse { - int64 inodes = 2; int64 size = 1; + int64 inodes = 2; } diff --git a/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go b/vendor/github.com/containerd/containerd/api/services/tasks/tasks.pb.go similarity index 61% rename from vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go rename to vendor/github.com/containerd/containerd/api/services/tasks/tasks.pb.go index 133aebaefd..304751176e 100644 --- a/vendor/github.com/containerd/containerd/api/services/execution/execution.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/tasks/tasks.pb.go @@ -1,38 +1,37 @@ // Code generated by protoc-gen-gogo. -// source: github.com/containerd/containerd/api/services/execution/execution.proto +// source: github.com/containerd/containerd/api/services/tasks/tasks.proto // DO NOT EDIT! /* - Package execution is a generated protocol buffer package. + Package tasks is a generated protocol buffer package. It is generated from these files: - github.com/containerd/containerd/api/services/execution/execution.proto + github.com/containerd/containerd/api/services/tasks/tasks.proto It has these top-level messages: - CreateRequest - CreateResponse - StartRequest - DeleteRequest + CreateTaskRequest + CreateTaskResponse + StartTaskRequest + DeleteTaskRequest DeleteResponse DeleteProcessRequest - InfoRequest - InfoResponse - ListRequest - ListResponse + GetTaskRequest + GetTaskResponse + ListTasksRequest + ListTasksResponse KillRequest - EventsRequest - ExecRequest - ExecResponse - PtyRequest - CloseStdinRequest - PauseRequest - ResumeRequest - ProcessesRequest - ProcessesResponse - CheckpointRequest - CheckpointResponse + ExecProcessRequest + ExecProcessResponse + ResizePtyRequest + CloseIORequest + PauseTaskRequest + ResumeTaskRequest + ListProcessesRequest + ListProcessesResponse + CheckpointTaskRequest + CheckpointTaskResponse */ -package execution +package tasks import proto "github.com/gogo/protobuf/proto" import fmt "fmt" @@ -57,6 +56,7 @@ import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" import strings "strings" import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import io "io" @@ -72,14 +72,12 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package -type CreateRequest struct { +type CreateTaskRequest struct { // ContainerID specifies the container to use for creating this task. // // The spec from the provided container id will be used to create the // task associated with this container. Only one task can be run at a time // per container. - // - // This should be created using the Containers service. ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` // RootFS provides the pre-chroot mounts to perform in the shim before // executing the container task. @@ -88,51 +86,52 @@ type CreateRequest struct { // Typically, these mounts should be resolved from snapshots specified on // the container object. Rootfs []*containerd_v1_types.Mount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` - Stdin string `protobuf:"bytes,5,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,6,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,7,opt,name=stderr,proto3" json:"stderr,omitempty"` - Terminal bool `protobuf:"varint,8,opt,name=terminal,proto3" json:"terminal,omitempty"` - Checkpoint *containerd_v1_types1.Descriptor `protobuf:"bytes,9,opt,name=checkpoint" json:"checkpoint,omitempty"` + Stdin string `protobuf:"bytes,4,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,5,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,6,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,7,opt,name=terminal,proto3" json:"terminal,omitempty"` + Checkpoint *containerd_v1_types1.Descriptor `protobuf:"bytes,8,opt,name=checkpoint" json:"checkpoint,omitempty"` } -func (m *CreateRequest) Reset() { *m = CreateRequest{} } -func (*CreateRequest) ProtoMessage() {} -func (*CreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{0} } +func (m *CreateTaskRequest) Reset() { *m = CreateTaskRequest{} } +func (*CreateTaskRequest) ProtoMessage() {} +func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{0} } -type CreateResponse struct { +type CreateTaskResponse struct { ContainerID string `protobuf:"bytes,2,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` } -func (m *CreateResponse) Reset() { *m = CreateResponse{} } -func (*CreateResponse) ProtoMessage() {} -func (*CreateResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{1} } +func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} } +func (*CreateTaskResponse) ProtoMessage() {} +func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{1} } -type StartRequest struct { +type StartTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *StartRequest) Reset() { *m = StartRequest{} } -func (*StartRequest) ProtoMessage() {} -func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{2} } +func (m *StartTaskRequest) Reset() { *m = StartTaskRequest{} } +func (*StartTaskRequest) ProtoMessage() {} +func (*StartTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{2} } -type DeleteRequest struct { +type DeleteTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } -func (*DeleteRequest) ProtoMessage() {} -func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{3} } +func (m *DeleteTaskRequest) Reset() { *m = DeleteTaskRequest{} } +func (*DeleteTaskRequest) ProtoMessage() {} +func (*DeleteTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{3} } type DeleteResponse struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - ExitStatus uint32 `protobuf:"varint,2,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` - ExitedAt time.Time `protobuf:"bytes,3,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } func (*DeleteResponse) ProtoMessage() {} -func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{4} } +func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{4} } type DeleteProcessRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -141,38 +140,39 @@ type DeleteProcessRequest struct { func (m *DeleteProcessRequest) Reset() { *m = DeleteProcessRequest{} } func (*DeleteProcessRequest) ProtoMessage() {} -func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{5} } +func (*DeleteProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{5} } -type InfoRequest struct { +type GetTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *InfoRequest) Reset() { *m = InfoRequest{} } -func (*InfoRequest) ProtoMessage() {} -func (*InfoRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} } +func (m *GetTaskRequest) Reset() { *m = GetTaskRequest{} } +func (*GetTaskRequest) ProtoMessage() {} +func (*GetTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{6} } -type InfoResponse struct { +type GetTaskResponse struct { Task *containerd_v1_types2.Task `protobuf:"bytes,1,opt,name=task" json:"task,omitempty"` } -func (m *InfoResponse) Reset() { *m = InfoResponse{} } -func (*InfoResponse) ProtoMessage() {} -func (*InfoResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} } +func (m *GetTaskResponse) Reset() { *m = GetTaskResponse{} } +func (*GetTaskResponse) ProtoMessage() {} +func (*GetTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{7} } -type ListRequest struct { +type ListTasksRequest struct { + Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` } -func (m *ListRequest) Reset() { *m = ListRequest{} } -func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } +func (m *ListTasksRequest) Reset() { *m = ListTasksRequest{} } +func (*ListTasksRequest) ProtoMessage() {} +func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{8} } -type ListResponse struct { +type ListTasksResponse struct { Tasks []*containerd_v1_types2.Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` } -func (m *ListResponse) Reset() { *m = ListResponse{} } -func (*ListResponse) ProtoMessage() {} -func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } +func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} } +func (*ListTasksResponse) ProtoMessage() {} +func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{9} } type KillRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` @@ -185,7 +185,7 @@ type KillRequest struct { func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{10} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{10} } type isKillRequest_PidOrAll interface { isKillRequest_PidOrAll() @@ -292,136 +292,124 @@ func _KillRequest_OneofSizer(msg proto.Message) (n int) { return n } -type EventsRequest struct { -} - -func (m *EventsRequest) Reset() { *m = EventsRequest{} } -func (*EventsRequest) ProtoMessage() {} -func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } - -type ExecRequest struct { +type ExecProcessRequest struct { // ContainerID specifies the container in which to exec the process. ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - Terminal bool `protobuf:"varint,2,opt,name=terminal,proto3" json:"terminal,omitempty"` - Stdin string `protobuf:"bytes,3,opt,name=stdin,proto3" json:"stdin,omitempty"` - Stdout string `protobuf:"bytes,4,opt,name=stdout,proto3" json:"stdout,omitempty"` - Stderr string `protobuf:"bytes,5,opt,name=stderr,proto3" json:"stderr,omitempty"` + Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,4,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,5,opt,name=terminal,proto3" json:"terminal,omitempty"` // Spec for starting a process in the target container. // // For runc, this is a process spec, for example. Spec *google_protobuf1.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` } -func (m *ExecRequest) Reset() { *m = ExecRequest{} } -func (*ExecRequest) ProtoMessage() {} -func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{12} } +func (m *ExecProcessRequest) Reset() { *m = ExecProcessRequest{} } +func (*ExecProcessRequest) ProtoMessage() {} +func (*ExecProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{11} } -type ExecResponse struct { +type ExecProcessResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` } -func (m *ExecResponse) Reset() { *m = ExecResponse{} } -func (*ExecResponse) ProtoMessage() {} -func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } +func (m *ExecProcessResponse) Reset() { *m = ExecProcessResponse{} } +func (*ExecProcessResponse) ProtoMessage() {} +func (*ExecProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{12} } -type PtyRequest struct { +type ResizePtyRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"` Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` } -func (m *PtyRequest) Reset() { *m = PtyRequest{} } -func (*PtyRequest) ProtoMessage() {} -func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{14} } +func (m *ResizePtyRequest) Reset() { *m = ResizePtyRequest{} } +func (*ResizePtyRequest) ProtoMessage() {} +func (*ResizePtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{13} } -type CloseStdinRequest struct { +type CloseIORequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + Stdin bool `protobuf:"varint,3,opt,name=stdin,proto3" json:"stdin,omitempty"` } -func (m *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } -func (*CloseStdinRequest) ProtoMessage() {} -func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{15} } +func (m *CloseIORequest) Reset() { *m = CloseIORequest{} } +func (*CloseIORequest) ProtoMessage() {} +func (*CloseIORequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{14} } -type PauseRequest struct { +type PauseTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *PauseRequest) Reset() { *m = PauseRequest{} } -func (*PauseRequest) ProtoMessage() {} -func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{16} } +func (m *PauseTaskRequest) Reset() { *m = PauseTaskRequest{} } +func (*PauseTaskRequest) ProtoMessage() {} +func (*PauseTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{15} } -type ResumeRequest struct { +type ResumeTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *ResumeRequest) Reset() { *m = ResumeRequest{} } -func (*ResumeRequest) ProtoMessage() {} -func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{17} } +func (m *ResumeTaskRequest) Reset() { *m = ResumeTaskRequest{} } +func (*ResumeTaskRequest) ProtoMessage() {} +func (*ResumeTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{16} } -type ProcessesRequest struct { +type ListProcessesRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } -func (m *ProcessesRequest) Reset() { *m = ProcessesRequest{} } -func (*ProcessesRequest) ProtoMessage() {} -func (*ProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } +func (m *ListProcessesRequest) Reset() { *m = ListProcessesRequest{} } +func (*ListProcessesRequest) ProtoMessage() {} +func (*ListProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{17} } -type ProcessesResponse struct { +type ListProcessesResponse struct { Processes []*containerd_v1_types2.Process `protobuf:"bytes,1,rep,name=processes" json:"processes,omitempty"` } -func (m *ProcessesResponse) Reset() { *m = ProcessesResponse{} } -func (*ProcessesResponse) ProtoMessage() {} -func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{19} } +func (m *ListProcessesResponse) Reset() { *m = ListProcessesResponse{} } +func (*ListProcessesResponse) ProtoMessage() {} +func (*ListProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{18} } -type CheckpointRequest struct { +type CheckpointTaskRequest struct { ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` - AllowTcp bool `protobuf:"varint,2,opt,name=allow_tcp,json=allowTcp,proto3" json:"allow_tcp,omitempty"` - AllowUnixSockets bool `protobuf:"varint,3,opt,name=allow_unix_sockets,json=allowUnixSockets,proto3" json:"allow_unix_sockets,omitempty"` - AllowTerminal bool `protobuf:"varint,4,opt,name=allow_terminal,json=allowTerminal,proto3" json:"allow_terminal,omitempty"` - FileLocks bool `protobuf:"varint,5,opt,name=file_locks,json=fileLocks,proto3" json:"file_locks,omitempty"` - EmptyNamespaces []string `protobuf:"bytes,6,rep,name=empty_namespaces,json=emptyNamespaces" json:"empty_namespaces,omitempty"` - ParentCheckpoint github_com_opencontainers_go_digest.Digest `protobuf:"bytes,7,opt,name=parent_checkpoint,json=parentCheckpoint,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"parent_checkpoint"` - Exit bool `protobuf:"varint,8,opt,name=exit,proto3" json:"exit,omitempty"` + ParentCheckpoint github_com_opencontainers_go_digest.Digest `protobuf:"bytes,2,opt,name=parent_checkpoint,json=parentCheckpoint,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"parent_checkpoint"` + Options map[string]string `protobuf:"bytes,3,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } -func (*CheckpointRequest) ProtoMessage() {} -func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{20} } +func (m *CheckpointTaskRequest) Reset() { *m = CheckpointTaskRequest{} } +func (*CheckpointTaskRequest) ProtoMessage() {} +func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{19} } -type CheckpointResponse struct { +type CheckpointTaskResponse struct { Descriptors []*containerd_v1_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` } -func (m *CheckpointResponse) Reset() { *m = CheckpointResponse{} } -func (*CheckpointResponse) ProtoMessage() {} -func (*CheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{21} } +func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTaskResponse{} } +func (*CheckpointTaskResponse) ProtoMessage() {} +func (*CheckpointTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} } func init() { - proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.execution.CreateRequest") - proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.execution.CreateResponse") - proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.execution.StartRequest") - proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.execution.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.execution.DeleteResponse") - proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.v1.services.execution.DeleteProcessRequest") - proto.RegisterType((*InfoRequest)(nil), "containerd.v1.services.execution.InfoRequest") - proto.RegisterType((*InfoResponse)(nil), "containerd.v1.services.execution.InfoResponse") - proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.execution.ListRequest") - proto.RegisterType((*ListResponse)(nil), "containerd.v1.services.execution.ListResponse") - proto.RegisterType((*KillRequest)(nil), "containerd.v1.services.execution.KillRequest") - proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.execution.EventsRequest") - proto.RegisterType((*ExecRequest)(nil), "containerd.v1.services.execution.ExecRequest") - proto.RegisterType((*ExecResponse)(nil), "containerd.v1.services.execution.ExecResponse") - proto.RegisterType((*PtyRequest)(nil), "containerd.v1.services.execution.PtyRequest") - proto.RegisterType((*CloseStdinRequest)(nil), "containerd.v1.services.execution.CloseStdinRequest") - proto.RegisterType((*PauseRequest)(nil), "containerd.v1.services.execution.PauseRequest") - proto.RegisterType((*ResumeRequest)(nil), "containerd.v1.services.execution.ResumeRequest") - proto.RegisterType((*ProcessesRequest)(nil), "containerd.v1.services.execution.ProcessesRequest") - proto.RegisterType((*ProcessesResponse)(nil), "containerd.v1.services.execution.ProcessesResponse") - proto.RegisterType((*CheckpointRequest)(nil), "containerd.v1.services.execution.CheckpointRequest") - proto.RegisterType((*CheckpointResponse)(nil), "containerd.v1.services.execution.CheckpointResponse") + proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest") + proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse") + proto.RegisterType((*StartTaskRequest)(nil), "containerd.services.tasks.v1.StartTaskRequest") + proto.RegisterType((*DeleteTaskRequest)(nil), "containerd.services.tasks.v1.DeleteTaskRequest") + proto.RegisterType((*DeleteResponse)(nil), "containerd.services.tasks.v1.DeleteResponse") + proto.RegisterType((*DeleteProcessRequest)(nil), "containerd.services.tasks.v1.DeleteProcessRequest") + proto.RegisterType((*GetTaskRequest)(nil), "containerd.services.tasks.v1.GetTaskRequest") + proto.RegisterType((*GetTaskResponse)(nil), "containerd.services.tasks.v1.GetTaskResponse") + proto.RegisterType((*ListTasksRequest)(nil), "containerd.services.tasks.v1.ListTasksRequest") + proto.RegisterType((*ListTasksResponse)(nil), "containerd.services.tasks.v1.ListTasksResponse") + proto.RegisterType((*KillRequest)(nil), "containerd.services.tasks.v1.KillRequest") + proto.RegisterType((*ExecProcessRequest)(nil), "containerd.services.tasks.v1.ExecProcessRequest") + proto.RegisterType((*ExecProcessResponse)(nil), "containerd.services.tasks.v1.ExecProcessResponse") + proto.RegisterType((*ResizePtyRequest)(nil), "containerd.services.tasks.v1.ResizePtyRequest") + proto.RegisterType((*CloseIORequest)(nil), "containerd.services.tasks.v1.CloseIORequest") + proto.RegisterType((*PauseTaskRequest)(nil), "containerd.services.tasks.v1.PauseTaskRequest") + proto.RegisterType((*ResumeTaskRequest)(nil), "containerd.services.tasks.v1.ResumeTaskRequest") + proto.RegisterType((*ListProcessesRequest)(nil), "containerd.services.tasks.v1.ListProcessesRequest") + proto.RegisterType((*ListProcessesResponse)(nil), "containerd.services.tasks.v1.ListProcessesResponse") + proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.services.tasks.v1.CheckpointTaskRequest") + proto.RegisterType((*CheckpointTaskResponse)(nil), "containerd.services.tasks.v1.CheckpointTaskResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -435,21 +423,24 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Tasks service type TasksClient interface { - Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) - Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Create a task. + Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) + // Start a task. + Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + // Delete a task and on disk state. + Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) - Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) + Get(ctx context.Context, in *GetTaskRequest, opts ...grpc.CallOption) (*GetTaskResponse, error) + List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) + // Kill a task or process. Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Tasks_EventsClient, error) - Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) - Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) - Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) + Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) + ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + Pause(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + Resume(ctx context.Context, in *ResumeTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error) + Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*CheckpointTaskResponse, error) } type tasksClient struct { @@ -460,27 +451,27 @@ func NewTasksClient(cc *grpc.ClientConn) TasksClient { return &tasksClient{cc} } -func (c *tasksClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { - out := new(CreateResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Create", in, out, c.cc, opts...) +func (c *tasksClient) Create(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) { + out := new(CreateTaskResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Create", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Start(ctx context.Context, in *StartTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Start", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Start", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *tasksClient) Delete(ctx context.Context, in *DeleteTaskRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -489,25 +480,25 @@ func (c *tasksClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grp func (c *tasksClient) DeleteProcess(ctx context.Context, in *DeleteProcessRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/DeleteProcess", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/DeleteProcess", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) { - out := new(InfoResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Info", in, out, c.cc, opts...) +func (c *tasksClient) Get(ctx context.Context, in *GetTaskRequest, opts ...grpc.CallOption) (*GetTaskResponse, error) { + out := new(GetTaskResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Get", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { - out := new(ListResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/List", in, out, c.cc, opts...) +func (c *tasksClient) List(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) { + out := new(ListTasksResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/List", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -516,102 +507,70 @@ func (c *tasksClient) List(ctx context.Context, in *ListRequest, opts ...grpc.Ca func (c *tasksClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Kill", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Kill", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Tasks_EventsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_Tasks_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.execution.Tasks/Events", opts...) - if err != nil { - return nil, err - } - x := &tasksEventsClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Tasks_EventsClient interface { - Recv() (*containerd_v1_types2.Event, error) - grpc.ClientStream -} - -type tasksEventsClient struct { - grpc.ClientStream -} - -func (x *tasksEventsClient) Recv() (*containerd_v1_types2.Event, error) { - m := new(containerd_v1_types2.Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *tasksClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { - out := new(ExecResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Exec", in, out, c.cc, opts...) +func (c *tasksClient) Exec(ctx context.Context, in *ExecProcessRequest, opts ...grpc.CallOption) (*ExecProcessResponse, error) { + out := new(ExecProcessResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Exec", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) ResizePty(ctx context.Context, in *ResizePtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Pty", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/ResizePty", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) CloseIO(ctx context.Context, in *CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/CloseStdin", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/CloseIO", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Pause(ctx context.Context, in *PauseTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Pause", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Pause", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Resume(ctx context.Context, in *ResumeTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Resume", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Resume", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) { - out := new(ProcessesResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Processes", in, out, c.cc, opts...) +func (c *tasksClient) ListProcesses(ctx context.Context, in *ListProcessesRequest, opts ...grpc.CallOption) (*ListProcessesResponse, error) { + out := new(ListProcessesResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/ListProcesses", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *tasksClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) { - out := new(CheckpointResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Checkpoint", in, out, c.cc, opts...) +func (c *tasksClient) Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*CheckpointTaskResponse, error) { + out := new(CheckpointTaskResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Checkpoint", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -621,21 +580,24 @@ func (c *tasksClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opt // Server API for Tasks service type TasksServer interface { - Create(context.Context, *CreateRequest) (*CreateResponse, error) - Start(context.Context, *StartRequest) (*google_protobuf.Empty, error) - Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Create a task. + Create(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) + // Start a task. + Start(context.Context, *StartTaskRequest) (*google_protobuf.Empty, error) + // Delete a task and on disk state. + Delete(context.Context, *DeleteTaskRequest) (*DeleteResponse, error) DeleteProcess(context.Context, *DeleteProcessRequest) (*DeleteResponse, error) - Info(context.Context, *InfoRequest) (*InfoResponse, error) - List(context.Context, *ListRequest) (*ListResponse, error) + Get(context.Context, *GetTaskRequest) (*GetTaskResponse, error) + List(context.Context, *ListTasksRequest) (*ListTasksResponse, error) + // Kill a task or process. Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) - Events(*EventsRequest, Tasks_EventsServer) error - Exec(context.Context, *ExecRequest) (*ExecResponse, error) - Pty(context.Context, *PtyRequest) (*google_protobuf.Empty, error) - CloseStdin(context.Context, *CloseStdinRequest) (*google_protobuf.Empty, error) - Pause(context.Context, *PauseRequest) (*google_protobuf.Empty, error) - Resume(context.Context, *ResumeRequest) (*google_protobuf.Empty, error) - Processes(context.Context, *ProcessesRequest) (*ProcessesResponse, error) - Checkpoint(context.Context, *CheckpointRequest) (*CheckpointResponse, error) + Exec(context.Context, *ExecProcessRequest) (*ExecProcessResponse, error) + ResizePty(context.Context, *ResizePtyRequest) (*google_protobuf.Empty, error) + CloseIO(context.Context, *CloseIORequest) (*google_protobuf.Empty, error) + Pause(context.Context, *PauseTaskRequest) (*google_protobuf.Empty, error) + Resume(context.Context, *ResumeTaskRequest) (*google_protobuf.Empty, error) + ListProcesses(context.Context, *ListProcessesRequest) (*ListProcessesResponse, error) + Checkpoint(context.Context, *CheckpointTaskRequest) (*CheckpointTaskResponse, error) } func RegisterTasksServer(s *grpc.Server, srv TasksServer) { @@ -643,7 +605,7 @@ func RegisterTasksServer(s *grpc.Server, srv TasksServer) { } func _Tasks_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateRequest) + in := new(CreateTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -652,16 +614,16 @@ func _Tasks_Create_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Create", + FullMethod: "/containerd.services.tasks.v1.Tasks/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Create(ctx, req.(*CreateRequest)) + return srv.(TasksServer).Create(ctx, req.(*CreateTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartRequest) + in := new(StartTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -670,16 +632,16 @@ func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Start", + FullMethod: "/containerd.services.tasks.v1.Tasks/Start", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Start(ctx, req.(*StartRequest)) + return srv.(TasksServer).Start(ctx, req.(*StartTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) + in := new(DeleteTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -688,10 +650,10 @@ func _Tasks_Delete_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Delete", + FullMethod: "/containerd.services.tasks.v1.Tasks/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(TasksServer).Delete(ctx, req.(*DeleteTaskRequest)) } return interceptor(ctx, in, info, handler) } @@ -706,7 +668,7 @@ func _Tasks_DeleteProcess_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/DeleteProcess", + FullMethod: "/containerd.services.tasks.v1.Tasks/DeleteProcess", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TasksServer).DeleteProcess(ctx, req.(*DeleteProcessRequest)) @@ -714,26 +676,26 @@ func _Tasks_DeleteProcess_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _Tasks_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InfoRequest) +func _Tasks_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(TasksServer).Info(ctx, in) + return srv.(TasksServer).Get(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Info", + FullMethod: "/containerd.services.tasks.v1.Tasks/Get", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Info(ctx, req.(*InfoRequest)) + return srv.(TasksServer).Get(ctx, req.(*GetTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) + in := new(ListTasksRequest) if err := dec(in); err != nil { return nil, err } @@ -742,10 +704,10 @@ func _Tasks_List_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/List", + FullMethod: "/containerd.services.tasks.v1.Tasks/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).List(ctx, req.(*ListRequest)) + return srv.(TasksServer).List(ctx, req.(*ListTasksRequest)) } return interceptor(ctx, in, info, handler) } @@ -760,7 +722,7 @@ func _Tasks_Kill_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Kill", + FullMethod: "/containerd.services.tasks.v1.Tasks/Kill", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(TasksServer).Kill(ctx, req.(*KillRequest)) @@ -768,29 +730,8 @@ func _Tasks_Kill_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } -func _Tasks_Events_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(EventsRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(TasksServer).Events(m, &tasksEventsServer{stream}) -} - -type Tasks_EventsServer interface { - Send(*containerd_v1_types2.Event) error - grpc.ServerStream -} - -type tasksEventsServer struct { - grpc.ServerStream -} - -func (x *tasksEventsServer) Send(m *containerd_v1_types2.Event) error { - return x.ServerStream.SendMsg(m) -} - func _Tasks_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ExecRequest) + in := new(ExecProcessRequest) if err := dec(in); err != nil { return nil, err } @@ -799,52 +740,52 @@ func _Tasks_Exec_Handler(srv interface{}, ctx context.Context, dec func(interfac } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Exec", + FullMethod: "/containerd.services.tasks.v1.Tasks/Exec", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Exec(ctx, req.(*ExecRequest)) + return srv.(TasksServer).Exec(ctx, req.(*ExecProcessRequest)) } return interceptor(ctx, in, info, handler) } -func _Tasks_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PtyRequest) +func _Tasks_ResizePty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResizePtyRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(TasksServer).Pty(ctx, in) + return srv.(TasksServer).ResizePty(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Pty", + FullMethod: "/containerd.services.tasks.v1.Tasks/ResizePty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Pty(ctx, req.(*PtyRequest)) + return srv.(TasksServer).ResizePty(ctx, req.(*ResizePtyRequest)) } return interceptor(ctx, in, info, handler) } -func _Tasks_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStdinRequest) +func _Tasks_CloseIO_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseIORequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(TasksServer).CloseStdin(ctx, in) + return srv.(TasksServer).CloseIO(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/CloseStdin", + FullMethod: "/containerd.services.tasks.v1.Tasks/CloseIO", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).CloseStdin(ctx, req.(*CloseStdinRequest)) + return srv.(TasksServer).CloseIO(ctx, req.(*CloseIORequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PauseRequest) + in := new(PauseTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -853,16 +794,16 @@ func _Tasks_Pause_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Pause", + FullMethod: "/containerd.services.tasks.v1.Tasks/Pause", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Pause(ctx, req.(*PauseRequest)) + return srv.(TasksServer).Pause(ctx, req.(*PauseTaskRequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResumeRequest) + in := new(ResumeTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -871,34 +812,34 @@ func _Tasks_Resume_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Resume", + FullMethod: "/containerd.services.tasks.v1.Tasks/Resume", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Resume(ctx, req.(*ResumeRequest)) + return srv.(TasksServer).Resume(ctx, req.(*ResumeTaskRequest)) } return interceptor(ctx, in, info, handler) } -func _Tasks_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProcessesRequest) +func _Tasks_ListProcesses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListProcessesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(TasksServer).Processes(ctx, in) + return srv.(TasksServer).ListProcesses(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Processes", + FullMethod: "/containerd.services.tasks.v1.Tasks/ListProcesses", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Processes(ctx, req.(*ProcessesRequest)) + return srv.(TasksServer).ListProcesses(ctx, req.(*ListProcessesRequest)) } return interceptor(ctx, in, info, handler) } func _Tasks_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CheckpointRequest) + in := new(CheckpointTaskRequest) if err := dec(in); err != nil { return nil, err } @@ -907,16 +848,16 @@ func _Tasks_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.execution.Tasks/Checkpoint", + FullMethod: "/containerd.services.tasks.v1.Tasks/Checkpoint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Checkpoint(ctx, req.(*CheckpointRequest)) + return srv.(TasksServer).Checkpoint(ctx, req.(*CheckpointTaskRequest)) } return interceptor(ctx, in, info, handler) } var _Tasks_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.services.execution.Tasks", + ServiceName: "containerd.services.tasks.v1.Tasks", HandlerType: (*TasksServer)(nil), Methods: []grpc.MethodDesc{ { @@ -936,8 +877,8 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{ Handler: _Tasks_DeleteProcess_Handler, }, { - MethodName: "Info", - Handler: _Tasks_Info_Handler, + MethodName: "Get", + Handler: _Tasks_Get_Handler, }, { MethodName: "List", @@ -952,12 +893,12 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{ Handler: _Tasks_Exec_Handler, }, { - MethodName: "Pty", - Handler: _Tasks_Pty_Handler, + MethodName: "ResizePty", + Handler: _Tasks_ResizePty_Handler, }, { - MethodName: "CloseStdin", - Handler: _Tasks_CloseStdin_Handler, + MethodName: "CloseIO", + Handler: _Tasks_CloseIO_Handler, }, { MethodName: "Pause", @@ -968,25 +909,19 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{ Handler: _Tasks_Resume_Handler, }, { - MethodName: "Processes", - Handler: _Tasks_Processes_Handler, + MethodName: "ListProcesses", + Handler: _Tasks_ListProcesses_Handler, }, { MethodName: "Checkpoint", Handler: _Tasks_Checkpoint_Handler, }, }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Events", - Handler: _Tasks_Events_Handler, - ServerStreams: true, - }, - }, - Metadata: "github.com/containerd/containerd/api/services/execution/execution.proto", + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/tasks/tasks.proto", } -func (m *CreateRequest) Marshal() (dAtA []byte, err error) { +func (m *CreateTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -996,7 +931,7 @@ func (m *CreateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CreateTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1004,14 +939,14 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if len(m.Rootfs) > 0 { for _, msg := range m.Rootfs { dAtA[i] = 0x1a i++ - i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) + i = encodeVarintTasks(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1020,25 +955,25 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { } } if len(m.Stdin) > 0 { - dAtA[i] = 0x2a + dAtA[i] = 0x22 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stdin))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stdin))) i += copy(dAtA[i:], m.Stdin) } if len(m.Stdout) > 0 { - dAtA[i] = 0x32 + dAtA[i] = 0x2a i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stdout))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stdout))) i += copy(dAtA[i:], m.Stdout) } if len(m.Stderr) > 0 { - dAtA[i] = 0x3a + dAtA[i] = 0x32 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stderr))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stderr))) i += copy(dAtA[i:], m.Stderr) } if m.Terminal { - dAtA[i] = 0x40 + dAtA[i] = 0x38 i++ if m.Terminal { dAtA[i] = 1 @@ -1048,9 +983,9 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { i++ } if m.Checkpoint != nil { - dAtA[i] = 0x4a + dAtA[i] = 0x42 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Checkpoint.Size())) + i = encodeVarintTasks(dAtA, i, uint64(m.Checkpoint.Size())) n1, err := m.Checkpoint.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1060,7 +995,7 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CreateResponse) Marshal() (dAtA []byte, err error) { +func (m *CreateTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1070,7 +1005,7 @@ func (m *CreateResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *CreateTaskResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1078,18 +1013,18 @@ func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x18 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) } return i, nil } -func (m *StartRequest) Marshal() (dAtA []byte, err error) { +func (m *StartTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1099,7 +1034,7 @@ func (m *StartRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *StartTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1107,13 +1042,13 @@ func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil } -func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { +func (m *DeleteTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1123,7 +1058,7 @@ func (m *DeleteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *DeleteTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1131,7 +1066,7 @@ func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil @@ -1155,17 +1090,22 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.ExitStatus != 0 { + if m.Pid != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.ExitStatus)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + } + if m.ExitStatus != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintTasks(dAtA, i, uint64(m.ExitStatus)) } - dAtA[i] = 0x1a + dAtA[i] = 0x22 i++ - i = encodeVarintExecution(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) + i = encodeVarintTasks(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err @@ -1192,18 +1132,18 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) } return i, nil } -func (m *InfoRequest) Marshal() (dAtA []byte, err error) { +func (m *GetTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1213,7 +1153,7 @@ func (m *InfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *GetTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1221,13 +1161,13 @@ func (m *InfoRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil } -func (m *InfoResponse) Marshal() (dAtA []byte, err error) { +func (m *GetTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1237,7 +1177,7 @@ func (m *InfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *InfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *GetTaskResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1245,7 +1185,7 @@ func (m *InfoResponse) MarshalTo(dAtA []byte) (int, error) { if m.Task != nil { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Task.Size())) + i = encodeVarintTasks(dAtA, i, uint64(m.Task.Size())) n3, err := m.Task.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1255,7 +1195,7 @@ func (m *InfoResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ListRequest) Marshal() (dAtA []byte, err error) { +func (m *ListTasksRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1265,15 +1205,21 @@ func (m *ListRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListTasksRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l + if len(m.Filter) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(m.Filter))) + i += copy(dAtA[i:], m.Filter) + } return i, nil } -func (m *ListResponse) Marshal() (dAtA []byte, err error) { +func (m *ListTasksResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1283,7 +1229,7 @@ func (m *ListResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListTasksResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1292,7 +1238,7 @@ func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { for _, msg := range m.Tasks { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) + i = encodeVarintTasks(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1321,13 +1267,13 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Signal != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Signal)) + i = encodeVarintTasks(dAtA, i, uint64(m.Signal)) } if m.PidOrAll != nil { nn4, err := m.PidOrAll.MarshalTo(dAtA[i:]) @@ -1355,10 +1301,10 @@ func (m *KillRequest_Pid) MarshalTo(dAtA []byte) (int, error) { i := 0 dAtA[i] = 0x20 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) return i, nil } -func (m *EventsRequest) Marshal() (dAtA []byte, err error) { +func (m *ExecProcessRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1368,25 +1314,7 @@ func (m *EventsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *ExecRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ExecProcessRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1394,41 +1322,41 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.Terminal { - dAtA[i] = 0x10 - i++ - if m.Terminal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } if len(m.Stdin) > 0 { - dAtA[i] = 0x1a + dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stdin))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stdin))) i += copy(dAtA[i:], m.Stdin) } if len(m.Stdout) > 0 { - dAtA[i] = 0x22 + dAtA[i] = 0x1a i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stdout))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stdout))) i += copy(dAtA[i:], m.Stdout) } if len(m.Stderr) > 0 { - dAtA[i] = 0x2a + dAtA[i] = 0x22 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Stderr))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.Stderr))) i += copy(dAtA[i:], m.Stderr) } + if m.Terminal { + dAtA[i] = 0x28 + i++ + if m.Terminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } if m.Spec != nil { dAtA[i] = 0x32 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Spec.Size())) + i = encodeVarintTasks(dAtA, i, uint64(m.Spec.Size())) n5, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1438,7 +1366,7 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *ExecResponse) Marshal() (dAtA []byte, err error) { +func (m *ExecProcessResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1448,7 +1376,7 @@ func (m *ExecResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ExecResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ExecProcessResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1456,12 +1384,12 @@ func (m *ExecResponse) MarshalTo(dAtA []byte) (int, error) { if m.Pid != 0 { dAtA[i] = 0x8 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) } return i, nil } -func (m *PtyRequest) Marshal() (dAtA []byte, err error) { +func (m *ResizePtyRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1471,7 +1399,7 @@ func (m *PtyRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PtyRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ResizePtyRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1479,28 +1407,28 @@ func (m *PtyRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) } if m.Width != 0 { dAtA[i] = 0x18 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Width)) + i = encodeVarintTasks(dAtA, i, uint64(m.Width)) } if m.Height != 0 { dAtA[i] = 0x20 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Height)) + i = encodeVarintTasks(dAtA, i, uint64(m.Height)) } return i, nil } -func (m *CloseStdinRequest) Marshal() (dAtA []byte, err error) { +func (m *CloseIORequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1510,7 +1438,7 @@ func (m *CloseStdinRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CloseIORequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1518,18 +1446,28 @@ func (m *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) + i = encodeVarintTasks(dAtA, i, uint64(m.Pid)) + } + if m.Stdin { + dAtA[i] = 0x18 + i++ + if m.Stdin { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ } return i, nil } -func (m *PauseRequest) Marshal() (dAtA []byte, err error) { +func (m *PauseTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1539,7 +1477,7 @@ func (m *PauseRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PauseRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *PauseTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1547,13 +1485,13 @@ func (m *PauseRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil } -func (m *ResumeRequest) Marshal() (dAtA []byte, err error) { +func (m *ResumeTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1563,7 +1501,7 @@ func (m *ResumeRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ResumeRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ResumeTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1571,13 +1509,13 @@ func (m *ResumeRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil } -func (m *ProcessesRequest) Marshal() (dAtA []byte, err error) { +func (m *ListProcessesRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1587,7 +1525,7 @@ func (m *ProcessesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProcessesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *ListProcessesRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1595,13 +1533,13 @@ func (m *ProcessesRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } return i, nil } -func (m *ProcessesResponse) Marshal() (dAtA []byte, err error) { +func (m *ListProcessesResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1611,7 +1549,7 @@ func (m *ProcessesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *ListProcessesResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1620,7 +1558,7 @@ func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { for _, msg := range m.Processes { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) + i = encodeVarintTasks(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1631,7 +1569,7 @@ func (m *ProcessesResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *CheckpointRequest) Marshal() (dAtA []byte, err error) { +func (m *CheckpointTaskRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1641,7 +1579,7 @@ func (m *CheckpointRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *CheckpointTaskRequest) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1649,84 +1587,36 @@ func (m *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ContainerID))) i += copy(dAtA[i:], m.ContainerID) } - if m.AllowTcp { - dAtA[i] = 0x10 - i++ - if m.AllowTcp { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.AllowUnixSockets { - dAtA[i] = 0x18 - i++ - if m.AllowUnixSockets { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.AllowTerminal { - dAtA[i] = 0x20 - i++ - if m.AllowTerminal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.FileLocks { - dAtA[i] = 0x28 - i++ - if m.FileLocks { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if len(m.EmptyNamespaces) > 0 { - for _, s := range m.EmptyNamespaces { - dAtA[i] = 0x32 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } if len(m.ParentCheckpoint) > 0 { - dAtA[i] = 0x3a + dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ParentCheckpoint))) + i = encodeVarintTasks(dAtA, i, uint64(len(m.ParentCheckpoint))) i += copy(dAtA[i:], m.ParentCheckpoint) } - if m.Exit { - dAtA[i] = 0x40 - i++ - if m.Exit { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Options) > 0 { + for k, _ := range m.Options { + dAtA[i] = 0x1a + i++ + v := m.Options[k] + mapSize := 1 + len(k) + sovTasks(uint64(len(k))) + 1 + len(v) + sovTasks(uint64(len(v))) + i = encodeVarintTasks(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintTasks(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) } - i++ } return i, nil } -func (m *CheckpointResponse) Marshal() (dAtA []byte, err error) { +func (m *CheckpointTaskResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1736,7 +1626,7 @@ func (m *CheckpointResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CheckpointResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *CheckpointTaskResponse) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1745,7 +1635,7 @@ func (m *CheckpointResponse) MarshalTo(dAtA []byte) (int, error) { for _, msg := range m.Descriptors { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) + i = encodeVarintTasks(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -1756,7 +1646,7 @@ func (m *CheckpointResponse) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Execution(dAtA []byte, offset int, v uint64) int { +func encodeFixed64Tasks(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) dAtA[offset+2] = uint8(v >> 16) @@ -1767,14 +1657,14 @@ func encodeFixed64Execution(dAtA []byte, offset int, v uint64) int { dAtA[offset+7] = uint8(v >> 56) return offset + 8 } -func encodeFixed32Execution(dAtA []byte, offset int, v uint32) int { +func encodeFixed32Tasks(dAtA []byte, offset int, v uint32) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) dAtA[offset+2] = uint8(v >> 16) dAtA[offset+3] = uint8(v >> 24) return offset + 4 } -func encodeVarintExecution(dAtA []byte, offset int, v uint64) int { +func encodeVarintTasks(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 @@ -1783,70 +1673,70 @@ func encodeVarintExecution(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *CreateRequest) Size() (n int) { +func (m *CreateTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if len(m.Rootfs) > 0 { for _, e := range m.Rootfs { l = e.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } } l = len(m.Stdin) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } l = len(m.Stdout) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } l = len(m.Stderr) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Terminal { n += 2 } if m.Checkpoint != nil { l = m.Checkpoint.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *CreateResponse) Size() (n int) { +func (m *CreateTaskResponse) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Pid != 0 { - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) } return n } -func (m *StartRequest) Size() (n int) { +func (m *StartTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *DeleteRequest) Size() (n int) { +func (m *DeleteTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } @@ -1856,13 +1746,16 @@ func (m *DeleteResponse) Size() (n int) { _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovTasks(uint64(m.Pid)) } if m.ExitStatus != 0 { - n += 1 + sovExecution(uint64(m.ExitStatus)) + n += 1 + sovTasks(uint64(m.ExitStatus)) } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) return n } @@ -1871,47 +1764,51 @@ func (m *DeleteProcessRequest) Size() (n int) { _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Pid != 0 { - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) } return n } -func (m *InfoRequest) Size() (n int) { +func (m *GetTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *InfoResponse) Size() (n int) { +func (m *GetTaskResponse) Size() (n int) { var l int _ = l if m.Task != nil { l = m.Task.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *ListRequest) Size() (n int) { +func (m *ListTasksRequest) Size() (n int) { var l int _ = l + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovTasks(uint64(l)) + } return n } -func (m *ListResponse) Size() (n int) { +func (m *ListTasksResponse) Size() (n int) { var l int _ = l if len(m.Tasks) > 0 { for _, e := range m.Tasks { l = e.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } } return n @@ -1922,10 +1819,10 @@ func (m *KillRequest) Size() (n int) { _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Signal != 0 { - n += 1 + sovExecution(uint64(m.Signal)) + n += 1 + sovTasks(uint64(m.Signal)) } if m.PidOrAll != nil { n += m.PidOrAll.Size() @@ -1942,175 +1839,159 @@ func (m *KillRequest_All) Size() (n int) { func (m *KillRequest_Pid) Size() (n int) { var l int _ = l - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) return n } -func (m *EventsRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *ExecRequest) Size() (n int) { +func (m *ExecProcessRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) - } - if m.Terminal { - n += 2 + n += 1 + l + sovTasks(uint64(l)) } l = len(m.Stdin) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } l = len(m.Stdout) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } l = len(m.Stderr) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) + } + if m.Terminal { + n += 2 } if m.Spec != nil { l = m.Spec.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *ExecResponse) Size() (n int) { +func (m *ExecProcessResponse) Size() (n int) { var l int _ = l if m.Pid != 0 { - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) } return n } -func (m *PtyRequest) Size() (n int) { +func (m *ResizePtyRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Pid != 0 { - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) } if m.Width != 0 { - n += 1 + sovExecution(uint64(m.Width)) + n += 1 + sovTasks(uint64(m.Width)) } if m.Height != 0 { - n += 1 + sovExecution(uint64(m.Height)) + n += 1 + sovTasks(uint64(m.Height)) } return n } -func (m *CloseStdinRequest) Size() (n int) { +func (m *CloseIORequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } if m.Pid != 0 { - n += 1 + sovExecution(uint64(m.Pid)) + n += 1 + sovTasks(uint64(m.Pid)) + } + if m.Stdin { + n += 2 } return n } -func (m *PauseRequest) Size() (n int) { +func (m *PauseTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *ResumeRequest) Size() (n int) { +func (m *ResumeTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *ProcessesRequest) Size() (n int) { +func (m *ListProcessesRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } return n } -func (m *ProcessesResponse) Size() (n int) { +func (m *ListProcessesResponse) Size() (n int) { var l int _ = l if len(m.Processes) > 0 { for _, e := range m.Processes { l = e.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } } return n } -func (m *CheckpointRequest) Size() (n int) { +func (m *CheckpointTaskRequest) Size() (n int) { var l int _ = l l = len(m.ContainerID) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) - } - if m.AllowTcp { - n += 2 - } - if m.AllowUnixSockets { - n += 2 - } - if m.AllowTerminal { - n += 2 - } - if m.FileLocks { - n += 2 - } - if len(m.EmptyNamespaces) > 0 { - for _, s := range m.EmptyNamespaces { - l = len(s) - n += 1 + l + sovExecution(uint64(l)) - } + n += 1 + l + sovTasks(uint64(l)) } l = len(m.ParentCheckpoint) if l > 0 { - n += 1 + l + sovExecution(uint64(l)) - } - if m.Exit { - n += 2 + n += 1 + l + sovTasks(uint64(l)) + } + if len(m.Options) > 0 { + for k, v := range m.Options { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovTasks(uint64(len(k))) + 1 + len(v) + sovTasks(uint64(len(v))) + n += mapEntrySize + 1 + sovTasks(uint64(mapEntrySize)) + } } return n } -func (m *CheckpointResponse) Size() (n int) { +func (m *CheckpointTaskResponse) Size() (n int) { var l int _ = l if len(m.Descriptors) > 0 { for _, e := range m.Descriptors { l = e.Size() - n += 1 + l + sovExecution(uint64(l)) + n += 1 + l + sovTasks(uint64(l)) } } return n } -func sovExecution(x uint64) (n int) { +func sovTasks(x uint64) (n int) { for { n++ x >>= 7 @@ -2120,14 +2001,14 @@ func sovExecution(x uint64) (n int) { } return n } -func sozExecution(x uint64) (n int) { - return sovExecution(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozTasks(x uint64) (n int) { + return sovTasks(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *CreateRequest) String() string { +func (this *CreateTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CreateRequest{`, + s := strings.Join([]string{`&CreateTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "containerd_v1_types.Mount", 1) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, @@ -2139,32 +2020,32 @@ func (this *CreateRequest) String() string { }, "") return s } -func (this *CreateResponse) String() string { +func (this *CreateTaskResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CreateResponse{`, + s := strings.Join([]string{`&CreateTaskResponse{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s } -func (this *StartRequest) String() string { +func (this *StartTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&StartRequest{`, + s := strings.Join([]string{`&StartTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s } -func (this *DeleteRequest) String() string { +func (this *DeleteTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&DeleteRequest{`, + s := strings.Join([]string{`&DeleteTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") @@ -2176,6 +2057,7 @@ func (this *DeleteResponse) String() string { } s := strings.Join([]string{`&DeleteResponse{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`, `}`, @@ -2193,40 +2075,41 @@ func (this *DeleteProcessRequest) String() string { }, "") return s } -func (this *InfoRequest) String() string { +func (this *GetTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&InfoRequest{`, + s := strings.Join([]string{`&GetTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s } -func (this *InfoResponse) String() string { +func (this *GetTaskResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&InfoResponse{`, + s := strings.Join([]string{`&GetTaskResponse{`, `Task:` + strings.Replace(fmt.Sprintf("%v", this.Task), "Task", "containerd_v1_types2.Task", 1) + `,`, `}`, }, "") return s } -func (this *ListRequest) String() string { +func (this *ListTasksRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListRequest{`, + s := strings.Join([]string{`&ListTasksRequest{`, + `Filter:` + fmt.Sprintf("%v", this.Filter) + `,`, `}`, }, "") return s } -func (this *ListResponse) String() string { +func (this *ListTasksResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ListResponse{`, + s := strings.Join([]string{`&ListTasksResponse{`, `Tasks:` + strings.Replace(fmt.Sprintf("%v", this.Tasks), "Task", "containerd_v1_types2.Task", 1) + `,`, `}`, }, "") @@ -2264,45 +2147,36 @@ func (this *KillRequest_Pid) String() string { }, "") return s } -func (this *EventsRequest) String() string { +func (this *ExecProcessRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&EventsRequest{`, - `}`, - }, "") - return s -} -func (this *ExecRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExecRequest{`, + s := strings.Join([]string{`&ExecProcessRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, + `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") return s } -func (this *ExecResponse) String() string { +func (this *ExecProcessResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ExecResponse{`, + s := strings.Join([]string{`&ExecProcessResponse{`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") return s } -func (this *PtyRequest) String() string { +func (this *ResizePtyRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PtyRequest{`, + s := strings.Join([]string{`&ResizePtyRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`, @@ -2311,85 +2185,91 @@ func (this *PtyRequest) String() string { }, "") return s } -func (this *CloseStdinRequest) String() string { +func (this *CloseIORequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CloseStdinRequest{`, + s := strings.Join([]string{`&CloseIORequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `}`, }, "") return s } -func (this *PauseRequest) String() string { +func (this *PauseTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&PauseRequest{`, + s := strings.Join([]string{`&PauseTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s } -func (this *ResumeRequest) String() string { +func (this *ResumeTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ResumeRequest{`, + s := strings.Join([]string{`&ResumeTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s } -func (this *ProcessesRequest) String() string { +func (this *ListProcessesRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ProcessesRequest{`, + s := strings.Join([]string{`&ListProcessesRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s } -func (this *ProcessesResponse) String() string { +func (this *ListProcessesResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&ProcessesResponse{`, + s := strings.Join([]string{`&ListProcessesResponse{`, `Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types2.Process", 1) + `,`, `}`, }, "") return s } -func (this *CheckpointRequest) String() string { +func (this *CheckpointTaskRequest) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CheckpointRequest{`, + keysForOptions := make([]string, 0, len(this.Options)) + for k, _ := range this.Options { + keysForOptions = append(keysForOptions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForOptions) + mapStringForOptions := "map[string]string{" + for _, k := range keysForOptions { + mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) + } + mapStringForOptions += "}" + s := strings.Join([]string{`&CheckpointTaskRequest{`, `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, - `AllowTcp:` + fmt.Sprintf("%v", this.AllowTcp) + `,`, - `AllowUnixSockets:` + fmt.Sprintf("%v", this.AllowUnixSockets) + `,`, - `AllowTerminal:` + fmt.Sprintf("%v", this.AllowTerminal) + `,`, - `FileLocks:` + fmt.Sprintf("%v", this.FileLocks) + `,`, - `EmptyNamespaces:` + fmt.Sprintf("%v", this.EmptyNamespaces) + `,`, `ParentCheckpoint:` + fmt.Sprintf("%v", this.ParentCheckpoint) + `,`, - `Exit:` + fmt.Sprintf("%v", this.Exit) + `,`, + `Options:` + mapStringForOptions + `,`, `}`, }, "") return s } -func (this *CheckpointResponse) String() string { +func (this *CheckpointTaskResponse) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&CheckpointResponse{`, + s := strings.Join([]string{`&CheckpointTaskResponse{`, `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, `}`, }, "") return s } -func valueToStringExecution(v interface{}) string { +func valueToStringTasks(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" @@ -2397,7 +2277,7 @@ func valueToStringExecution(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *CreateRequest) Unmarshal(dAtA []byte) error { +func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2405,7 +2285,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2420,10 +2300,10 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CreateTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 2: @@ -2433,7 +2313,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2447,7 +2327,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2462,7 +2342,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2475,7 +2355,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -2486,14 +2366,14 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2507,7 +2387,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2515,14 +2395,14 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Stdin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2536,7 +2416,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2544,14 +2424,14 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Stdout = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2565,7 +2445,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2573,14 +2453,14 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Stderr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2593,14 +2473,14 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } } m.Terminal = bool(v != 0) - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2613,7 +2493,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -2628,12 +2508,12 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2647,7 +2527,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CreateResponse) Unmarshal(dAtA []byte) error { +func (m *CreateTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2655,7 +2535,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2670,10 +2550,10 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CreateTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 2: @@ -2683,7 +2563,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2697,7 +2577,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2712,7 +2592,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2726,12 +2606,12 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2745,7 +2625,7 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *StartRequest) Unmarshal(dAtA []byte) error { +func (m *StartTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2753,7 +2633,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2768,10 +2648,10 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: StartRequest: wiretype end group for non-group") + return fmt.Errorf("proto: StartTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: StartRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StartTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2781,7 +2661,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2795,7 +2675,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2805,12 +2685,12 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2824,7 +2704,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeleteRequest) Unmarshal(dAtA []byte) error { +func (m *DeleteTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2832,7 +2712,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2847,10 +2727,10 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeleteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: DeleteTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeleteTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2860,7 +2740,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2874,7 +2754,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2884,12 +2764,12 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -2911,7 +2791,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2939,7 +2819,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2953,7 +2833,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -2962,13 +2842,32 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) } m.ExitStatus = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -2980,14 +2879,14 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3000,7 +2899,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -3012,12 +2911,12 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3039,7 +2938,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3067,7 +2966,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3081,7 +2980,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3096,7 +2995,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3110,12 +3009,12 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3129,7 +3028,7 @@ func (m *DeleteProcessRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *InfoRequest) Unmarshal(dAtA []byte) error { +func (m *GetTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3137,7 +3036,7 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3152,10 +3051,10 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: GetTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3165,7 +3064,7 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3179,7 +3078,7 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3189,12 +3088,12 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3208,7 +3107,7 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *InfoResponse) Unmarshal(dAtA []byte) error { +func (m *GetTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3216,7 +3115,7 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3231,10 +3130,10 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: GetTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GetTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3244,7 +3143,7 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3257,7 +3156,7 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -3272,12 +3171,12 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3291,7 +3190,7 @@ func (m *InfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListRequest) Unmarshal(dAtA []byte) error { +func (m *ListTasksRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3299,7 +3198,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3314,20 +3213,49 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ListTasksRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListTasksRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTasks + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3341,7 +3269,7 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ListResponse) Unmarshal(dAtA []byte) error { +func (m *ListTasksResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3349,7 +3277,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3364,10 +3292,10 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ListResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListTasksResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListTasksResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3377,7 +3305,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3390,7 +3318,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -3403,12 +3331,12 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3430,7 +3358,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3458,7 +3386,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3472,7 +3400,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3487,7 +3415,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { m.Signal = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3506,7 +3434,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3527,7 +3455,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3542,62 +3470,12 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { m.PidOrAll = &KillRequest_Pid{v} default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthExecution - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3611,7 +3489,7 @@ func (m *EventsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExecRequest) Unmarshal(dAtA []byte) error { +func (m *ExecProcessRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3619,7 +3497,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3634,10 +3512,10 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExecRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ExecProcessRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExecRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecProcessRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3647,7 +3525,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3661,7 +3539,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3670,33 +3548,13 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Terminal = bool(v != 0) - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3710,7 +3568,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3718,14 +3576,14 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } m.Stdin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3739,7 +3597,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3747,14 +3605,14 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } m.Stdout = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3768,7 +3626,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3776,6 +3634,26 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } m.Stderr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = bool(v != 0) case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) @@ -3783,7 +3661,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3796,7 +3674,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -3811,12 +3689,12 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3830,7 +3708,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExecResponse) Unmarshal(dAtA []byte) error { +func (m *ExecProcessResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3838,7 +3716,7 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3853,10 +3731,10 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExecResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ExecProcessResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExecResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecProcessResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3866,7 +3744,7 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3880,12 +3758,12 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -3899,7 +3777,7 @@ func (m *ExecResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *PtyRequest) Unmarshal(dAtA []byte) error { +func (m *ResizePtyRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3907,7 +3785,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3922,10 +3800,10 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PtyRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ResizePtyRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PtyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResizePtyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3935,7 +3813,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3949,7 +3827,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -3964,7 +3842,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -3983,7 +3861,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { m.Width = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4002,7 +3880,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4016,12 +3894,12 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4035,7 +3913,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { +func (m *CloseIORequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4043,7 +3921,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4058,10 +3936,10 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CloseStdinRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CloseIORequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CloseStdinRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CloseIORequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4071,7 +3949,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4085,7 +3963,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -4100,7 +3978,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4112,14 +3990,34 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Stdin = bool(v != 0) default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4133,7 +4031,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *PauseRequest) Unmarshal(dAtA []byte) error { +func (m *PauseTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4141,7 +4039,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4156,10 +4054,10 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PauseRequest: wiretype end group for non-group") + return fmt.Errorf("proto: PauseTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PauseRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PauseTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4169,7 +4067,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4183,7 +4081,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -4193,12 +4091,12 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4212,7 +4110,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ResumeRequest) Unmarshal(dAtA []byte) error { +func (m *ResumeTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4220,7 +4118,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4235,10 +4133,10 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ResumeRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ResumeTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ResumeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResumeTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4248,7 +4146,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4262,7 +4160,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -4272,12 +4170,12 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4291,7 +4189,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { +func (m *ListProcessesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4299,7 +4197,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4314,10 +4212,10 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProcessesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: ListProcessesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProcessesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListProcessesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4327,7 +4225,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4341,7 +4239,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -4351,12 +4249,12 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4370,7 +4268,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { +func (m *ListProcessesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4378,7 +4276,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4393,10 +4291,10 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ProcessesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ListProcessesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ProcessesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ListProcessesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4406,7 +4304,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4419,7 +4317,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -4432,12 +4330,12 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4451,7 +4349,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { +func (m *CheckpointTaskRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4459,7 +4357,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4474,10 +4372,10 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CheckpointRequest: wiretype end group for non-group") + return fmt.Errorf("proto: CheckpointTaskRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CheckpointTaskRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4487,7 +4385,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4501,7 +4399,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + intStringLen if postIndex > l { @@ -4510,171 +4408,158 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowTcp", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentCheckpoint", wireType) } - var v int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - m.AllowTcp = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowUnixSockets", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTasks } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF } - m.AllowUnixSockets = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowTerminal", wireType) + m.ParentCheckpoint = github_com_opencontainers_go_digest.Digest(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) } - var v int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - m.AllowTerminal = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FileLocks", wireType) + if msglen < 0 { + return ErrInvalidLengthTasks } - var v int + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + keykey |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - m.FileLocks = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmptyNamespaces", wireType) - } - var stringLen uint64 + var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLenmapkey |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthExecution + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthTasks } - postIndex := iNdEx + intStringLen - if postIndex > l { + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - m.EmptyNamespaces = append(m.EmptyNamespaces, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentCheckpoint", wireType) + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Options == nil { + m.Options = make(map[string]string) } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution - } - if iNdEx >= l { - return io.ErrUnexpectedEOF + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthExecution - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ParentCheckpoint = github_com_opencontainers_go_digest.Digest(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exit", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthTasks } - if iNdEx >= l { + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Options[mapkey] = mapvalue + } else { + var mapvalue string + m.Options[mapkey] = mapvalue } - m.Exit = bool(v != 0) + iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4688,7 +4573,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { +func (m *CheckpointTaskResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4696,7 +4581,7 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4711,10 +4596,10 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CheckpointResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CheckpointTaskResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CheckpointTaskResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4724,7 +4609,7 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowExecution + return ErrIntOverflowTasks } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -4737,7 +4622,7 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } postIndex := iNdEx + msglen if postIndex > l { @@ -4750,12 +4635,12 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipExecution(dAtA[iNdEx:]) + skippy, err := skipTasks(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthExecution + return ErrInvalidLengthTasks } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -4769,14 +4654,14 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { } return nil } -func skipExecution(dAtA []byte) (n int, err error) { +func skipTasks(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowExecution + return 0, ErrIntOverflowTasks } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -4793,7 +4678,7 @@ func skipExecution(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowExecution + return 0, ErrIntOverflowTasks } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -4811,7 +4696,7 @@ func skipExecution(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowExecution + return 0, ErrIntOverflowTasks } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -4825,7 +4710,7 @@ func skipExecution(dAtA []byte) (n int, err error) { } iNdEx += length if length < 0 { - return 0, ErrInvalidLengthExecution + return 0, ErrInvalidLengthTasks } return iNdEx, nil case 3: @@ -4834,7 +4719,7 @@ func skipExecution(dAtA []byte) (n int, err error) { var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowExecution + return 0, ErrIntOverflowTasks } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -4850,7 +4735,7 @@ func skipExecution(dAtA []byte) (n int, err error) { if innerWireType == 4 { break } - next, err := skipExecution(dAtA[start:]) + next, err := skipTasks(dAtA[start:]) if err != nil { return 0, err } @@ -4870,92 +4755,88 @@ func skipExecution(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthExecution = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowExecution = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthTasks = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTasks = fmt.Errorf("proto: integer overflow") ) func init() { - proto.RegisterFile("github.com/containerd/containerd/api/services/execution/execution.proto", fileDescriptorExecution) -} - -var fileDescriptorExecution = []byte{ - // 1242 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xdb, 0xc6, - 0x13, 0x37, 0xad, 0x8f, 0xbf, 0x34, 0x94, 0x12, 0x7b, 0x61, 0x04, 0x8a, 0xf2, 0xaf, 0x24, 0x10, - 0x28, 0xa0, 0x16, 0x09, 0x95, 0x2a, 0x45, 0x0f, 0x41, 0x8b, 0xc0, 0xb2, 0x9d, 0xd6, 0x48, 0x52, - 0xbb, 0xb4, 0xdb, 0x20, 0x40, 0x01, 0x81, 0x26, 0xd7, 0xf2, 0x42, 0x14, 0x97, 0xe5, 0xae, 0x6c, - 0xeb, 0x96, 0x37, 0x68, 0xcf, 0x7d, 0x82, 0xbe, 0x48, 0x01, 0x5f, 0x0a, 0xf4, 0x58, 0xf4, 0xe0, - 0x36, 0x7e, 0x8a, 0x1e, 0x8b, 0xdd, 0x25, 0x25, 0x4a, 0xb1, 0x2a, 0x3a, 0xca, 0x45, 0xda, 0x1d, - 0xce, 0xcc, 0xee, 0xfe, 0xe6, 0xe3, 0x37, 0xf0, 0x65, 0x8f, 0xf0, 0x93, 0xe1, 0x91, 0xe9, 0xd0, - 0x41, 0xcb, 0xa1, 0x3e, 0xb7, 0x89, 0x8f, 0x43, 0x37, 0xb9, 0xb4, 0x03, 0xd2, 0x62, 0x38, 0x3c, - 0x25, 0x0e, 0x66, 0x2d, 0x7c, 0x8e, 0x9d, 0x21, 0x27, 0xd4, 0x9f, 0xac, 0xcc, 0x20, 0xa4, 0x9c, - 0xa2, 0xc6, 0xc4, 0xc4, 0x3c, 0xfd, 0xc4, 0x8c, 0x2d, 0xcc, 0xb1, 0x5e, 0xf5, 0x5e, 0x8f, 0xd2, - 0x9e, 0x87, 0x5b, 0x52, 0xff, 0x68, 0x78, 0xdc, 0xc2, 0x83, 0x80, 0x8f, 0x94, 0x79, 0xf5, 0xee, - 0xec, 0x47, 0xdb, 0x8f, 0x3f, 0x6d, 0xf4, 0x68, 0x8f, 0xca, 0x65, 0x4b, 0xac, 0x22, 0xe9, 0xe7, - 0xa9, 0x2e, 0xce, 0x47, 0x01, 0x66, 0xad, 0x01, 0x1d, 0xfa, 0x5c, 0xfd, 0x46, 0xd6, 0x4f, 0x6f, - 0x60, 0xed, 0x62, 0xe6, 0x84, 0x24, 0xe0, 0x34, 0x4c, 0x2c, 0x23, 0x3f, 0x8f, 0x6f, 0xe0, 0x87, - 0xdb, 0xac, 0x2f, 0x7f, 0x22, 0xdb, 0xfa, 0xec, 0x93, 0x39, 0x19, 0x60, 0xc6, 0xed, 0x41, 0xa0, - 0x14, 0x8c, 0x9f, 0x57, 0xa1, 0xbc, 0x15, 0x62, 0x9b, 0x63, 0x0b, 0xff, 0x30, 0xc4, 0x8c, 0xa3, - 0x36, 0x94, 0xc6, 0xae, 0xbb, 0xc4, 0xad, 0xac, 0x36, 0xb4, 0x66, 0xb1, 0x73, 0xfb, 0xea, 0xb2, - 0xae, 0x6f, 0xc5, 0xf2, 0xdd, 0x6d, 0x4b, 0x1f, 0x2b, 0xed, 0xba, 0xa8, 0x0d, 0xf9, 0x90, 0x52, - 0x7e, 0xcc, 0x2a, 0x99, 0x46, 0xa6, 0xa9, 0xb7, 0xab, 0xe6, 0x74, 0xa4, 0xe4, 0xe5, 0xcc, 0x17, - 0x02, 0x1c, 0x2b, 0xd2, 0x44, 0x1b, 0x90, 0x63, 0xdc, 0x25, 0x7e, 0x25, 0x27, 0x0e, 0xb0, 0xd4, - 0x06, 0xdd, 0x81, 0x3c, 0xe3, 0x2e, 0x1d, 0xf2, 0x4a, 0x5e, 0x8a, 0xa3, 0x5d, 0x24, 0xc7, 0x61, - 0x58, 0xf9, 0xdf, 0x58, 0x8e, 0xc3, 0x10, 0x55, 0xa1, 0xc0, 0x71, 0x38, 0x20, 0xbe, 0xed, 0x55, - 0x0a, 0x0d, 0xad, 0x59, 0xb0, 0xc6, 0x7b, 0xf4, 0x04, 0xc0, 0x39, 0xc1, 0x4e, 0x3f, 0xa0, 0xc4, - 0xe7, 0x95, 0x62, 0x43, 0x6b, 0xea, 0xed, 0xfa, 0xb5, 0x37, 0xdb, 0x1e, 0x63, 0x6e, 0x25, 0x4c, - 0x8c, 0xef, 0xe0, 0x56, 0x8c, 0x0d, 0x0b, 0xa8, 0xcf, 0xf0, 0x3b, 0x81, 0xb3, 0x06, 0x99, 0x80, - 0xb8, 0x95, 0x4c, 0x43, 0x6b, 0x96, 0x2d, 0xb1, 0x34, 0x3a, 0x50, 0x3a, 0xe0, 0x76, 0xc8, 0xe7, - 0x41, 0xae, 0x2d, 0xf6, 0x6a, 0x6c, 0x41, 0x79, 0x1b, 0x7b, 0x78, 0x7e, 0xdc, 0xd2, 0x38, 0xf9, - 0x45, 0x83, 0x5b, 0xb1, 0x97, 0x39, 0x2f, 0x4c, 0xe1, 0x06, 0xd5, 0x41, 0xc7, 0xe7, 0x84, 0x77, - 0x19, 0xb7, 0xf9, 0x90, 0x49, 0x50, 0xca, 0x16, 0x08, 0xd1, 0x81, 0x94, 0xa0, 0x4d, 0x28, 0x8a, - 0x1d, 0x76, 0xbb, 0x36, 0x97, 0x40, 0x88, 0x14, 0x51, 0xa9, 0x69, 0xc6, 0xa9, 0x69, 0x1e, 0xc6, - 0xa9, 0xd9, 0x29, 0x5c, 0x5c, 0xd6, 0x57, 0x7e, 0xfa, 0xab, 0xae, 0x59, 0x05, 0x65, 0xb6, 0xc9, - 0x8d, 0xef, 0x61, 0x43, 0xdd, 0x74, 0x3f, 0xa4, 0x0e, 0x66, 0x6c, 0x89, 0x67, 0xc7, 0x11, 0x59, - 0x9d, 0x44, 0x64, 0x13, 0xf4, 0x5d, 0xff, 0x98, 0x2e, 0x83, 0xe5, 0x17, 0x50, 0x52, 0x2e, 0x22, - 0x20, 0x1f, 0x40, 0x56, 0x14, 0xa2, 0xb4, 0xd5, 0xdb, 0x77, 0xaf, 0xcd, 0xbb, 0x43, 0x9b, 0xf5, - 0x2d, 0xa9, 0x66, 0x94, 0x41, 0x7f, 0x4e, 0x58, 0x9c, 0x12, 0xc6, 0x13, 0x28, 0xa9, 0x6d, 0xe4, - 0xad, 0x05, 0x39, 0xa1, 0xc6, 0x2a, 0x9a, 0x2c, 0xb0, 0xff, 0x70, 0xa7, 0xf4, 0x8c, 0x1f, 0x35, - 0xd0, 0x9f, 0x11, 0xcf, 0x5b, 0x06, 0x27, 0x51, 0x74, 0xa4, 0x27, 0x4a, 0x4b, 0x41, 0x15, 0xed, - 0x10, 0x82, 0x8c, 0xed, 0x79, 0x32, 0x90, 0x85, 0xaf, 0x56, 0x2c, 0xb1, 0x11, 0x32, 0x81, 0x69, - 0x56, 0x28, 0x0a, 0x59, 0x40, 0xdc, 0x4e, 0x09, 0x20, 0x20, 0x6e, 0x97, 0x86, 0x5d, 0xdb, 0xf3, - 0x8c, 0xdb, 0x50, 0xde, 0x39, 0xc5, 0x3e, 0x8f, 0x43, 0x67, 0xfc, 0xa6, 0x81, 0xbe, 0x73, 0x8e, - 0x9d, 0x65, 0xae, 0x98, 0xac, 0xff, 0xd5, 0x99, 0xfa, 0x1f, 0x77, 0x98, 0xcc, 0xf5, 0x1d, 0x26, - 0x3b, 0xa7, 0xc3, 0xe4, 0xa6, 0x3a, 0x4c, 0x13, 0xb2, 0x2c, 0xc0, 0x8e, 0xec, 0x47, 0x7a, 0x7b, - 0xe3, 0xad, 0xb4, 0xdd, 0xf4, 0x47, 0x96, 0xd4, 0x30, 0x1a, 0x50, 0x52, 0xcf, 0x89, 0x62, 0x16, - 0xa5, 0x99, 0x36, 0x49, 0xb3, 0xd7, 0x1a, 0xc0, 0x3e, 0x1f, 0xbd, 0xd7, 0xdc, 0x15, 0xcf, 0x3c, - 0x23, 0x2e, 0x3f, 0x89, 0x3a, 0x8c, 0xda, 0x88, 0xe7, 0x9c, 0x60, 0xd2, 0x3b, 0x51, 0xcf, 0x2c, - 0x5b, 0xd1, 0xce, 0x78, 0x05, 0xeb, 0x5b, 0x1e, 0x65, 0xf8, 0x40, 0x80, 0xf1, 0x7e, 0x8b, 0xa8, - 0x03, 0xa5, 0x7d, 0x7b, 0xc8, 0xf0, 0x92, 0x6d, 0xcd, 0xc2, 0x6c, 0x38, 0x58, 0xca, 0xc9, 0x53, - 0x58, 0x8b, 0xba, 0x04, 0x5e, 0xa6, 0x4f, 0x18, 0x7b, 0xb0, 0x9e, 0xf0, 0x13, 0x45, 0xf5, 0x31, - 0x14, 0x83, 0x58, 0x18, 0x55, 0xe3, 0xff, 0xaf, 0xad, 0xc6, 0xb8, 0x51, 0x4d, 0xd4, 0x8d, 0x7f, - 0x56, 0x61, 0x7d, 0x6b, 0xcc, 0x2f, 0xcb, 0xa0, 0x7f, 0x0f, 0x8a, 0xb6, 0xe7, 0xd1, 0xb3, 0x2e, - 0x77, 0x82, 0x38, 0xf1, 0xa5, 0xe0, 0xd0, 0x09, 0xd0, 0x7d, 0x40, 0xea, 0xe3, 0xd0, 0x27, 0xe7, - 0x5d, 0x46, 0x9d, 0x3e, 0xe6, 0x4c, 0x95, 0xab, 0xb5, 0x26, 0xbf, 0x7c, 0xeb, 0x93, 0xf3, 0x03, - 0x25, 0x47, 0x1f, 0xc2, 0xad, 0xc8, 0x55, 0x5c, 0x48, 0x59, 0xa9, 0x59, 0x56, 0xfe, 0xe2, 0x6a, - 0xfa, 0x00, 0xe0, 0x98, 0x78, 0xb8, 0xeb, 0x51, 0xa7, 0xcf, 0x64, 0x8d, 0x14, 0xac, 0xa2, 0x90, - 0x3c, 0x17, 0x02, 0xf4, 0x11, 0xac, 0xc9, 0x59, 0xab, 0xeb, 0xdb, 0x03, 0xcc, 0x02, 0xdb, 0xc1, - 0xac, 0x92, 0x6f, 0x64, 0x9a, 0x45, 0xeb, 0xb6, 0x94, 0x7f, 0x3d, 0x16, 0xa3, 0x2e, 0xac, 0x07, - 0x76, 0x88, 0x7d, 0xde, 0x4d, 0xd0, 0xb3, 0xa4, 0xf5, 0x4e, 0x5b, 0x74, 0xfe, 0x3f, 0x2f, 0xeb, - 0x1f, 0x27, 0x66, 0x1e, 0x1a, 0x60, 0x7f, 0xfc, 0x74, 0xd6, 0xea, 0xd1, 0x07, 0x2e, 0xe9, 0x61, - 0xc6, 0xcd, 0x6d, 0xf9, 0x67, 0xad, 0x29, 0x67, 0x13, 0x5c, 0x11, 0x82, 0xac, 0xe0, 0x8d, 0x68, - 0x20, 0x90, 0x6b, 0xe3, 0x25, 0xa0, 0x24, 0xf2, 0x51, 0x30, 0x37, 0x41, 0x9f, 0xcc, 0x5b, 0x71, - 0x38, 0x17, 0xce, 0x08, 0x49, 0x9b, 0xf6, 0xaf, 0x3a, 0xe4, 0x44, 0xe3, 0x65, 0xa8, 0x0f, 0x79, - 0x35, 0x2e, 0xa0, 0x96, 0xb9, 0x68, 0x52, 0x35, 0xa7, 0x86, 0xae, 0xea, 0xc3, 0xf4, 0x06, 0xd1, - 0xcd, 0xf7, 0x20, 0x27, 0x67, 0x08, 0x64, 0x2e, 0x36, 0x4d, 0x0e, 0x1b, 0xd5, 0x3b, 0x6f, 0x75, - 0xb0, 0x1d, 0x11, 0x1f, 0x71, 0x7b, 0x45, 0xb0, 0x69, 0x6e, 0x3f, 0x35, 0x7a, 0xa4, 0xb9, 0xfd, - 0xcc, 0x94, 0x31, 0x8a, 0xa7, 0x97, 0xa8, 0x48, 0xd0, 0x67, 0x69, 0x5d, 0x4c, 0xd3, 0xff, 0x3b, - 0x1c, 0x8d, 0x21, 0x2b, 0x78, 0x1a, 0x3d, 0x58, 0x6c, 0x99, 0x18, 0x09, 0xaa, 0x66, 0x5a, 0xf5, - 0xc9, 0x31, 0x82, 0xc0, 0xd3, 0x1c, 0x93, 0xe0, 0xfd, 0x34, 0xc7, 0x4c, 0xcd, 0x05, 0x2f, 0x20, - 0x2b, 0x58, 0x3e, 0xcd, 0x31, 0x89, 0x69, 0x60, 0x6e, 0x12, 0xbc, 0x84, 0xbc, 0xe2, 0xe8, 0x34, - 0x49, 0x30, 0xc5, 0xe6, 0xd5, 0xeb, 0x67, 0x7e, 0xa9, 0xf3, 0x50, 0x13, 0x70, 0x08, 0x6e, 0x4c, - 0x73, 0xcf, 0xc4, 0x48, 0x90, 0x06, 0x8e, 0x29, 0xca, 0x7d, 0x06, 0x99, 0x7d, 0x3e, 0x42, 0xf7, - 0x17, 0x9b, 0x4d, 0x68, 0x78, 0x2e, 0x18, 0xaf, 0x00, 0x26, 0x54, 0x89, 0x1e, 0xa5, 0x28, 0xd1, - 0x59, 0x62, 0x9d, 0xeb, 0x7a, 0x0f, 0x72, 0x92, 0x2a, 0xd3, 0x54, 0x6f, 0x92, 0x53, 0xe7, 0x3a, - 0xfc, 0x06, 0xf2, 0x8a, 0x37, 0xd3, 0x04, 0x6e, 0x8a, 0x61, 0xe7, 0xba, 0xe4, 0x50, 0x1c, 0xb3, - 0x1f, 0x6a, 0xa7, 0xb8, 0xe7, 0x0c, 0xe5, 0x56, 0x1f, 0xdd, 0xc8, 0x26, 0x8a, 0xe0, 0x19, 0x40, - 0xa2, 0x93, 0xa7, 0x01, 0x7d, 0x96, 0x4f, 0xab, 0x9f, 0xde, 0xcc, 0x48, 0x1d, 0xdc, 0xa9, 0x5c, - 0xbc, 0xa9, 0xad, 0xfc, 0xf1, 0xa6, 0xb6, 0xf2, 0xfa, 0xaa, 0xa6, 0x5d, 0x5c, 0xd5, 0xb4, 0xdf, - 0xaf, 0x6a, 0xda, 0xdf, 0x57, 0x35, 0xed, 0x28, 0x2f, 0x81, 0x79, 0xf4, 0x6f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x46, 0xa7, 0x8c, 0x94, 0xc8, 0x10, 0x00, 0x00, + proto.RegisterFile("github.com/containerd/containerd/api/services/tasks/tasks.proto", fileDescriptorTasks) +} + +var fileDescriptorTasks = []byte{ + // 1178 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4b, 0x53, 0xe3, 0xc6, + 0x13, 0x47, 0x7e, 0xad, 0x69, 0x2f, 0x2c, 0xcc, 0x9f, 0xa5, 0xbc, 0xfa, 0x6f, 0xd9, 0x94, 0x2e, + 0x71, 0xb6, 0x82, 0x1c, 0x4c, 0x0e, 0x29, 0x2a, 0x55, 0xbb, 0x80, 0x59, 0x42, 0x1e, 0x05, 0x11, + 0x7b, 0xda, 0xa4, 0xca, 0x25, 0xac, 0xc1, 0x4c, 0x59, 0x96, 0xb4, 0x9a, 0x31, 0x8b, 0x73, 0xca, + 0x29, 0xd7, 0xe4, 0x13, 0xe4, 0x83, 0xe4, 0x9c, 0x03, 0xc7, 0x1c, 0x72, 0x48, 0xe5, 0x40, 0xb2, + 0xe4, 0x8b, 0xa4, 0x66, 0x34, 0x12, 0xf2, 0x53, 0xf6, 0x9a, 0x8b, 0x3d, 0xd3, 0xea, 0xee, 0xe9, + 0xf7, 0xaf, 0xe1, 0x79, 0x8b, 0xb0, 0x8b, 0xee, 0x99, 0xde, 0x74, 0x3b, 0xd5, 0xa6, 0xeb, 0x30, + 0x93, 0x38, 0xd8, 0xb7, 0xe2, 0x47, 0xd3, 0x23, 0x55, 0x8a, 0xfd, 0x4b, 0xd2, 0xc4, 0xb4, 0xca, + 0x4c, 0xda, 0x96, 0xbf, 0xba, 0xe7, 0xbb, 0xcc, 0x45, 0x4f, 0xef, 0x58, 0xf5, 0x90, 0x4d, 0x0f, + 0x18, 0x2e, 0xb7, 0xd4, 0xff, 0xb7, 0x5c, 0xb7, 0x65, 0xe3, 0xaa, 0xe0, 0x3d, 0xeb, 0x9e, 0x57, + 0x71, 0xc7, 0x63, 0xbd, 0x40, 0x54, 0x7d, 0x32, 0xf8, 0xd1, 0x74, 0xc2, 0x4f, 0x6b, 0x2d, 0xb7, + 0xe5, 0x8a, 0x63, 0x95, 0x9f, 0x24, 0xf5, 0xb3, 0xa9, 0x8c, 0x65, 0x3d, 0x0f, 0xd3, 0x6a, 0xc7, + 0xed, 0x3a, 0x2c, 0xf8, 0x95, 0xd2, 0x2f, 0x67, 0x90, 0xb6, 0x30, 0x6d, 0xfa, 0xc4, 0x63, 0xae, + 0x1f, 0x3b, 0x4a, 0x3d, 0x3b, 0x33, 0xe8, 0xe1, 0x81, 0x10, 0x3f, 0x52, 0xb6, 0x3c, 0xe8, 0x32, + 0x23, 0x1d, 0x4c, 0x99, 0xd9, 0xf1, 0x02, 0x06, 0xed, 0x97, 0x14, 0xac, 0xee, 0xfb, 0xd8, 0x64, + 0xf8, 0x95, 0x49, 0xdb, 0x06, 0x7e, 0xd3, 0xc5, 0x94, 0xa1, 0x1a, 0x3c, 0x8c, 0xd4, 0x37, 0x88, + 0x55, 0x4c, 0x6d, 0x28, 0x95, 0xc5, 0xbd, 0x47, 0xb7, 0x37, 0xe5, 0xc2, 0x7e, 0x48, 0x3f, 0xaa, + 0x1b, 0x85, 0x88, 0xe9, 0xc8, 0x42, 0x35, 0xc8, 0xf9, 0xae, 0xcb, 0xce, 0x69, 0x31, 0xbd, 0x91, + 0xae, 0x14, 0x6a, 0xaa, 0x1e, 0xcb, 0xd4, 0xe5, 0x96, 0x2e, 0x0c, 0xd4, 0xbf, 0xe6, 0x01, 0x32, + 0x24, 0x27, 0x5a, 0x83, 0x2c, 0x65, 0x16, 0x71, 0x8a, 0x19, 0xfe, 0x80, 0x11, 0x5c, 0xd0, 0x3a, + 0xe4, 0x28, 0xb3, 0xdc, 0x2e, 0x2b, 0x66, 0x05, 0x59, 0xde, 0x24, 0x1d, 0xfb, 0x7e, 0x31, 0x17, + 0xd1, 0xb1, 0xef, 0x23, 0x15, 0xf2, 0x0c, 0xfb, 0x1d, 0xe2, 0x98, 0x76, 0xf1, 0xc1, 0x86, 0x52, + 0xc9, 0x1b, 0xd1, 0x1d, 0x3d, 0x07, 0x68, 0x5e, 0xe0, 0x66, 0xdb, 0x73, 0x89, 0xc3, 0x8a, 0xf9, + 0x0d, 0xa5, 0x52, 0xa8, 0x95, 0x47, 0x5a, 0x56, 0x8f, 0xe2, 0x6e, 0xc4, 0x44, 0xb4, 0xd7, 0x80, + 0xe2, 0xf1, 0xa1, 0x9e, 0xeb, 0x50, 0xfc, 0x5e, 0x01, 0x5a, 0x81, 0xb4, 0x47, 0xac, 0x62, 0x7a, + 0x43, 0xa9, 0x2c, 0x19, 0xfc, 0xa8, 0xbd, 0x84, 0x95, 0x53, 0x66, 0xfa, 0x6c, 0x52, 0xe8, 0x95, + 0x64, 0xcd, 0xda, 0x21, 0xac, 0xd6, 0xb1, 0x8d, 0x27, 0xe7, 0x70, 0x1a, 0x45, 0xbf, 0x2a, 0xb0, + 0x1c, 0x68, 0x1a, 0xeb, 0xa9, 0x32, 0xbd, 0xa7, 0xa9, 0xc8, 0x53, 0x54, 0x86, 0x02, 0xbe, 0x22, + 0xac, 0x41, 0x99, 0xc9, 0xba, 0x54, 0xc6, 0x00, 0x38, 0xe9, 0x54, 0x50, 0xd0, 0x2e, 0x2c, 0xf2, + 0x1b, 0xb6, 0x1a, 0x26, 0x13, 0xd5, 0xc0, 0x0b, 0x28, 0x28, 0x5e, 0x3d, 0x2c, 0x5e, 0xfd, 0x55, + 0x58, 0xbc, 0x7b, 0xf9, 0xeb, 0x9b, 0xf2, 0xc2, 0xcf, 0x7f, 0x97, 0x15, 0x23, 0x1f, 0x88, 0xed, + 0x32, 0xed, 0x3b, 0x58, 0x0b, 0x6c, 0x3f, 0xf1, 0xdd, 0x26, 0xa6, 0x74, 0x8e, 0x40, 0x0c, 0x7b, + 0xa0, 0xd5, 0x61, 0xf9, 0x10, 0xcf, 0x9d, 0xa9, 0x17, 0xf0, 0x28, 0xd2, 0x22, 0x03, 0xbc, 0x09, + 0x19, 0xde, 0xb0, 0x42, 0xbc, 0x50, 0x7b, 0x32, 0xb2, 0x36, 0x85, 0x80, 0x60, 0xd3, 0x9e, 0xc1, + 0xca, 0x57, 0x84, 0x0a, 0x15, 0x91, 0x87, 0xeb, 0x90, 0x3b, 0x27, 0x36, 0xc3, 0x7e, 0x60, 0x83, + 0x21, 0x6f, 0x5a, 0x1d, 0x56, 0x63, 0xbc, 0xf2, 0xbd, 0x2a, 0x64, 0xc5, 0xb8, 0x2c, 0x2a, 0xa2, + 0x4d, 0x27, 0x3c, 0x18, 0xf0, 0x69, 0x3f, 0x29, 0x50, 0xf8, 0x92, 0xd8, 0xf6, 0x3c, 0xf1, 0xe4, + 0xad, 0x4b, 0x5a, 0xbc, 0x41, 0x83, 0x90, 0xca, 0x1b, 0x42, 0x90, 0x36, 0x6d, 0x5b, 0xd4, 0x43, + 0xfe, 0xf3, 0x05, 0x83, 0x5f, 0x38, 0x8d, 0xc7, 0x9e, 0x17, 0xc1, 0x12, 0xa7, 0x79, 0xc4, 0xda, + 0x7b, 0x08, 0xe0, 0x11, 0xab, 0xe1, 0xfa, 0x0d, 0xd3, 0xb6, 0xb5, 0x3f, 0x14, 0x40, 0x07, 0x57, + 0xb8, 0x79, 0x0f, 0x89, 0x8e, 0x26, 0x50, 0x6a, 0xf4, 0x04, 0x4a, 0x8f, 0x99, 0x40, 0x99, 0xb1, + 0x13, 0x28, 0x3b, 0x30, 0x81, 0x2a, 0x90, 0xa1, 0x1e, 0x6e, 0x8a, 0x99, 0x55, 0xa8, 0xad, 0x0d, + 0x15, 0xf5, 0xae, 0xd3, 0x33, 0x04, 0x87, 0xf6, 0x01, 0xfc, 0xaf, 0xcf, 0x2b, 0x99, 0x30, 0x59, + 0x8b, 0xca, 0x5d, 0x2d, 0xfe, 0xa8, 0xc0, 0x8a, 0x81, 0x29, 0xf9, 0x1e, 0x9f, 0xb0, 0xde, 0xbd, + 0x96, 0x39, 0x8f, 0xc7, 0x5b, 0x62, 0xb1, 0x0b, 0xd9, 0xa2, 0xc1, 0x85, 0xfb, 0x7d, 0x81, 0x49, + 0xeb, 0x22, 0x68, 0xcd, 0x25, 0x43, 0xde, 0x34, 0x1b, 0x96, 0xf7, 0x6d, 0x97, 0xe2, 0xa3, 0xe3, + 0x7b, 0xb7, 0x22, 0xc8, 0x8a, 0x28, 0x0c, 0x99, 0x15, 0x3e, 0x2e, 0x4f, 0xcc, 0x2e, 0xc5, 0xf7, + 0x30, 0x2e, 0x0d, 0x4c, 0xbb, 0x9d, 0xb9, 0x15, 0x7d, 0x01, 0x6b, 0xbc, 0xbf, 0x64, 0xc2, 0xf0, + 0x3c, 0x85, 0xa8, 0x9d, 0xc2, 0xe3, 0x01, 0x5d, 0x32, 0xfd, 0x3b, 0xb0, 0xe8, 0x85, 0x44, 0xd9, + 0xb3, 0x4f, 0x47, 0xf6, 0x6c, 0x58, 0x37, 0x77, 0xec, 0xda, 0x6f, 0x29, 0x78, 0xbc, 0x1f, 0x61, + 0xd9, 0x9c, 0xee, 0xa2, 0x06, 0xac, 0x7a, 0xa6, 0x8f, 0x1d, 0xd6, 0x88, 0x41, 0x6a, 0x80, 0x7c, + 0x35, 0x3e, 0x8f, 0xff, 0xba, 0x29, 0x3f, 0x8b, 0xed, 0x2a, 0xae, 0x87, 0x9d, 0x48, 0x9c, 0x56, + 0x5b, 0xee, 0xa6, 0x45, 0x5a, 0x98, 0x32, 0xbd, 0x2e, 0xfe, 0x8c, 0x95, 0x40, 0xd9, 0x9d, 0x7d, + 0xe8, 0x35, 0x3c, 0x70, 0x3d, 0x46, 0x5c, 0x27, 0xdc, 0x21, 0x5e, 0xe8, 0x93, 0xb6, 0x3d, 0x7d, + 0xa4, 0x6b, 0xfa, 0x71, 0xa0, 0xe2, 0xc0, 0x61, 0x7e, 0xcf, 0x08, 0x15, 0xaa, 0x3b, 0xf0, 0x30, + 0xfe, 0x81, 0x17, 0x5d, 0x1b, 0xf7, 0xe4, 0xc0, 0xe4, 0x47, 0x5e, 0x74, 0x97, 0xa6, 0xdd, 0xc5, + 0xe1, 0x28, 0x10, 0x97, 0x9d, 0xd4, 0xa7, 0x8a, 0xf6, 0x2d, 0xac, 0x0f, 0x3e, 0x25, 0x93, 0xb3, + 0x0b, 0x85, 0xbb, 0x7d, 0x2d, 0x4c, 0x4f, 0xe2, 0x7e, 0x11, 0x97, 0xa9, 0xfd, 0x0b, 0x90, 0x15, + 0x13, 0x1a, 0xb5, 0x21, 0x17, 0xac, 0x1a, 0xa8, 0x9a, 0xe0, 0xf7, 0xe0, 0xc2, 0xa6, 0x7e, 0x3c, + 0xbd, 0x80, 0xb4, 0xfc, 0x18, 0xb2, 0x62, 0xf7, 0x40, 0xfa, 0x64, 0xd1, 0xc1, 0x05, 0x45, 0x5d, + 0x1f, 0x9a, 0x60, 0x07, 0x7c, 0xc7, 0x46, 0x2d, 0xc8, 0x05, 0xf0, 0x9b, 0x64, 0xfd, 0xd0, 0xaa, + 0xa2, 0x7e, 0x34, 0x8d, 0x40, 0x64, 0xf9, 0x1b, 0x58, 0xea, 0xc3, 0x79, 0x54, 0x9b, 0x46, 0xbc, + 0x1f, 0x2b, 0x66, 0x7c, 0xf2, 0x0c, 0xd2, 0x87, 0x98, 0xa1, 0x04, 0xa1, 0xfe, 0xfd, 0x40, 0xdd, + 0x9c, 0x92, 0x5b, 0xbe, 0xd1, 0x82, 0x0c, 0x1f, 0x00, 0x49, 0xf9, 0x18, 0x04, 0x7f, 0xb5, 0x3a, + 0x35, 0xbf, 0x7c, 0xe8, 0x08, 0x32, 0x1c, 0xce, 0xd1, 0x87, 0x93, 0x05, 0x63, 0x90, 0x3f, 0x36, + 0xe7, 0x6d, 0xc8, 0x70, 0xc4, 0x42, 0x09, 0xe5, 0x37, 0x8c, 0xd5, 0xea, 0xd6, 0x0c, 0x12, 0xd2, + 0xee, 0x53, 0x58, 0x8c, 0x40, 0x2f, 0x29, 0x4a, 0x83, 0xe8, 0x38, 0xd6, 0x83, 0x63, 0x78, 0x20, + 0x11, 0x2c, 0x29, 0xbb, 0xfd, 0x40, 0x37, 0x41, 0x61, 0x56, 0x80, 0x54, 0x92, 0x85, 0x83, 0x48, + 0x36, 0x56, 0xe1, 0x37, 0x90, 0x0b, 0xd0, 0x2a, 0xa9, 0xaf, 0x86, 0x30, 0x6d, 0xac, 0xca, 0x2b, + 0x58, 0xea, 0xc3, 0x9a, 0xa4, 0x0e, 0x1a, 0x05, 0x72, 0xea, 0xf6, 0x4c, 0x32, 0x32, 0x87, 0x6f, + 0x01, 0x62, 0xf3, 0x7e, 0xfb, 0x3d, 0xc6, 0xbb, 0xfa, 0xc9, 0x6c, 0x42, 0xc1, 0xc3, 0x7b, 0xc5, + 0xeb, 0x77, 0xa5, 0x85, 0x3f, 0xdf, 0x95, 0x16, 0x7e, 0xb8, 0x2d, 0x29, 0xd7, 0xb7, 0x25, 0xe5, + 0xf7, 0xdb, 0x92, 0xf2, 0xcf, 0x6d, 0x49, 0x39, 0xcb, 0x89, 0xe0, 0x6c, 0xff, 0x17, 0x00, 0x00, + 0xff, 0xff, 0xb0, 0x5b, 0xd4, 0x42, 0x9a, 0x10, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/execution/execution.proto b/vendor/github.com/containerd/containerd/api/services/tasks/tasks.proto similarity index 56% rename from vendor/github.com/containerd/containerd/api/services/execution/execution.proto rename to vendor/github.com/containerd/containerd/api/services/tasks/tasks.proto index 0b2d9210df..2962876625 100644 --- a/vendor/github.com/containerd/containerd/api/services/execution/execution.proto +++ b/vendor/github.com/containerd/containerd/api/services/tasks/tasks.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1.services.execution; +package containerd.services.tasks.v1; import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; @@ -11,31 +11,47 @@ import "github.com/containerd/containerd/api/types/task/task.proto"; import "google/protobuf/timestamp.proto"; service Tasks { - rpc Create(CreateRequest) returns (CreateResponse); - rpc Start(StartRequest) returns (google.protobuf.Empty); - rpc Delete(DeleteRequest) returns (DeleteResponse); + // Create a task. + rpc Create(CreateTaskRequest) returns (CreateTaskResponse); + + // Start a task. + rpc Start(StartTaskRequest) returns (google.protobuf.Empty); + + // Delete a task and on disk state. + rpc Delete(DeleteTaskRequest) returns (DeleteResponse); + rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse); - rpc Info(InfoRequest) returns (InfoResponse); - rpc List(ListRequest) returns (ListResponse); + + rpc Get(GetTaskRequest) returns (GetTaskResponse); + + rpc List(ListTasksRequest) returns (ListTasksResponse); + + // Kill a task or process. rpc Kill(KillRequest) returns (google.protobuf.Empty); - rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); - rpc Exec(ExecRequest) returns (ExecResponse); - rpc Pty(PtyRequest) returns (google.protobuf.Empty); - rpc CloseStdin(CloseStdinRequest) returns (google.protobuf.Empty); - rpc Pause(PauseRequest) returns (google.protobuf.Empty); - rpc Resume(ResumeRequest) returns (google.protobuf.Empty); - rpc Processes(ProcessesRequest) returns (ProcessesResponse); - rpc Checkpoint(CheckpointRequest) returns (CheckpointResponse); + + rpc Exec(ExecProcessRequest) returns (ExecProcessResponse); + + rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); + + rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty); + + rpc Pause(PauseTaskRequest) returns (google.protobuf.Empty); + + rpc Resume(ResumeTaskRequest) returns (google.protobuf.Empty); + + rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse); + + rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse); } -message CreateRequest { +message CreateTaskRequest { + // NOTE: reserve field 1 for task id. + // ContainerID specifies the container to use for creating this task. // // The spec from the provided container id will be used to create the // task associated with this container. Only one task can be run at a time // per container. - // - // This should be created using the Containers service. string container_id = 2; // RootFS provides the pre-chroot mounts to perform in the shim before @@ -46,15 +62,15 @@ message CreateRequest { // the container object. repeated containerd.v1.types.Mount rootfs = 3; - string stdin = 5; - string stdout = 6; - string stderr = 7; - bool terminal = 8; + string stdin = 4; + string stdout = 5; + string stderr = 6; + bool terminal = 7; - types.Descriptor checkpoint = 9; + containerd.v1.types.Descriptor checkpoint = 8; } -message CreateResponse { +message CreateTaskResponse { // TODO(stevvooe): We no longer have an id for a task since they are bound // to a single container. Although, we should represent each new task with // an ID so one can differentiate between each instance of a container @@ -68,18 +84,19 @@ message CreateResponse { uint32 pid = 3; } -message StartRequest { +message StartTaskRequest { string container_id = 1; } -message DeleteRequest { +message DeleteTaskRequest { string container_id = 1; } message DeleteResponse { string container_id = 1; - uint32 exit_status = 2; - google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + uint32 pid = 2; + uint32 exit_status = 3; + google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message DeleteProcessRequest { @@ -87,18 +104,19 @@ message DeleteProcessRequest { uint32 pid = 2; } -message InfoRequest { +message GetTaskRequest { string container_id = 1; } -message InfoResponse { - types.Task task = 1; +message GetTaskResponse { + containerd.v1.types.Task task = 1; } -message ListRequest { +message ListTasksRequest { + string filter = 1; } -message ListResponse { +message ListTasksResponse { repeated containerd.v1.types.Task tasks = 1; } @@ -111,16 +129,14 @@ message KillRequest { } } -message EventsRequest { -} - -message ExecRequest { +message ExecProcessRequest { // ContainerID specifies the container in which to exec the process. string container_id = 1; - bool terminal = 2; - string stdin = 3; - string stdout = 4; - string stderr = 5; + + string stdin = 2; + string stdout = 3; + string stderr = 4; + bool terminal = 5; // Spec for starting a process in the target container. // @@ -128,49 +144,45 @@ message ExecRequest { google.protobuf.Any spec = 6; } -message ExecResponse { +message ExecProcessResponse { uint32 pid = 1; } -message PtyRequest { +message ResizePtyRequest { string container_id = 1; uint32 pid = 2; uint32 width = 3; uint32 height = 4; } -message CloseStdinRequest { +message CloseIORequest { string container_id = 1; uint32 pid = 2; + bool stdin = 3; } -message PauseRequest { +message PauseTaskRequest { string container_id = 1; } -message ResumeRequest { +message ResumeTaskRequest { string container_id = 1; } -message ProcessesRequest { +message ListProcessesRequest { string container_id = 1; } -message ProcessesResponse{ +message ListProcessesResponse{ repeated containerd.v1.types.Process processes = 1; } -message CheckpointRequest { +message CheckpointTaskRequest { string container_id = 1; - bool allow_tcp = 2; - bool allow_unix_sockets = 3; - bool allow_terminal = 4; - bool file_locks = 5; - repeated string empty_namespaces = 6; - string parent_checkpoint = 7 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; - bool exit = 8; + string parent_checkpoint = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; + map options = 3; } -message CheckpointResponse { - repeated types.Descriptor descriptors = 1; +message CheckpointTaskResponse { + repeated containerd.v1.types.Descriptor descriptors = 1; } diff --git a/vendor/github.com/containerd/containerd/api/services/version/version.pb.go b/vendor/github.com/containerd/containerd/api/services/version/version.pb.go index 5dc5fd697e..5da34428ad 100644 --- a/vendor/github.com/containerd/containerd/api/services/version/version.pb.go +++ b/vendor/github.com/containerd/containerd/api/services/version/version.pb.go @@ -50,7 +50,7 @@ func (*VersionResponse) ProtoMessage() {} func (*VersionResponse) Descriptor() ([]byte, []int) { return fileDescriptorVersion, []int{0} } func init() { - proto.RegisterType((*VersionResponse)(nil), "containerd.v1.VersionResponse") + proto.RegisterType((*VersionResponse)(nil), "containerd.services.version.v1.VersionResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -77,7 +77,7 @@ func NewVersionClient(cc *grpc.ClientConn) VersionClient { func (c *versionClient) Version(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*VersionResponse, error) { out := new(VersionResponse) - err := grpc.Invoke(ctx, "/containerd.v1.Version/Version", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.services.version.v1.Version/Version", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -104,7 +104,7 @@ func _Version_Version_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.Version/Version", + FullMethod: "/containerd.services.version.v1.Version/Version", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VersionServer).Version(ctx, req.(*google_protobuf.Empty)) @@ -113,7 +113,7 @@ func _Version_Version_Handler(srv interface{}, ctx context.Context, dec func(int } var _Version_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.Version", + ServiceName: "containerd.services.version.v1.Version", HandlerType: (*VersionServer)(nil), Methods: []grpc.MethodDesc{ { @@ -446,20 +446,20 @@ func init() { } var fileDescriptorVersion = []byte{ - // 225 bytes of a gzipped FileDescriptorProto + // 230 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x72, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x17, 0xa7, 0x16, 0x95, 0x65, 0x26, 0xa7, 0x16, 0xeb, 0x97, 0xa5, 0x16, 0x15, 0x67, 0xe6, 0xe7, 0xc1, 0x68, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, - 0x5e, 0x84, 0x72, 0xbd, 0x32, 0x43, 0x29, 0xe9, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0xb0, - 0x64, 0x52, 0x69, 0x9a, 0x7e, 0x6a, 0x6e, 0x41, 0x49, 0x25, 0x44, 0xad, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0xdc, 0xb9, 0xf8, 0xc3, 0x20, 0x46, 0x06, - 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x49, 0x70, 0xb1, 0x43, 0x6d, 0x91, 0x60, 0x54, - 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0xa4, 0xb8, 0x38, 0x8a, 0x52, 0xcb, 0x32, 0xc1, 0x52, - 0x4c, 0x60, 0x29, 0x38, 0xdf, 0xc8, 0x87, 0x8b, 0x1d, 0x6a, 0x90, 0x90, 0x23, 0x82, 0x29, 0xa6, - 0x07, 0x71, 0x92, 0x1e, 0xcc, 0x49, 0x7a, 0xae, 0x20, 0x27, 0x49, 0xc9, 0xe9, 0xa1, 0xb8, 0x5c, - 0x0f, 0xcd, 0x0d, 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, 0x4c, 0x62, - 0x03, 0x9b, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x27, 0xa4, 0xd8, 0x40, 0x01, 0x00, - 0x00, + 0x39, 0x84, 0x72, 0x3d, 0x98, 0x52, 0x3d, 0x98, 0x92, 0x32, 0x43, 0x29, 0xe9, 0xf4, 0xfc, 0xfc, + 0xf4, 0x9c, 0x54, 0x7d, 0xb0, 0xea, 0xa4, 0xd2, 0x34, 0xfd, 0xd4, 0xdc, 0x82, 0x92, 0x4a, 0x88, + 0x66, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x88, 0x2a, 0xb9, 0x73, + 0xf1, 0x87, 0x41, 0x0c, 0x08, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x15, 0x92, 0xe0, 0x62, + 0x87, 0x9a, 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe3, 0x0a, 0x49, 0x71, 0x71, 0x14, + 0xa5, 0x96, 0x65, 0x82, 0xa5, 0x98, 0xc0, 0x52, 0x70, 0xbe, 0x51, 0x2c, 0x17, 0x3b, 0xd4, 0x20, + 0xa1, 0x20, 0x04, 0x53, 0x4c, 0x0f, 0xe2, 0x24, 0x3d, 0x98, 0x93, 0xf4, 0x5c, 0x41, 0x4e, 0x92, + 0xd2, 0xd7, 0xc3, 0xef, 0x15, 0x3d, 0x34, 0x47, 0x39, 0x49, 0x9c, 0x78, 0x28, 0xc7, 0x70, 0xe3, + 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, + 0xf0, 0x48, 0x8e, 0x31, 0x89, 0x0d, 0x6c, 0xb4, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x53, + 0x3d, 0xea, 0x62, 0x01, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/containerd/api/services/version/version.proto b/vendor/github.com/containerd/containerd/api/services/version/version.proto index a2ed79fd7d..277061d762 100644 --- a/vendor/github.com/containerd/containerd/api/services/version/version.proto +++ b/vendor/github.com/containerd/containerd/api/services/version/version.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package containerd.v1; +package containerd.services.version.v1; import "google/protobuf/empty.proto"; import "gogoproto/gogo.proto"; diff --git a/vendor/github.com/containerd/containerd/api/types/event/container.pb.go b/vendor/github.com/containerd/containerd/api/types/event/container.pb.go new file mode 100644 index 0000000000..7fee979805 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/container.pb.go @@ -0,0 +1,1259 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/container.proto +// DO NOT EDIT! + +/* + Package event is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/types/event/container.proto + github.com/containerd/containerd/api/types/event/content.proto + github.com/containerd/containerd/api/types/event/event.proto + github.com/containerd/containerd/api/types/event/image.proto + github.com/containerd/containerd/api/types/event/namespace.proto + github.com/containerd/containerd/api/types/event/runtime.proto + github.com/containerd/containerd/api/types/event/snapshot.proto + github.com/containerd/containerd/api/types/event/task.proto + + It has these top-level messages: + ContainerCreate + ContainerUpdate + ContainerDelete + ContentDelete + Envelope + ImageUpdate + ImageDelete + NamespaceCreate + NamespaceUpdate + NamespaceDelete + RuntimeIO + RuntimeMount + RuntimeCreate + RuntimeEvent + RuntimeDelete + SnapshotPrepare + SnapshotCommit + SnapshotRemove + TaskCreate + TaskStart + TaskDelete +*/ +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type ContainerCreate struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + Runtime *ContainerCreate_Runtime `protobuf:"bytes,3,opt,name=runtime" json:"runtime,omitempty"` +} + +func (m *ContainerCreate) Reset() { *m = ContainerCreate{} } +func (*ContainerCreate) ProtoMessage() {} +func (*ContainerCreate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} } + +type ContainerCreate_Runtime struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Options map[string]string `protobuf:"bytes,2,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *ContainerCreate_Runtime) Reset() { *m = ContainerCreate_Runtime{} } +func (*ContainerCreate_Runtime) ProtoMessage() {} +func (*ContainerCreate_Runtime) Descriptor() ([]byte, []int) { + return fileDescriptorContainer, []int{0, 0} +} + +type ContainerUpdate struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` + Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RootFS string `protobuf:"bytes,4,opt,name=rootfs,proto3" json:"rootfs,omitempty"` +} + +func (m *ContainerUpdate) Reset() { *m = ContainerUpdate{} } +func (*ContainerUpdate) ProtoMessage() {} +func (*ContainerUpdate) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{1} } + +type ContainerDelete struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` +} + +func (m *ContainerDelete) Reset() { *m = ContainerDelete{} } +func (*ContainerDelete) ProtoMessage() {} +func (*ContainerDelete) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} } + +func init() { + proto.RegisterType((*ContainerCreate)(nil), "containerd.v1.types.ContainerCreate") + proto.RegisterType((*ContainerCreate_Runtime)(nil), "containerd.v1.types.ContainerCreate.Runtime") + proto.RegisterType((*ContainerUpdate)(nil), "containerd.v1.types.ContainerUpdate") + proto.RegisterType((*ContainerDelete)(nil), "containerd.v1.types.ContainerDelete") +} +func (m *ContainerCreate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerCreate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.Image) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.Image))) + i += copy(dAtA[i:], m.Image) + } + if m.Runtime != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintContainer(dAtA, i, uint64(m.Runtime.Size())) + n1, err := m.Runtime.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + return i, nil +} + +func (m *ContainerCreate_Runtime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerCreate_Runtime) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Options) > 0 { + for k, _ := range m.Options { + dAtA[i] = 0x12 + i++ + v := m.Options[k] + mapSize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v))) + i = encodeVarintContainer(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *ContainerUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if len(m.Image) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.Image))) + i += copy(dAtA[i:], m.Image) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x1a + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v))) + i = encodeVarintContainer(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + if len(m.RootFS) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.RootFS))) + i += copy(dAtA[i:], m.RootFS) + } + return i, nil +} + +func (m *ContainerDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainer(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + return i, nil +} + +func encodeFixed64Container(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Container(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintContainer(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ContainerCreate) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + l = len(m.Image) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + if m.Runtime != nil { + l = m.Runtime.Size() + n += 1 + l + sovContainer(uint64(l)) + } + return n +} + +func (m *ContainerCreate_Runtime) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + if len(m.Options) > 0 { + for k, v := range m.Options { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v))) + n += mapEntrySize + 1 + sovContainer(uint64(mapEntrySize)) + } + } + return n +} + +func (m *ContainerUpdate) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + l = len(m.Image) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovContainer(uint64(len(k))) + 1 + len(v) + sovContainer(uint64(len(v))) + n += mapEntrySize + 1 + sovContainer(uint64(mapEntrySize)) + } + } + l = len(m.RootFS) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + return n +} + +func (m *ContainerDelete) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovContainer(uint64(l)) + } + return n +} + +func sovContainer(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozContainer(x uint64) (n int) { + return sovContainer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ContainerCreate) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContainerCreate{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `Image:` + fmt.Sprintf("%v", this.Image) + `,`, + `Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "ContainerCreate_Runtime", "ContainerCreate_Runtime", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ContainerCreate_Runtime) String() string { + if this == nil { + return "nil" + } + keysForOptions := make([]string, 0, len(this.Options)) + for k, _ := range this.Options { + keysForOptions = append(keysForOptions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForOptions) + mapStringForOptions := "map[string]string{" + for _, k := range keysForOptions { + mapStringForOptions += fmt.Sprintf("%v: %v,", k, this.Options[k]) + } + mapStringForOptions += "}" + s := strings.Join([]string{`&ContainerCreate_Runtime{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Options:` + mapStringForOptions + `,`, + `}`, + }, "") + return s +} +func (this *ContainerUpdate) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + s := strings.Join([]string{`&ContainerUpdate{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `Image:` + fmt.Sprintf("%v", this.Image) + `,`, + `Labels:` + mapStringForLabels + `,`, + `RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, + `}`, + }, "") + return s +} +func (this *ContainerDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContainerDelete{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `}`, + }, "") + return s +} +func valueToStringContainer(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ContainerCreate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerCreate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerCreate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Image = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Runtime == nil { + m.Runtime = &ContainerCreate_Runtime{} + } + if err := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerCreate_Runtime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Runtime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthContainer + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Options == nil { + m.Options = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthContainer + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Options[mapkey] = mapvalue + } else { + var mapvalue string + m.Options[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Image = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthContainer + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthContainer + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootFS", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RootFS = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContainer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContainer + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContainer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContainer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipContainer(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContainer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContainer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContainer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthContainer + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContainer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipContainer(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthContainer = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowContainer = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/container.proto", fileDescriptorContainer) +} + +var fileDescriptorContainer = []byte{ + // 387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x4f, 0x6b, 0xe2, 0x40, + 0x1c, 0x75, 0x12, 0x37, 0xb2, 0x13, 0xc1, 0x65, 0xd6, 0x43, 0xc8, 0x21, 0x8a, 0x27, 0x0f, 0xcb, + 0x64, 0xd7, 0xbd, 0xac, 0x9e, 0x16, 0xff, 0x51, 0xa1, 0x50, 0x18, 0xe9, 0xb9, 0x44, 0x33, 0x4d, + 0x43, 0x93, 0x4c, 0x48, 0x46, 0xc1, 0x5b, 0x0f, 0xfd, 0x3c, 0xfd, 0x1c, 0x1e, 0x7b, 0xe8, 0xa1, + 0x27, 0xa9, 0xf9, 0x24, 0x25, 0x93, 0x18, 0x43, 0x29, 0x05, 0x4b, 0x6f, 0xbf, 0xc9, 0x7b, 0xef, + 0xf7, 0x7b, 0xef, 0x11, 0xf8, 0xdf, 0x71, 0xf9, 0xcd, 0x6a, 0x81, 0x97, 0xcc, 0x37, 0x97, 0x2c, + 0xe0, 0x96, 0x1b, 0xd0, 0xc8, 0x2e, 0x8f, 0x56, 0xe8, 0x9a, 0x7c, 0x13, 0xd2, 0xd8, 0xa4, 0x6b, + 0x1a, 0xf0, 0x23, 0x84, 0xc3, 0x88, 0x71, 0x86, 0x7e, 0x1e, 0xb9, 0x78, 0xfd, 0x07, 0x0b, 0xaa, + 0xde, 0x74, 0x98, 0xc3, 0x04, 0x6e, 0xa6, 0x53, 0x46, 0xed, 0x3c, 0x49, 0xb0, 0x31, 0x3a, 0xb0, + 0x47, 0x11, 0xb5, 0x38, 0x45, 0x3d, 0x58, 0x2f, 0x16, 0x5c, 0xb9, 0xb6, 0x06, 0xda, 0xa0, 0xfb, + 0x7d, 0xd8, 0x48, 0x76, 0x2d, 0xb5, 0xa0, 0xce, 0xc6, 0x44, 0x2d, 0x48, 0x33, 0x1b, 0x35, 0xe1, + 0x37, 0xd7, 0xb7, 0x1c, 0xaa, 0x49, 0x29, 0x99, 0x64, 0x0f, 0x34, 0x85, 0xb5, 0x68, 0x15, 0x70, + 0xd7, 0xa7, 0x9a, 0xdc, 0x06, 0x5d, 0xb5, 0xf7, 0x0b, 0xbf, 0x63, 0x0d, 0xbf, 0x31, 0x80, 0x49, + 0xa6, 0x21, 0x07, 0xb1, 0xfe, 0x00, 0x60, 0x2d, 0xff, 0x88, 0x10, 0xac, 0x06, 0x96, 0x4f, 0x33, + 0x57, 0x44, 0xcc, 0x68, 0x0e, 0x6b, 0x2c, 0xe4, 0x2e, 0x0b, 0x62, 0x4d, 0x6a, 0xcb, 0x5d, 0xb5, + 0xd7, 0x3f, 0xe5, 0x0e, 0xbe, 0xc8, 0xb4, 0x93, 0x80, 0x47, 0x1b, 0x72, 0xd8, 0xa4, 0x0f, 0x60, + 0xbd, 0x0c, 0xa0, 0x1f, 0x50, 0xbe, 0xa5, 0x9b, 0xfc, 0x6e, 0x3a, 0xa6, 0xa1, 0xd7, 0x96, 0xb7, + 0x2a, 0x42, 0x8b, 0xc7, 0x40, 0xfa, 0x07, 0x3a, 0xf7, 0xe5, 0x5a, 0x2f, 0x43, 0xfb, 0x6b, 0x6b, + 0x3d, 0x83, 0x8a, 0x67, 0x2d, 0xa8, 0x17, 0x6b, 0xb2, 0x48, 0xfb, 0xfb, 0xe3, 0xb4, 0xd9, 0x7d, + 0x7c, 0x2e, 0x24, 0x59, 0xc8, 0x5c, 0x8f, 0x3a, 0x50, 0x89, 0x18, 0xe3, 0xd7, 0xb1, 0x56, 0x15, + 0x6e, 0x60, 0xb2, 0x6b, 0x29, 0x84, 0x31, 0x3e, 0x9d, 0x93, 0x1c, 0xd1, 0xfb, 0x50, 0x2d, 0x49, + 0x4f, 0xaa, 0x61, 0x52, 0x6a, 0x61, 0x4c, 0x3d, 0xfa, 0xb9, 0x16, 0x86, 0xda, 0x76, 0x6f, 0x54, + 0x9e, 0xf7, 0x46, 0xe5, 0x2e, 0x31, 0xc0, 0x36, 0x31, 0xc0, 0x63, 0x62, 0x80, 0x97, 0xc4, 0x00, + 0x0b, 0x45, 0xfc, 0xc5, 0x7f, 0x5f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x47, 0x2f, 0xd1, 0x73, 0x34, + 0x03, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/container.proto b/vendor/github.com/containerd/containerd/api/types/event/container.proto new file mode 100644 index 0000000000..eba13859bc --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/container.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package containerd.v1.types; + +import "gogoproto/gogo.proto"; + +message ContainerCreate { + string container_id = 1; + string image = 2; + message Runtime { + string name = 1; + map options = 2; + } + Runtime runtime = 3; +} + +message ContainerUpdate { + string container_id = 1; + string image = 2; + map labels = 3; + string rootfs = 4 [(gogoproto.customname) = "RootFS"]; +} + +message ContainerDelete { + string container_id = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/content.pb.go b/vendor/github.com/containerd/containerd/api/types/event/content.pb.go new file mode 100644 index 0000000000..570c8a7442 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/content.pb.go @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/content.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import github_com_opencontainers_go_digest "github.com/opencontainers/go-digest" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type ContentDelete struct { + Digest github_com_opencontainers_go_digest.Digest `protobuf:"bytes,1,opt,name=digest,proto3,customtype=github.com/opencontainers/go-digest.Digest" json:"digest"` +} + +func (m *ContentDelete) Reset() { *m = ContentDelete{} } +func (*ContentDelete) ProtoMessage() {} +func (*ContentDelete) Descriptor() ([]byte, []int) { return fileDescriptorContent, []int{0} } + +func init() { + proto.RegisterType((*ContentDelete)(nil), "containerd.v1.types.ContentDelete") +} +func (m *ContentDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContentDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Digest) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContent(dAtA, i, uint64(len(m.Digest))) + i += copy(dAtA[i:], m.Digest) + } + return i, nil +} + +func encodeFixed64Content(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Content(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintContent(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ContentDelete) Size() (n int) { + var l int + _ = l + l = len(m.Digest) + if l > 0 { + n += 1 + l + sovContent(uint64(l)) + } + return n +} + +func sovContent(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozContent(x uint64) (n int) { + return sovContent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ContentDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ContentDelete{`, + `Digest:` + fmt.Sprintf("%v", this.Digest) + `,`, + `}`, + }, "") + return s +} +func valueToStringContent(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ContentDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContentDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContentDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContent + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Digest = github_com_opencontainers_go_digest.Digest(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipContent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthContent + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipContent(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthContent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowContent = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/content.proto", fileDescriptorContent) +} + +var fileDescriptorContent = []byte{ + // 192 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4b, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0x80, 0xa5, 0x52, 0xf3, 0x4a, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x84, 0x11, + 0x2a, 0xf5, 0xca, 0x0c, 0xf5, 0xc0, 0x0a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xf2, 0xfa, + 0x20, 0x16, 0x44, 0xa9, 0x52, 0x34, 0x17, 0xaf, 0x33, 0x44, 0xaf, 0x4b, 0x6a, 0x4e, 0x6a, 0x49, + 0xaa, 0x90, 0x17, 0x17, 0x5b, 0x4a, 0x66, 0x7a, 0x6a, 0x71, 0x89, 0x04, 0xa3, 0x02, 0xa3, 0x06, + 0xa7, 0x93, 0xd1, 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0x6b, 0x21, 0xb9, 0x29, 0xbf, 0x20, + 0x35, 0x0f, 0x6e, 0x45, 0xb1, 0x7e, 0x7a, 0xbe, 0x2e, 0x44, 0x8b, 0x9e, 0x0b, 0x98, 0x0a, 0x82, + 0x9a, 0xe0, 0x24, 0x71, 0xe2, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d, 0x8f, 0xe4, 0x18, + 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x24, 0x36, 0xb0, + 0xed, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x6c, 0x08, 0x88, 0xea, 0x00, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/content.proto b/vendor/github.com/containerd/containerd/api/types/event/content.proto new file mode 100644 index 0000000000..4bb9d6b2b5 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/content.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package containerd.v1.types; + +import "gogoproto/gogo.proto"; + +message ContentDelete { + string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false]; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/event.pb.go b/vendor/github.com/containerd/containerd/api/types/event/event.pb.go new file mode 100644 index 0000000000..30f205490a --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/event.pb.go @@ -0,0 +1,429 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/event.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/gogo/protobuf/types" +import google_protobuf2 "github.com/gogo/protobuf/types" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +type Envelope struct { + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,stdtime" json:"timestamp"` + Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"` + Event *google_protobuf2.Any `protobuf:"bytes,3,opt,name=event" json:"event,omitempty"` +} + +func (m *Envelope) Reset() { *m = Envelope{} } +func (*Envelope) ProtoMessage() {} +func (*Envelope) Descriptor() ([]byte, []int) { return fileDescriptorEvent, []int{0} } + +func init() { + proto.RegisterType((*Envelope)(nil), "containerd.v1.types.Envelope") +} +func (m *Envelope) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintEvent(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) + n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + if len(m.Topic) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintEvent(dAtA, i, uint64(len(m.Topic))) + i += copy(dAtA[i:], m.Topic) + } + if m.Event != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintEvent(dAtA, i, uint64(m.Event.Size())) + n2, err := m.Event.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + return i, nil +} + +func encodeFixed64Event(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Event(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Envelope) Size() (n int) { + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovEvent(uint64(l)) + l = len(m.Topic) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + if m.Event != nil { + l = m.Event.Size() + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Envelope) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Envelope{`, + `Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, + `Topic:` + fmt.Sprintf("%v", this.Topic) + `,`, + `Event:` + strings.Replace(fmt.Sprintf("%v", this.Event), "Any", "google_protobuf2.Any", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringEvent(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Envelope) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Envelope: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Envelope: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topic = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Event == nil { + m.Event = &google_protobuf2.Any{} + } + if err := m.Event.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEvent + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEvent(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/event.proto", fileDescriptorEvent) +} + +var fileDescriptorEvent = []byte{ + // 248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0x40, 0x48, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x61, 0x84, 0x3a, 0xbd, 0x32, + 0x43, 0x3d, 0xb0, 0x32, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0xbc, 0x3e, 0x88, 0x05, 0x51, + 0x2a, 0x25, 0x9f, 0x9e, 0x9f, 0x9f, 0x9e, 0x93, 0xaa, 0x0f, 0xe6, 0x25, 0x95, 0xa6, 0xe9, 0x97, + 0x64, 0xe6, 0xa6, 0x16, 0x97, 0x24, 0xe6, 0x16, 0x40, 0x15, 0x48, 0xa2, 0x2b, 0x48, 0xcc, 0xab, + 0x84, 0x48, 0x29, 0x4d, 0x60, 0xe4, 0xe2, 0x70, 0xcd, 0x2b, 0x4b, 0xcd, 0xc9, 0x2f, 0x48, 0x15, + 0x72, 0xe2, 0xe2, 0x84, 0x6b, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0x83, 0xe8, + 0xd5, 0x83, 0xe9, 0xd5, 0x0b, 0x81, 0xa9, 0x70, 0xe2, 0x38, 0x71, 0x4f, 0x9e, 0x61, 0xc2, 0x7d, + 0x79, 0xc6, 0x20, 0x84, 0x36, 0x21, 0x11, 0x2e, 0xd6, 0x92, 0xfc, 0x82, 0xcc, 0x64, 0x09, 0x26, + 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x47, 0x48, 0x8b, 0x8b, 0x15, 0xec, 0x39, 0x09, 0x66, 0xb0, + 0xa9, 0x22, 0x18, 0xa6, 0x3a, 0xe6, 0x55, 0x06, 0x41, 0x94, 0x38, 0x49, 0x9c, 0x78, 0x28, 0xc7, + 0x70, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x89, 0x0d, 0xac, 0xdc, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0xb7, 0xff, 0x84, 0x18, 0x5a, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/event.proto b/vendor/github.com/containerd/containerd/api/types/event/event.proto new file mode 100644 index 0000000000..51e509a045 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/event.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package containerd.v1.types; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; + +message Envelope { + google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + string topic = 2; + google.protobuf.Any event = 3; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/image.pb.go b/vendor/github.com/containerd/containerd/api/types/event/image.pb.go new file mode 100644 index 0000000000..25dec7bf35 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/image.pb.go @@ -0,0 +1,615 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/image.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type ImageUpdate struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *ImageUpdate) Reset() { *m = ImageUpdate{} } +func (*ImageUpdate) ProtoMessage() {} +func (*ImageUpdate) Descriptor() ([]byte, []int) { return fileDescriptorImage, []int{0} } + +type ImageDelete struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *ImageDelete) Reset() { *m = ImageDelete{} } +func (*ImageDelete) ProtoMessage() {} +func (*ImageDelete) Descriptor() ([]byte, []int) { return fileDescriptorImage, []int{1} } + +func init() { + proto.RegisterType((*ImageUpdate)(nil), "containerd.v1.types.ImageUpdate") + proto.RegisterType((*ImageDelete)(nil), "containerd.v1.types.ImageDelete") +} +func (m *ImageUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageUpdate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintImage(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovImage(uint64(len(k))) + 1 + len(v) + sovImage(uint64(len(v))) + i = encodeVarintImage(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintImage(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintImage(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *ImageDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintImage(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + return i, nil +} + +func encodeFixed64Image(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Image(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintImage(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ImageUpdate) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovImage(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovImage(uint64(len(k))) + 1 + len(v) + sovImage(uint64(len(v))) + n += mapEntrySize + 1 + sovImage(uint64(mapEntrySize)) + } + } + return n +} + +func (m *ImageDelete) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovImage(uint64(l)) + } + return n +} + +func sovImage(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozImage(x uint64) (n int) { + return sovImage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ImageUpdate) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + s := strings.Join([]string{`&ImageUpdate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Labels:` + mapStringForLabels + `,`, + `}`, + }, "") + return s +} +func (this *ImageDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ImageDelete{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func valueToStringImage(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ImageUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthImage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthImage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthImage + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthImage + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipImage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthImage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowImage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthImage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipImage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthImage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipImage(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowImage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowImage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowImage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthImage + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowImage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipImage(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthImage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowImage = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/image.proto", fileDescriptorImage) +} + +var fileDescriptorImage = []byte{ + // 232 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0xe8, 0x67, 0xe6, 0x26, 0xa6, 0xa7, 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, + 0x23, 0xd4, 0xe9, 0x95, 0x19, 0xea, 0x81, 0x95, 0x29, 0x2d, 0x62, 0xe4, 0xe2, 0xf6, 0x04, 0x29, + 0x0a, 0x2d, 0x48, 0x49, 0x2c, 0x49, 0x15, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, + 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x5c, 0xb8, 0xd8, 0x72, 0x12, 0x93, 0x52, 0x73, + 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x74, 0xf4, 0xb0, 0x98, 0xa4, 0x87, 0x64, 0x8a, + 0x9e, 0x0f, 0x58, 0xb9, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x54, 0xaf, 0x94, 0x25, 0x17, 0x37, + 0x92, 0xb0, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, 0xd4, 0x1e, 0x10, 0x53, 0x48, 0x84, 0x8b, + 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, 0x06, 0xe1, 0x58, 0x31, 0x59, 0x30, 0x2a, + 0x29, 0x42, 0xdd, 0xe8, 0x92, 0x9a, 0x93, 0x8a, 0xdd, 0x8d, 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, 0x4c, 0x62, 0x03, 0xfb, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0xa7, 0x64, 0x49, 0x13, 0x3d, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/image.proto b/vendor/github.com/containerd/containerd/api/types/event/image.proto new file mode 100644 index 0000000000..5df9e595a0 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/image.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package containerd.v1.types; + +message ImageUpdate { + string name = 1; + map labels = 2; +} + +message ImageDelete { + string name = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/namespace.pb.go b/vendor/github.com/containerd/containerd/api/types/event/namespace.pb.go new file mode 100644 index 0000000000..dd1625e410 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/namespace.pb.go @@ -0,0 +1,901 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/namespace.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" +import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type NamespaceCreate struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *NamespaceCreate) Reset() { *m = NamespaceCreate{} } +func (*NamespaceCreate) ProtoMessage() {} +func (*NamespaceCreate) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{0} } + +type NamespaceUpdate struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *NamespaceUpdate) Reset() { *m = NamespaceUpdate{} } +func (*NamespaceUpdate) ProtoMessage() {} +func (*NamespaceUpdate) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{1} } + +type NamespaceDelete struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *NamespaceDelete) Reset() { *m = NamespaceDelete{} } +func (*NamespaceDelete) ProtoMessage() {} +func (*NamespaceDelete) Descriptor() ([]byte, []int) { return fileDescriptorNamespace, []int{2} } + +func init() { + proto.RegisterType((*NamespaceCreate)(nil), "containerd.v1.types.NamespaceCreate") + proto.RegisterType((*NamespaceUpdate)(nil), "containerd.v1.types.NamespaceUpdate") + proto.RegisterType((*NamespaceDelete)(nil), "containerd.v1.types.NamespaceDelete") +} +func (m *NamespaceCreate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NamespaceCreate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *NamespaceUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NamespaceUpdate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[k] + mapSize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + i = encodeVarintNamespace(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + return i, nil +} + +func (m *NamespaceDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NamespaceDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintNamespace(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + return i, nil +} + +func encodeFixed64Namespace(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Namespace(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintNamespace(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *NamespaceCreate) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + n += mapEntrySize + 1 + sovNamespace(uint64(mapEntrySize)) + } + } + return n +} + +func (m *NamespaceUpdate) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovNamespace(uint64(len(k))) + 1 + len(v) + sovNamespace(uint64(len(v))) + n += mapEntrySize + 1 + sovNamespace(uint64(mapEntrySize)) + } + } + return n +} + +func (m *NamespaceDelete) Size() (n int) { + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNamespace(uint64(l)) + } + return n +} + +func sovNamespace(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozNamespace(x uint64) (n int) { + return sovNamespace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *NamespaceCreate) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + s := strings.Join([]string{`&NamespaceCreate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Labels:` + mapStringForLabels + `,`, + `}`, + }, "") + return s +} +func (this *NamespaceUpdate) String() string { + if this == nil { + return "nil" + } + keysForLabels := make([]string, 0, len(this.Labels)) + for k, _ := range this.Labels { + keysForLabels = append(keysForLabels, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForLabels) + mapStringForLabels := "map[string]string{" + for _, k := range keysForLabels { + mapStringForLabels += fmt.Sprintf("%v: %v,", k, this.Labels[k]) + } + mapStringForLabels += "}" + s := strings.Join([]string{`&NamespaceUpdate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Labels:` + mapStringForLabels + `,`, + `}`, + }, "") + return s +} +func (this *NamespaceDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NamespaceDelete{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func valueToStringNamespace(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *NamespaceCreate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NamespaceCreate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NamespaceCreate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NamespaceUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NamespaceUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NamespaceUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var keykey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + keykey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + if m.Labels == nil { + m.Labels = make(map[string]string) + } + if iNdEx < postIndex { + var valuekey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + valuekey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthNamespace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + m.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NamespaceDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NamespaceDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NamespaceDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNamespace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNamespace + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNamespace(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthNamespace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNamespace(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthNamespace + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowNamespace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipNamespace(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthNamespace = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNamespace = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/namespace.proto", fileDescriptorNamespace) +} + +var fileDescriptorNamespace = []byte{ + // 247 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, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0xe8, 0xe7, 0x25, 0xe6, 0xa6, 0x16, 0x17, 0x24, 0x26, 0xa7, 0xea, 0x15, 0x14, 0xe5, + 0x97, 0xe4, 0x0b, 0x09, 0x23, 0xd4, 0xea, 0x95, 0x19, 0xea, 0x81, 0x95, 0x2a, 0xad, 0x62, 0xe4, + 0xe2, 0xf7, 0x83, 0x29, 0x74, 0x2e, 0x4a, 0x4d, 0x2c, 0x49, 0x15, 0x12, 0xe2, 0x62, 0x01, 0xe9, + 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x3c, 0xb8, 0xd8, 0x72, 0x12, 0x93, + 0x52, 0x73, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x0c, 0xf4, 0xb0, 0x98, 0xa6, 0x87, + 0x66, 0x92, 0x9e, 0x0f, 0x58, 0x8b, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x54, 0xbf, 0x94, 0x25, + 0x17, 0x37, 0x92, 0xb0, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, 0xd4, 0x2e, 0x10, 0x53, 0x48, + 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7, 0x34, 0x55, 0x82, 0x09, 0x2c, 0x06, 0xe1, 0x58, 0x31, 0x59, + 0x30, 0xa2, 0x3a, 0x36, 0xb4, 0x20, 0x85, 0x4a, 0x8e, 0x85, 0x98, 0x44, 0x6d, 0xc7, 0xaa, 0x22, + 0xb9, 0xd5, 0x25, 0x35, 0x27, 0x15, 0xbb, 0x5b, 0x9d, 0x24, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, + 0x50, 0x8e, 0xa1, 0xe1, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x98, 0xc4, 0x06, 0x8e, 0x36, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, + 0xab, 0x9e, 0xdf, 0xfa, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/namespace.proto b/vendor/github.com/containerd/containerd/api/types/event/namespace.proto new file mode 100644 index 0000000000..56eb73b6a3 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/namespace.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package containerd.v1.types; + +message NamespaceCreate { + string name = 1; + map labels = 2; +} + +message NamespaceUpdate { + string name = 1; + map labels = 2; +} + +message NamespaceDelete { + string name = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/runtime.pb.go b/vendor/github.com/containerd/containerd/api/types/event/runtime.pb.go new file mode 100644 index 0000000000..6f86a2e6b5 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/runtime.pb.go @@ -0,0 +1,1516 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/runtime.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import _ "github.com/gogo/protobuf/types" +import containerd_v1_types "github.com/containerd/containerd/api/types/task" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +type RuntimeIO struct { + Stdin string `protobuf:"bytes,1,opt,name=stdin,proto3" json:"stdin,omitempty"` + Stdout string `protobuf:"bytes,2,opt,name=stdout,proto3" json:"stdout,omitempty"` + Stderr string `protobuf:"bytes,3,opt,name=stderr,proto3" json:"stderr,omitempty"` + Terminal bool `protobuf:"varint,4,opt,name=terminal,proto3" json:"terminal,omitempty"` +} + +func (m *RuntimeIO) Reset() { *m = RuntimeIO{} } +func (*RuntimeIO) ProtoMessage() {} +func (*RuntimeIO) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{0} } + +type RuntimeMount struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` + Options []string `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` +} + +func (m *RuntimeMount) Reset() { *m = RuntimeMount{} } +func (*RuntimeMount) ProtoMessage() {} +func (*RuntimeMount) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{1} } + +type RuntimeCreate struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"` + RootFS []*RuntimeMount `protobuf:"bytes,3,rep,name=rootfs" json:"rootfs,omitempty"` + IO *RuntimeIO `protobuf:"bytes,4,opt,name=io" json:"io,omitempty"` + Checkpoint string `protobuf:"bytes,5,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` +} + +func (m *RuntimeCreate) Reset() { *m = RuntimeCreate{} } +func (*RuntimeCreate) ProtoMessage() {} +func (*RuntimeCreate) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{2} } + +type RuntimeEvent struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type containerd_v1_types.Event_EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.v1.types.Event_EventType" json:"type,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` +} + +func (m *RuntimeEvent) Reset() { *m = RuntimeEvent{} } +func (*RuntimeEvent) ProtoMessage() {} +func (*RuntimeEvent) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{3} } + +type RuntimeDelete struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Runtime string `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime,omitempty"` + ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,4,opt,name=exited_at,json=exitedAt,stdtime" json:"exited_at"` +} + +func (m *RuntimeDelete) Reset() { *m = RuntimeDelete{} } +func (*RuntimeDelete) ProtoMessage() {} +func (*RuntimeDelete) Descriptor() ([]byte, []int) { return fileDescriptorRuntime, []int{4} } + +func init() { + proto.RegisterType((*RuntimeIO)(nil), "containerd.v1.types.RuntimeIO") + proto.RegisterType((*RuntimeMount)(nil), "containerd.v1.types.RuntimeMount") + proto.RegisterType((*RuntimeCreate)(nil), "containerd.v1.types.RuntimeCreate") + proto.RegisterType((*RuntimeEvent)(nil), "containerd.v1.types.RuntimeEvent") + proto.RegisterType((*RuntimeDelete)(nil), "containerd.v1.types.RuntimeDelete") +} +func (m *RuntimeIO) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeIO) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Stdin) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Stdin))) + i += copy(dAtA[i:], m.Stdin) + } + if len(m.Stdout) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Stdout))) + i += copy(dAtA[i:], m.Stdout) + } + if len(m.Stderr) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Stderr))) + i += copy(dAtA[i:], m.Stderr) + } + if m.Terminal { + dAtA[i] = 0x20 + i++ + if m.Terminal { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *RuntimeMount) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeMount) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Type) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Type))) + i += copy(dAtA[i:], m.Type) + } + if len(m.Source) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Source))) + i += copy(dAtA[i:], m.Source) + } + if len(m.Options) > 0 { + for _, s := range m.Options { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *RuntimeCreate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeCreate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Bundle) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Bundle))) + i += copy(dAtA[i:], m.Bundle) + } + if len(m.RootFS) > 0 { + for _, msg := range m.RootFS { + dAtA[i] = 0x1a + i++ + i = encodeVarintRuntime(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.IO != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(m.IO.Size())) + n1, err := m.IO.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.Checkpoint) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Checkpoint))) + i += copy(dAtA[i:], m.Checkpoint) + } + return i, nil +} + +func (m *RuntimeEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeEvent) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.Type != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(m.Type)) + } + if m.Pid != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(m.Pid)) + } + if m.ExitStatus != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(m.ExitStatus)) + } + dAtA[i] = 0x2a + i++ + i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) + n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *RuntimeDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RuntimeDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Runtime) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(len(m.Runtime))) + i += copy(dAtA[i:], m.Runtime) + } + if m.ExitStatus != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(m.ExitStatus)) + } + dAtA[i] = 0x22 + i++ + i = encodeVarintRuntime(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) + n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + +func encodeFixed64Runtime(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Runtime(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintRuntime(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *RuntimeIO) Size() (n int) { + var l int + _ = l + l = len(m.Stdin) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Stdout) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Stderr) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + if m.Terminal { + n += 2 + } + return n +} + +func (m *RuntimeMount) Size() (n int) { + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + if len(m.Options) > 0 { + for _, s := range m.Options { + l = len(s) + n += 1 + l + sovRuntime(uint64(l)) + } + } + return n +} + +func (m *RuntimeCreate) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Bundle) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + if len(m.RootFS) > 0 { + for _, e := range m.RootFS { + l = e.Size() + n += 1 + l + sovRuntime(uint64(l)) + } + } + if m.IO != nil { + l = m.IO.Size() + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Checkpoint) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + return n +} + +func (m *RuntimeEvent) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + if m.Type != 0 { + n += 1 + sovRuntime(uint64(m.Type)) + } + if m.Pid != 0 { + n += 1 + sovRuntime(uint64(m.Pid)) + } + if m.ExitStatus != 0 { + n += 1 + sovRuntime(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovRuntime(uint64(l)) + return n +} + +func (m *RuntimeDelete) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + l = len(m.Runtime) + if l > 0 { + n += 1 + l + sovRuntime(uint64(l)) + } + if m.ExitStatus != 0 { + n += 1 + sovRuntime(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovRuntime(uint64(l)) + return n +} + +func sovRuntime(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRuntime(x uint64) (n int) { + return sovRuntime(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *RuntimeIO) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuntimeIO{`, + `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, + `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, + `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, + `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, + `}`, + }, "") + return s +} +func (this *RuntimeMount) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuntimeMount{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Source:` + fmt.Sprintf("%v", this.Source) + `,`, + `Options:` + fmt.Sprintf("%v", this.Options) + `,`, + `}`, + }, "") + return s +} +func (this *RuntimeCreate) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuntimeCreate{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`, + `RootFS:` + strings.Replace(fmt.Sprintf("%v", this.RootFS), "RuntimeMount", "RuntimeMount", 1) + `,`, + `IO:` + strings.Replace(fmt.Sprintf("%v", this.IO), "RuntimeIO", "RuntimeIO", 1) + `,`, + `Checkpoint:` + fmt.Sprintf("%v", this.Checkpoint) + `,`, + `}`, + }, "") + return s +} +func (this *RuntimeEvent) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuntimeEvent{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *RuntimeDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuntimeDelete{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf1.Timestamp", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringRuntime(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *RuntimeIO) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeIO: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeIO: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stdout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stdout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stderr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Stderr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Terminal = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRuntime(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRuntime + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeMount) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeMount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeMount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRuntime(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRuntime + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeCreate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeCreate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeCreate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundle", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundle = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootFS", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RootFS = append(m.RootFS, &RuntimeMount{}) + if err := m.RootFS[len(m.RootFS)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IO", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IO == nil { + m.IO = &RuntimeIO{} + } + if err := m.IO.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checkpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Checkpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRuntime(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRuntime + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeEvent) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= (containerd_v1_types.Event_EventType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRuntime(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRuntime + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RuntimeDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RuntimeDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuntimeDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Runtime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRuntime + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRuntime + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRuntime(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRuntime + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRuntime(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRuntime + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRuntime + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRuntime + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthRuntime + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRuntime + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipRuntime(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthRuntime = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRuntime = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/runtime.proto", fileDescriptorRuntime) +} + +var fileDescriptorRuntime = []byte{ + // 523 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0xad, 0x9d, 0x34, 0x4d, 0x26, 0x04, 0xa1, 0xa1, 0x42, 0x56, 0x16, 0x76, 0x88, 0x58, 0x64, + 0x65, 0x8b, 0x20, 0x21, 0xc4, 0x02, 0xa9, 0xa1, 0x45, 0xca, 0x02, 0x45, 0x9a, 0x66, 0x5f, 0x39, + 0xf1, 0x34, 0x1d, 0x35, 0xf1, 0xb5, 0xc6, 0xd7, 0x15, 0xdd, 0xf1, 0x09, 0xfc, 0x04, 0xff, 0x92, + 0x25, 0x2b, 0xc4, 0x2a, 0x50, 0x7f, 0x09, 0x9a, 0x47, 0xdc, 0x08, 0x95, 0x48, 0xb0, 0x19, 0xdd, + 0x73, 0x7c, 0xe7, 0xcc, 0xb9, 0x0f, 0x93, 0x77, 0x0b, 0x81, 0x57, 0xc5, 0x2c, 0x9c, 0xc3, 0x2a, + 0x9a, 0x43, 0x8a, 0xb1, 0x48, 0xb9, 0x4c, 0x76, 0xc3, 0x38, 0x13, 0x11, 0xde, 0x66, 0x3c, 0x8f, + 0xf8, 0x0d, 0x4f, 0x31, 0x92, 0x45, 0x8a, 0x62, 0xc5, 0xc3, 0x4c, 0x02, 0x02, 0x7d, 0x7a, 0x9f, + 0x19, 0xde, 0xbc, 0x0c, 0x75, 0x62, 0xf7, 0x78, 0x01, 0x0b, 0xd0, 0xdf, 0x23, 0x15, 0x99, 0xd4, + 0x6e, 0xb0, 0x00, 0x58, 0x2c, 0x79, 0xa4, 0xd1, 0xac, 0xb8, 0x8c, 0x94, 0x4c, 0x8e, 0xf1, 0x2a, + 0xb3, 0x09, 0x6f, 0xff, 0xc1, 0x0b, 0xc6, 0xf9, 0xb5, 0x3e, 0xcc, 0xdd, 0xfe, 0x8a, 0xb4, 0x98, + 0x31, 0x36, 0x9e, 0xd0, 0x63, 0x72, 0x98, 0x63, 0x22, 0x52, 0xcf, 0xe9, 0x39, 0x83, 0x16, 0x33, + 0x80, 0x3e, 0x23, 0x8d, 0x1c, 0x13, 0x28, 0xd0, 0x73, 0x35, 0x6d, 0x91, 0xe5, 0xb9, 0x94, 0x5e, + 0xad, 0xe2, 0xb9, 0x94, 0xb4, 0x4b, 0x9a, 0xc8, 0xe5, 0x4a, 0xa4, 0xf1, 0xd2, 0xab, 0xf7, 0x9c, + 0x41, 0x93, 0x55, 0xb8, 0x3f, 0x25, 0x8f, 0xec, 0x73, 0x1f, 0xa1, 0x48, 0x91, 0x52, 0x52, 0x57, + 0xbe, 0xec, 0x83, 0x3a, 0xd6, 0xba, 0x50, 0xc8, 0x39, 0xaf, 0xde, 0xd3, 0x88, 0x7a, 0xe4, 0x08, + 0x32, 0x14, 0x90, 0xe6, 0x5e, 0xad, 0x57, 0x1b, 0xb4, 0xd8, 0x16, 0xf6, 0x37, 0x0e, 0xe9, 0x58, + 0xd9, 0xf7, 0x92, 0xc7, 0xa8, 0x34, 0x5c, 0x91, 0x18, 0xd5, 0x51, 0xa3, 0xdc, 0x04, 0xee, 0xf8, + 0x94, 0xb9, 0x22, 0x51, 0xda, 0xb3, 0x22, 0x4d, 0x96, 0x95, 0xb6, 0x41, 0xf4, 0x8c, 0x34, 0x24, + 0x00, 0x5e, 0x1a, 0xe9, 0xf6, 0xf0, 0x79, 0xf8, 0xc0, 0x7c, 0xc2, 0x5d, 0xeb, 0x23, 0x52, 0x6e, + 0x82, 0x06, 0x03, 0xc0, 0x0f, 0xe7, 0xcc, 0x5e, 0xa6, 0xaf, 0x89, 0x2b, 0x40, 0x17, 0xdd, 0x1e, + 0xfa, 0xfb, 0x24, 0xc6, 0x13, 0x6b, 0x6b, 0xc2, 0x5c, 0x01, 0xd4, 0x27, 0x64, 0x7e, 0xc5, 0xe7, + 0xd7, 0x19, 0x88, 0x14, 0xbd, 0x43, 0x6d, 0x6d, 0x87, 0xe9, 0x7f, 0x77, 0xaa, 0xbe, 0x9d, 0xa9, + 0x65, 0xfa, 0x6b, 0x7d, 0x6f, 0x6c, 0x3f, 0x55, 0x75, 0x8f, 0x87, 0x2f, 0x1e, 0xb4, 0xa0, 0x15, + 0xcc, 0x39, 0xbd, 0xcd, 0xb8, 0xed, 0xfa, 0x13, 0x52, 0xcb, 0x44, 0xa2, 0x47, 0xd9, 0x61, 0x2a, + 0xa4, 0x01, 0x69, 0xf3, 0x4f, 0x02, 0x2f, 0x72, 0x8c, 0xb1, 0xc8, 0x75, 0x55, 0x1d, 0x46, 0x14, + 0x75, 0xae, 0x19, 0x7a, 0x42, 0x5a, 0x0a, 0xf1, 0xe4, 0x22, 0x36, 0xa6, 0xdb, 0xc3, 0x6e, 0x68, + 0x96, 0x35, 0xdc, 0x2e, 0x6b, 0x38, 0xdd, 0x2e, 0xeb, 0xa8, 0xb9, 0xde, 0x04, 0x07, 0x5f, 0x7e, + 0x06, 0x0e, 0x6b, 0x9a, 0x6b, 0x27, 0xd8, 0xff, 0x7a, 0x3f, 0xb9, 0x53, 0xbe, 0xe4, 0x7b, 0x26, + 0xe7, 0x91, 0x23, 0xfb, 0x07, 0xd9, 0xd1, 0x6d, 0xe1, 0x9f, 0x3e, 0x6b, 0xfb, 0x7d, 0xd6, 0xff, + 0xc7, 0xe7, 0xc8, 0x5b, 0xdf, 0xf9, 0x07, 0x3f, 0xee, 0xfc, 0x83, 0xcf, 0xa5, 0xef, 0xac, 0x4b, + 0xdf, 0xf9, 0x56, 0xfa, 0xce, 0xaf, 0xd2, 0x77, 0x66, 0x0d, 0xad, 0xf0, 0xea, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xdd, 0x0e, 0xff, 0x3e, 0x11, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/runtime.proto b/vendor/github.com/containerd/containerd/api/types/event/runtime.proto new file mode 100644 index 0000000000..42f475a73e --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/runtime.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; + +package containerd.v1.types; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "github.com/containerd/containerd/api/types/task/task.proto"; + +message RuntimeIO { + string stdin = 1; + string stdout = 2; + string stderr = 3; + bool terminal = 4; +} + +message RuntimeMount { + string type = 1; + string source = 2; + repeated string options = 3; +} + +message RuntimeCreate { + string id = 1; + string bundle = 2; + repeated RuntimeMount rootfs = 3 [(gogoproto.customname) = "RootFS"]; + RuntimeIO io = 4 [(gogoproto.customname) = "IO"]; + string checkpoint = 5; +} + +message RuntimeEvent { + string id = 1; + containerd.v1.types.Event.EventType type = 2; + uint32 pid = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + +message RuntimeDelete { + string id = 1; + string runtime = 2; + uint32 exit_status = 3; + google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/snapshot.pb.go b/vendor/github.com/containerd/containerd/api/types/event/snapshot.pb.go new file mode 100644 index 0000000000..e429d27ca2 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/snapshot.pb.go @@ -0,0 +1,673 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/snapshot.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type SnapshotPrepare struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Parent string `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` +} + +func (m *SnapshotPrepare) Reset() { *m = SnapshotPrepare{} } +func (*SnapshotPrepare) ProtoMessage() {} +func (*SnapshotPrepare) Descriptor() ([]byte, []int) { return fileDescriptorSnapshot, []int{0} } + +type SnapshotCommit struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (m *SnapshotCommit) Reset() { *m = SnapshotCommit{} } +func (*SnapshotCommit) ProtoMessage() {} +func (*SnapshotCommit) Descriptor() ([]byte, []int) { return fileDescriptorSnapshot, []int{1} } + +type SnapshotRemove struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (m *SnapshotRemove) Reset() { *m = SnapshotRemove{} } +func (*SnapshotRemove) ProtoMessage() {} +func (*SnapshotRemove) Descriptor() ([]byte, []int) { return fileDescriptorSnapshot, []int{2} } + +func init() { + proto.RegisterType((*SnapshotPrepare)(nil), "containerd.v1.types.SnapshotPrepare") + proto.RegisterType((*SnapshotCommit)(nil), "containerd.v1.types.SnapshotCommit") + proto.RegisterType((*SnapshotRemove)(nil), "containerd.v1.types.SnapshotRemove") +} +func (m *SnapshotPrepare) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotPrepare) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Parent) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Parent))) + i += copy(dAtA[i:], m.Parent) + } + return i, nil +} + +func (m *SnapshotCommit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotCommit) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Name) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + return i, nil +} + +func (m *SnapshotRemove) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SnapshotRemove) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintSnapshot(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + return i, nil +} + +func encodeFixed64Snapshot(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Snapshot(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintSnapshot(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *SnapshotPrepare) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshot(uint64(l)) + } + l = len(m.Parent) + if l > 0 { + n += 1 + l + sovSnapshot(uint64(l)) + } + return n +} + +func (m *SnapshotCommit) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshot(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovSnapshot(uint64(l)) + } + return n +} + +func (m *SnapshotRemove) Size() (n int) { + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovSnapshot(uint64(l)) + } + return n +} + +func sovSnapshot(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozSnapshot(x uint64) (n int) { + return sovSnapshot(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *SnapshotPrepare) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SnapshotPrepare{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Parent:` + fmt.Sprintf("%v", this.Parent) + `,`, + `}`, + }, "") + return s +} +func (this *SnapshotCommit) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SnapshotCommit{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *SnapshotRemove) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SnapshotRemove{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func valueToStringSnapshot(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *SnapshotPrepare) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotPrepare: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotPrepare: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshot + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Parent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshot + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Parent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshot(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotCommit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotCommit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotCommit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshot + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshot + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshot(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SnapshotRemove) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SnapshotRemove: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SnapshotRemove: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSnapshot + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSnapshot + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSnapshot(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSnapshot + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSnapshot(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshot + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshot + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshot + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthSnapshot + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSnapshot + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipSnapshot(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthSnapshot = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSnapshot = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/snapshot.proto", fileDescriptorSnapshot) +} + +var fileDescriptorSnapshot = []byte{ + // 201 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4f, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0xe8, 0x17, 0xe7, 0x25, 0x16, 0x14, 0x67, 0xe4, 0x97, 0xe8, 0x15, 0x14, 0xe5, 0x97, + 0xe4, 0x0b, 0x09, 0x23, 0x94, 0xea, 0x95, 0x19, 0xea, 0x81, 0x55, 0x2a, 0x59, 0x73, 0xf1, 0x07, + 0x43, 0x95, 0x05, 0x14, 0xa5, 0x16, 0x24, 0x16, 0xa5, 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, + 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81, 0x98, 0x42, 0x62, 0x5c, 0x6c, 0x20, 0x99, 0xbc, + 0x12, 0x09, 0x26, 0xb0, 0x20, 0x94, 0xa7, 0x64, 0xc6, 0xc5, 0x07, 0xd3, 0xec, 0x9c, 0x9f, 0x9b, + 0x9b, 0x59, 0x82, 0x45, 0xaf, 0x10, 0x17, 0x4b, 0x5e, 0x62, 0x6e, 0x2a, 0x54, 0x27, 0x98, 0xad, + 0xa4, 0x84, 0xd0, 0x17, 0x94, 0x9a, 0x9b, 0x5f, 0x86, 0xc5, 0x4e, 0x27, 0x89, 0x13, 0x0f, 0xe5, + 0x18, 0x6e, 0x3c, 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, + 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x26, 0xb1, 0x81, 0xbd, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x5e, 0xad, 0x28, 0x20, 0x11, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/snapshot.proto b/vendor/github.com/containerd/containerd/api/types/event/snapshot.proto new file mode 100644 index 0000000000..447bd9ce7b --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/snapshot.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package containerd.v1.types; + +message SnapshotPrepare { + string key = 1; + string parent = 2; +} + +message SnapshotCommit { + string key = 1; + string name = 2; +} + +message SnapshotRemove { + string key = 1; +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/task.pb.go b/vendor/github.com/containerd/containerd/api/types/event/task.pb.go new file mode 100644 index 0000000000..e1d57c9475 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/task.pb.go @@ -0,0 +1,651 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/event/task.proto +// DO NOT EDIT! + +package event + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +type TaskCreate struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` +} + +func (m *TaskCreate) Reset() { *m = TaskCreate{} } +func (*TaskCreate) ProtoMessage() {} +func (*TaskCreate) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } + +type TaskStart struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` +} + +func (m *TaskStart) Reset() { *m = TaskStart{} } +func (*TaskStart) ProtoMessage() {} +func (*TaskStart) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{1} } + +type TaskDelete struct { + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + ExitStatus uint32 `protobuf:"varint,3,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` +} + +func (m *TaskDelete) Reset() { *m = TaskDelete{} } +func (*TaskDelete) ProtoMessage() {} +func (*TaskDelete) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} } + +func init() { + proto.RegisterType((*TaskCreate)(nil), "containerd.v1.types.TaskCreate") + proto.RegisterType((*TaskStart)(nil), "containerd.v1.types.TaskStart") + proto.RegisterType((*TaskDelete)(nil), "containerd.v1.types.TaskDelete") +} +func (m *TaskCreate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskCreate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + return i, nil +} + +func (m *TaskStart) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskStart) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + return i, nil +} + +func (m *TaskDelete) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TaskDelete) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ContainerID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + if m.Pid != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintTask(dAtA, i, uint64(m.Pid)) + } + if m.ExitStatus != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) + } + return i, nil +} + +func encodeFixed64Task(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Task(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintTask(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *TaskCreate) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + return n +} + +func (m *TaskStart) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + return n +} + +func (m *TaskDelete) Size() (n int) { + var l int + _ = l + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovTask(uint64(m.Pid)) + } + if m.ExitStatus != 0 { + n += 1 + sovTask(uint64(m.ExitStatus)) + } + return n +} + +func sovTask(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozTask(x uint64) (n int) { + return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *TaskCreate) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TaskCreate{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `}`, + }, "") + return s +} +func (this *TaskStart) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TaskStart{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `}`, + }, "") + return s +} +func (this *TaskDelete) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TaskDelete{`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `}`, + }, "") + return s +} +func valueToStringTask(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *TaskCreate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskCreate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskCreate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTask(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTask + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TaskStart) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskStart: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskStart: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTask(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTask + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TaskDelete) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TaskDelete: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskDelete: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTask + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTask + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTask(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTask + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTask(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthTask + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTask + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTask(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTask = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTask = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/event/task.proto", fileDescriptorTask) +} + +var fileDescriptorTask = []byte{ + // 228 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x4e, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xa7, 0x96, 0xa5, + 0xe6, 0x95, 0xe8, 0x97, 0x24, 0x16, 0x67, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x23, + 0x94, 0xe9, 0x95, 0x19, 0xea, 0x81, 0x55, 0x29, 0x39, 0x70, 0x71, 0x85, 0x24, 0x16, 0x67, 0x3b, + 0x17, 0xa5, 0x26, 0x96, 0xa4, 0x0a, 0x19, 0x71, 0xf1, 0xc0, 0x15, 0xc5, 0x67, 0xa6, 0x48, 0x30, + 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0xf1, 0x3f, 0xba, 0x27, 0xcf, 0xed, 0x0c, 0x13, 0xf7, 0x74, 0x09, + 0xe2, 0x86, 0x2b, 0xf2, 0x4c, 0x51, 0xb2, 0xe7, 0xe2, 0x04, 0x99, 0x10, 0x5c, 0x92, 0x58, 0x54, + 0x42, 0x96, 0x01, 0xc5, 0x10, 0x27, 0xb8, 0xa4, 0xe6, 0xa4, 0x92, 0xe7, 0x04, 0x21, 0x01, 0x2e, + 0xe6, 0x82, 0xcc, 0x14, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x10, 0x53, 0x48, 0x9e, 0x8b, + 0x3b, 0xb5, 0x22, 0xb3, 0x24, 0xbe, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x58, 0x82, 0x19, 0x2c, 0xc3, + 0x05, 0x12, 0x0a, 0x06, 0x8b, 0x38, 0x49, 0x9c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0x43, + 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, + 0x31, 0x89, 0x0d, 0x1c, 0x5a, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x43, 0xc1, 0x0e, + 0x6c, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/containerd/api/types/event/task.proto b/vendor/github.com/containerd/containerd/api/types/event/task.proto new file mode 100644 index 0000000000..78cfeff292 --- /dev/null +++ b/vendor/github.com/containerd/containerd/api/types/event/task.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package containerd.v1.types; + +message TaskCreate { + string container_id = 1; +} + +message TaskStart { + string container_id = 1; +} + +message TaskDelete { + string container_id = 1; + uint32 pid = 2; + uint32 exit_status = 3; +} diff --git a/vendor/github.com/containerd/containerd/client.go b/vendor/github.com/containerd/containerd/client.go index 6036eab2a1..1a32cbebce 100644 --- a/vendor/github.com/containerd/containerd/client.go +++ b/vendor/github.com/containerd/containerd/client.go @@ -13,10 +13,11 @@ import ( "github.com/containerd/containerd/api/services/containers" contentapi "github.com/containerd/containerd/api/services/content" diffapi "github.com/containerd/containerd/api/services/diff" - "github.com/containerd/containerd/api/services/execution" + eventsapi "github.com/containerd/containerd/api/services/events" imagesapi "github.com/containerd/containerd/api/services/images" namespacesapi "github.com/containerd/containerd/api/services/namespaces" snapshotapi "github.com/containerd/containerd/api/services/snapshot" + "github.com/containerd/containerd/api/services/tasks" versionservice "github.com/containerd/containerd/api/services/version" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" @@ -68,9 +69,11 @@ func New(address string, opts ...ClientOpt) (*Client, error) { } gopts := []grpc.DialOption{ + grpc.WithBlock(), grpc.WithInsecure(), grpc.WithTimeout(100 * time.Second), grpc.WithDialer(dialer), + grpc.FailOnNonTempDialError(true), } if copts.defaultns != "" { unary, stream := newNSInterceptors(copts.defaultns) @@ -178,7 +181,9 @@ func WithNewReadonlyRootFS(id string, i Image) NewContainerOpts { func WithRuntime(name string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { - c.Runtime = name + c.Runtime = &containers.Container_Runtime{ + Name: name, + } return nil } } @@ -194,8 +199,10 @@ func WithImage(i Image) NewContainerOpts { // the id must be unique within the namespace func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { container := containers.Container{ - ID: id, - Runtime: c.runtime, + ID: id, + Runtime: &containers.Container_Runtime{ + Name: c.runtime, + }, } for _, o := range opts { if err := o(ctx, c, &container); err != nil { @@ -329,7 +336,7 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpts) (Imag } is := c.ImageService() - if err := is.Put(ctx, name, desc); err != nil { + if err := is.Update(ctx, name, desc); err != nil { return nil, err } i, err := is.Get(ctx, name) @@ -446,11 +453,11 @@ func (c *Client) ContentStore() content.Store { } func (c *Client) SnapshotService() snapshot.Snapshotter { - return snapshotservice.NewSnapshotterFromClient(snapshotapi.NewSnapshotClient(c.conn)) + return snapshotservice.NewSnapshotterFromClient(snapshotapi.NewSnapshotsClient(c.conn)) } -func (c *Client) TaskService() execution.TasksClient { - return execution.NewTasksClient(c.conn) +func (c *Client) TaskService() tasks.TasksClient { + return tasks.NewTasksClient(c.conn) } func (c *Client) ImageService() images.Store { @@ -465,6 +472,10 @@ func (c *Client) HealthService() grpc_health_v1.HealthClient { return grpc_health_v1.NewHealthClient(c.conn) } +func (c *Client) EventService() eventsapi.EventsClient { + return eventsapi.NewEventsClient(c.conn) +} + func (c *Client) VersionService() versionservice.VersionClient { return versionservice.NewVersionClient(c.conn) } diff --git a/vendor/github.com/containerd/containerd/client_unix.go b/vendor/github.com/containerd/containerd/client_unix.go index d5a9f63ec3..f352eb4d33 100644 --- a/vendor/github.com/containerd/containerd/client_unix.go +++ b/vendor/github.com/containerd/containerd/client_unix.go @@ -9,6 +9,9 @@ import ( "time" ) +// DefaultAddress is the default unix socket address +const DefaultAddress = "/run/containerd/containerd.sock" + func dialer(address string, timeout time.Duration) (net.Conn, error) { address = strings.TrimPrefix(address, "unix://") return net.DialTimeout("unix", address, timeout) diff --git a/vendor/github.com/containerd/containerd/client_windows.go b/vendor/github.com/containerd/containerd/client_windows.go index 548024e5bd..998c15c69a 100644 --- a/vendor/github.com/containerd/containerd/client_windows.go +++ b/vendor/github.com/containerd/containerd/client_windows.go @@ -7,6 +7,9 @@ import ( winio "github.com/Microsoft/go-winio" ) +// DefaultAddress is the default unix socket address +const DefaultAddress = `\\.\pipe\containerd-containerd` + func dialer(address string, timeout time.Duration) (net.Conn, error) { return winio.DialPipe(address, &timeout) } diff --git a/vendor/github.com/containerd/containerd/container.go b/vendor/github.com/containerd/containerd/container.go index 70efc8c0f4..bd84118272 100644 --- a/vendor/github.com/containerd/containerd/container.go +++ b/vendor/github.com/containerd/containerd/container.go @@ -10,15 +10,16 @@ import ( "google.golang.org/grpc/codes" "github.com/containerd/containerd/api/services/containers" - "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/services/tasks" "github.com/containerd/containerd/api/types/mount" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" ) var ( - ErrNoImage = errors.New("container does not have an image") - ErrNoRunningTask = errors.New("no running task") + ErrNoImage = errors.New("container does not have an image") + ErrNoRunningTask = errors.New("no running task") + ErrDeleteRunningTask = errors.New("cannot delete container with running task") ) type Container interface { @@ -45,7 +46,6 @@ type container struct { client *Client c containers.Container - task *task } // ID returns the container's unique id @@ -69,6 +69,9 @@ func (c *container) Spec() (*specs.Spec, error) { // Delete deletes an existing container // an error is returned if the container has running tasks func (c *container) Delete(ctx context.Context) (err error) { + if _, err := c.Task(ctx, nil); err == nil { + return ErrDeleteRunningTask + } // TODO: should the client be the one removing resources attached // to the container at the moment before we have GC? if c.c.RootFS != "" { @@ -83,16 +86,7 @@ func (c *container) Delete(ctx context.Context) (err error) { } func (c *container) Task(ctx context.Context, attach IOAttach) (Task, error) { - c.mu.Lock() - defer c.mu.Unlock() - if c.task == nil { - t, err := c.loadTask(ctx, attach) - if err != nil { - return nil, err - } - c.task = t.(*task) - } - return c.task, nil + return c.loadTask(ctx, attach) } // Image returns the image that the container is based on @@ -110,7 +104,7 @@ func (c *container) Image(ctx context.Context) (Image, error) { }, nil } -type NewTaskOpts func(context.Context, *Client, *execution.CreateRequest) error +type NewTaskOpts func(context.Context, *Client, *tasks.CreateTaskRequest) error func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...NewTaskOpts) (Task, error) { c.mu.Lock() @@ -119,7 +113,7 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne if err != nil { return nil, err } - request := &execution.CreateRequest{ + request := &tasks.CreateTaskRequest{ ContainerID: c.c.ID, Terminal: i.Terminal, Stdin: i.Stdin, @@ -163,12 +157,11 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne t.pid = response.Pid close(t.pidSync) } - c.task = t return t, nil } func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, error) { - response, err := c.client.TaskService().Info(ctx, &execution.InfoRequest{ + response, err := c.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ ContainerID: c.c.ID, }) if err != nil { @@ -206,7 +199,6 @@ func (c *container) loadTask(ctx context.Context, ioAttach IOAttach) (Task, erro pid: response.Task.Pid, pidSync: ps, } - c.task = t return t, nil } diff --git a/vendor/github.com/containerd/containerd/container_unix.go b/vendor/github.com/containerd/containerd/container_unix.go index 8a97daa892..99f2520d96 100644 --- a/vendor/github.com/containerd/containerd/container_unix.go +++ b/vendor/github.com/containerd/containerd/container_unix.go @@ -9,7 +9,7 @@ import ( "io/ioutil" "github.com/containerd/containerd/api/services/containers" - "github.com/containerd/containerd/api/services/execution" + "github.com/containerd/containerd/api/services/tasks" "github.com/containerd/containerd/api/types/descriptor" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" @@ -83,7 +83,7 @@ func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts { } func WithTaskCheckpoint(desc v1.Descriptor) NewTaskOpts { - return func(ctx context.Context, c *Client, r *execution.CreateRequest) error { + return func(ctx context.Context, c *Client, r *tasks.CreateTaskRequest) error { id := desc.Digest index, err := decodeIndex(ctx, c.ContentStore(), id) if err != nil { diff --git a/vendor/github.com/containerd/containerd/containers/containers.go b/vendor/github.com/containerd/containerd/containers/containers.go index 7a899add4a..36cba1b4c4 100644 --- a/vendor/github.com/containerd/containerd/containers/containers.go +++ b/vendor/github.com/containerd/containerd/containers/containers.go @@ -13,13 +13,18 @@ type Container struct { ID string Labels map[string]string Image string - Runtime string + Runtime RuntimeInfo Spec []byte RootFS string CreatedAt time.Time UpdatedAt time.Time } +type RuntimeInfo struct { + Name string + Options map[string]string +} + type Store interface { Get(ctx context.Context, id string) (Container, error) List(ctx context.Context, filter string) ([]Container, error) diff --git a/vendor/github.com/containerd/containerd/content/content.go b/vendor/github.com/containerd/containerd/content/content.go index 9ef6b22e83..ca236d66c6 100644 --- a/vendor/github.com/containerd/containerd/content/content.go +++ b/vendor/github.com/containerd/containerd/content/content.go @@ -7,26 +7,9 @@ import ( "time" "github.com/opencontainers/go-digest" - "github.com/pkg/errors" ) var ( - // ErrNotFound is returned when an item is not found. - // - // Use IsNotFound(err) to detect this condition. - ErrNotFound = errors.New("content: not found") - - // ErrExists is returned when something exists when it may not be expected. - // - // Use IsExists(err) to detect this condition. - ErrExists = errors.New("content: exists") - - // ErrLocked is returned when content is actively being uploaded, this - // indicates that another process is attempting to upload the same content. - // - // Use IsLocked(err) to detect this condition. - ErrLocked = errors.New("content: locked") - bufPool = sync.Pool{ New: func() interface{} { return make([]byte, 1<<20) @@ -106,15 +89,3 @@ type Store interface { Ingester Provider } - -func IsNotFound(err error) bool { - return errors.Cause(err) == ErrNotFound -} - -func IsExists(err error) bool { - return errors.Cause(err) == ErrExists -} - -func IsLocked(err error) bool { - return errors.Cause(err) == ErrLocked -} diff --git a/vendor/github.com/containerd/containerd/content/errors.go b/vendor/github.com/containerd/containerd/content/errors.go new file mode 100644 index 0000000000..cd33e3ae9c --- /dev/null +++ b/vendor/github.com/containerd/containerd/content/errors.go @@ -0,0 +1,98 @@ +package content + +import "github.com/pkg/errors" + +type contentExistsErr struct { + desc string +} + +type contentNotFoundErr struct { + desc string +} + +type contentLockedErr struct { + desc string +} + +// ErrExists is returned when something exists when it may not be expected. +func ErrExists(msg string) error { + if msg == "" { + msg = "content: exists" + } + return errors.WithStack(contentExistsErr{ + desc: msg, + }) +} + +// ErrNotFound is returned when an item is not found. +func ErrNotFound(msg string) error { + if msg == "" { + msg = "content: not found" + } + return errors.WithStack(contentNotFoundErr{ + desc: msg, + }) +} + +// ErrLocked is returned when content is actively being uploaded, this +// indicates that another process is attempting to upload the same content. +func ErrLocked(msg string) error { + if msg == "" { + msg = "content: locked" + } + return errors.WithStack(contentLockedErr{ + desc: msg, + }) +} + +func (c contentExistsErr) Error() string { + return c.desc +} +func (c contentNotFoundErr) Error() string { + return c.desc +} +func (c contentLockedErr) Error() string { + return c.desc +} + +func (c contentExistsErr) Exists() bool { + return true +} + +func (c contentNotFoundErr) NotFound() bool { + return true +} + +func (c contentLockedErr) Locked() bool { + return true +} + +// IsNotFound returns true if the error is due to a not found content item +func IsNotFound(err error) bool { + if err, ok := errors.Cause(err).(interface { + NotFound() bool + }); ok { + return err.NotFound() + } + return false +} + +// IsExists returns true if the error is due to an already existing content item +func IsExists(err error) bool { + if err, ok := errors.Cause(err).(interface { + Exists() bool + }); ok { + return err.Exists() + } + return false +} + +// IsLocked returns true if the error is due to a currently locked content item +func IsLocked(err error) bool { + if err, ok := errors.Cause(err).(interface { + Locked() bool + }); ok { + return err.Locked() + } + return false +} diff --git a/vendor/github.com/containerd/containerd/content/locks.go b/vendor/github.com/containerd/containerd/content/locks.go index 44ed16d3d9..4d3aa110a7 100644 --- a/vendor/github.com/containerd/containerd/content/locks.go +++ b/vendor/github.com/containerd/containerd/content/locks.go @@ -1,9 +1,8 @@ package content import ( + "fmt" "sync" - - "github.com/pkg/errors" ) // Handles locking references @@ -20,7 +19,7 @@ func tryLock(ref string) error { defer locksMu.Unlock() if _, ok := locks[ref]; ok { - return errors.Wrapf(ErrLocked, "key %s is locked", ref) + return ErrLocked(fmt.Sprintf("key %s is locked", ref)) } locks[ref] = struct{}{} diff --git a/vendor/github.com/containerd/containerd/content/store.go b/vendor/github.com/containerd/containerd/content/store.go index 2a45c1658c..f9c0687517 100644 --- a/vendor/github.com/containerd/containerd/content/store.go +++ b/vendor/github.com/containerd/containerd/content/store.go @@ -40,7 +40,7 @@ func (s *store) Info(ctx context.Context, dgst digest.Digest) (Info, error) { fi, err := os.Stat(p) if err != nil { if os.IsNotExist(err) { - err = ErrNotFound + err = ErrNotFound("") } return Info{}, err @@ -62,7 +62,7 @@ func (s *store) Reader(ctx context.Context, dgst digest.Digest) (io.ReadCloser, fp, err := os.Open(s.blobPath(dgst)) if err != nil { if os.IsNotExist(err) { - err = ErrNotFound + err = ErrNotFound("") } return nil, err } @@ -85,7 +85,7 @@ func (cs *store) Delete(ctx context.Context, dgst digest.Digest) error { return err } - return ErrNotFound + return ErrNotFound("") } return nil @@ -232,7 +232,7 @@ func (s *store) Writer(ctx context.Context, ref string, total int64, expected di if expected != "" { p := s.blobPath(expected) if _, err := os.Stat(p); err == nil { - return nil, ErrExists + return nil, ErrExists("") } } @@ -329,7 +329,7 @@ func (s *store) Abort(ctx context.Context, ref string) error { root := s.ingestRoot(ref) if err := os.RemoveAll(root); err != nil { if os.IsNotExist(err) { - return ErrNotFound + return ErrNotFound("") } return err diff --git a/vendor/github.com/containerd/containerd/content/writer.go b/vendor/github.com/containerd/containerd/content/writer.go index c506369600..5ac3b7e408 100644 --- a/vendor/github.com/containerd/containerd/content/writer.go +++ b/vendor/github.com/containerd/containerd/content/writer.go @@ -99,7 +99,7 @@ func (w *writer) Commit(size int64, expected digest.Digest) error { if err := os.Rename(ingest, target); err != nil { if os.IsExist(err) { // collision with the target file! - return ErrExists + return ErrExists("") } return err } diff --git a/vendor/github.com/containerd/containerd/events/convert.go b/vendor/github.com/containerd/containerd/events/convert.go new file mode 100644 index 0000000000..b7f2470a95 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/convert.go @@ -0,0 +1,92 @@ +package events + +import ( + "path" + "strings" + + "github.com/containerd/containerd/api/types/event" + "github.com/gogo/protobuf/proto" + protobuf "github.com/gogo/protobuf/types" + "github.com/pkg/errors" +) + +func getUrl(name string) string { + base := "types.containerd.io" + return path.Join(base, strings.Join([]string{ + "containerd", + EventVersion, + "types", + "event", + name, + }, ".")) +} + +func convertToAny(evt Event) (*protobuf.Any, error) { + url := "" + var pb proto.Message + switch v := evt.(type) { + case event.ContainerCreate: + url = getUrl("ContainerCreate") + pb = &v + case event.ContainerDelete: + url = getUrl("ContainerDelete") + pb = &v + case event.TaskCreate: + url = getUrl("TaskCreate") + pb = &v + case event.TaskStart: + url = getUrl("TaskStart") + pb = &v + case event.TaskDelete: + url = getUrl("TaskDelete") + pb = &v + case event.ContentDelete: + url = getUrl("ContentDelete") + pb = &v + case event.SnapshotPrepare: + url = getUrl("SnapshotPrepare") + pb = &v + case event.SnapshotCommit: + url = getUrl("SnapshotCommit") + pb = &v + case event.SnapshotRemove: + url = getUrl("SnapshotRemove") + pb = &v + case event.ImageUpdate: + url = getUrl("ImageUpdate") + pb = &v + case event.ImageDelete: + url = getUrl("ImageDelete") + pb = &v + case event.NamespaceCreate: + url = getUrl("NamespaceCreate") + pb = &v + case event.NamespaceUpdate: + url = getUrl("NamespaceUpdate") + pb = &v + case event.NamespaceDelete: + url = getUrl("NamespaceDelete") + pb = &v + case event.RuntimeCreate: + url = getUrl("RuntimeCreate") + pb = &v + case event.RuntimeEvent: + url = getUrl("RuntimeEvent") + pb = &v + case event.RuntimeDelete: + url = getUrl("RuntimeDelete") + pb = &v + default: + return nil, errors.Errorf("unsupported event type: %T", v) + } + + val, err := proto.Marshal(pb) + if err != nil { + return nil, err + } + + return &protobuf.Any{ + TypeUrl: url, + Value: val, + }, nil +} diff --git a/vendor/github.com/containerd/containerd/events/emitter.go b/vendor/github.com/containerd/containerd/events/emitter.go new file mode 100644 index 0000000000..a6bbed1ab7 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/emitter.go @@ -0,0 +1,65 @@ +package events + +import ( + "context" + "sync" + + "github.com/containerd/containerd/api/types/event" + "github.com/containerd/containerd/namespaces" + goevents "github.com/docker/go-events" +) + +const ( + EventVersion = "v1" +) + +type Emitter struct { + sinks map[string]*eventSink + broadcaster *goevents.Broadcaster + m sync.Mutex +} + +func NewEmitter() *Emitter { + return &Emitter{ + sinks: make(map[string]*eventSink), + broadcaster: goevents.NewBroadcaster(), + m: sync.Mutex{}, + } +} + +func (e *Emitter) Post(ctx context.Context, evt Event) error { + if err := e.broadcaster.Write(&sinkEvent{ + ctx: ctx, + event: evt, + }); err != nil { + return err + } + + return nil +} + +func (e *Emitter) Events(ctx context.Context, clientID string) chan *event.Envelope { + e.m.Lock() + if _, ok := e.sinks[clientID]; !ok { + ns, _ := namespaces.Namespace(ctx) + s := &eventSink{ + ch: make(chan *event.Envelope), + ns: ns, + } + e.sinks[clientID] = s + e.broadcaster.Add(s) + } + ch := e.sinks[clientID].ch + e.m.Unlock() + + return ch +} + +func (e *Emitter) Remove(clientID string) { + e.m.Lock() + if v, ok := e.sinks[clientID]; ok { + e.broadcaster.Remove(v) + delete(e.sinks, clientID) + } + e.m.Unlock() +} diff --git a/vendor/github.com/containerd/containerd/events/event.go b/vendor/github.com/containerd/containerd/events/event.go new file mode 100644 index 0000000000..f59f0c4a8d --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/event.go @@ -0,0 +1,3 @@ +package events + +type Event interface{} diff --git a/vendor/github.com/containerd/containerd/events/poster.go b/vendor/github.com/containerd/containerd/events/poster.go new file mode 100644 index 0000000000..520b5e8d08 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/poster.go @@ -0,0 +1,65 @@ +package events + +import ( + "context" + + "github.com/Sirupsen/logrus" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/namespaces" +) + +var ( + G = GetPoster +) + +// Poster posts the event. +type Poster interface { + Post(ctx context.Context, evt Event) error +} + +type posterKey struct{} + +func WithPoster(ctx context.Context, poster Poster) context.Context { + return context.WithValue(ctx, posterKey{}, poster) +} + +func GetPoster(ctx context.Context) Poster { + poster := ctx.Value(posterKey{}) + + if poster == nil { + tx, _ := getTx(ctx) + topic := getTopic(ctx) + + // likely means we don't have a configured event system. Just return + // the default poster, which merely logs events. + return posterFunc(func(ctx context.Context, evt Event) error { + fields := logrus.Fields{"event": evt} + + if topic != "" { + fields["topic"] = topic + } + ns, _ := namespaces.Namespace(ctx) + fields["ns"] = ns + + if tx != nil { + fields["tx.id"] = tx.id + if tx.parent != nil { + fields["tx.parent.id"] = tx.parent.id + } + } + + log.G(ctx).WithFields(fields).Debug("event fired") + + return nil + }) + } + + return poster.(Poster) +} + +type posterFunc func(ctx context.Context, evt Event) error + +func (fn posterFunc) Post(ctx context.Context, evt Event) error { + fn(ctx, evt) + return nil +} diff --git a/vendor/github.com/containerd/containerd/events/sink.go b/vendor/github.com/containerd/containerd/events/sink.go new file mode 100644 index 0000000000..9ae5912be7 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/sink.go @@ -0,0 +1,58 @@ +package events + +import ( + "context" + "time" + + "github.com/Sirupsen/logrus" + "github.com/containerd/containerd/api/types/event" + "github.com/containerd/containerd/namespaces" + goevents "github.com/docker/go-events" + "github.com/pkg/errors" +) + +type sinkEvent struct { + ctx context.Context + event Event +} + +type eventSink struct { + ns string + ch chan *event.Envelope +} + +func (s *eventSink) Write(evt goevents.Event) error { + e, ok := evt.(*sinkEvent) + if !ok { + return errors.New("event is not a sink event") + } + topic := getTopic(e.ctx) + + ns, _ := namespaces.Namespace(e.ctx) + if ns != "" && ns != s.ns { + // ignore events not intended for this ns + return nil + } + + eventData, err := convertToAny(e.event) + if err != nil { + return err + } + + logrus.WithFields(logrus.Fields{ + "topic": topic, + "type": eventData.TypeUrl, + "ns": ns, + }).Debug("event") + + s.ch <- &event.Envelope{ + Timestamp: time.Now(), + Topic: topic, + Event: eventData, + } + return nil +} + +func (s *eventSink) Close() error { + return nil +} diff --git a/vendor/github.com/containerd/containerd/events/topic.go b/vendor/github.com/containerd/containerd/events/topic.go new file mode 100644 index 0000000000..5f371a1182 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/topic.go @@ -0,0 +1,35 @@ +package events + +import "context" + +type topicKey struct{} + +// WithTopic returns a context with a new topic set, such that events emitted +// from the resulting context will be marked with the topic. +// +// A topic groups events by the target module they operate on. This is +// primarily designed to support multi-module log compaction of events. In +// typical journaling systems, the entries operate on a single data structure. +// When compacting the journal, we can replace all former log entries with a +// summary data structure that will result in the same state. +// +// By providing a compaction mechanism by topic, we can prune down to a data +// structure oriented towards a single topic, leaving unrelated messages alone. +func WithTopic(ctx context.Context, topic string) context.Context { + return context.WithValue(ctx, topicKey{}, topic) +} + +func getTopic(ctx context.Context) string { + topic := ctx.Value(topicKey{}) + + if topic == nil { + return "" + } + + return topic.(string) +} + +// RegisterCompactor sets the compacter for the given topic. +func RegisterCompactor(topic string, compactor interface{}) { + panic("not implemented") +} diff --git a/vendor/github.com/containerd/containerd/events/transaction.go b/vendor/github.com/containerd/containerd/events/transaction.go new file mode 100644 index 0000000000..11a2cd40b1 --- /dev/null +++ b/vendor/github.com/containerd/containerd/events/transaction.go @@ -0,0 +1,96 @@ +package events + +import ( + "context" + "fmt" + "sync" + "sync/atomic" + "time" +) + +var txCounter int64 // replace this with something that won't break + +// nextTXID provides the next transaction identifier. +func nexttxID() int64 { + // TODO(stevvooe): Need to coordinate this with existing transaction logs. + // For now, this is a toy, but not a racy one. + return atomic.AddInt64(&txCounter, 1) +} + +type transaction struct { + ctx context.Context + id int64 + parent *transaction // if nil, no parent transaction + finish sync.Once + start, end time.Time // informational +} + +// begin creates a sub-transaction. +func (tx *transaction) begin(ctx context.Context, poster Poster) *transaction { + id := nexttxID() + + child := &transaction{ + ctx: ctx, + id: id, + parent: tx, + start: time.Now(), + } + + // post the transaction started event + poster.Post(ctx, child.makeTransactionEvent("begin")) // transactions are really just events + + return child +} + +// commit writes out the transaction. +func (tx *transaction) commit(poster Poster) { + tx.finish.Do(func() { + tx.end = time.Now() + poster.Post(tx.ctx, tx.makeTransactionEvent("commit")) + }) +} + +func (tx *transaction) rollback(poster Poster, cause error) { + tx.finish.Do(func() { + tx.end = time.Now() + event := tx.makeTransactionEvent("rollback") + event = fmt.Sprintf("%s error=%q", event, cause.Error()) + poster.Post(tx.ctx, event) + }) +} + +func (tx *transaction) makeTransactionEvent(status string) Event { + // TODO(stevvooe): obviously, we need more structure than this. + event := fmt.Sprintf("%v %v", status, tx.id) + if tx.parent != nil { + event += " parent=" + fmt.Sprint(tx.parent.id) + } + + return event +} + +type txKey struct{} + +func getTx(ctx context.Context) (*transaction, bool) { + tx := ctx.Value(txKey{}) + if tx == nil { + return nil, false + } + + return tx.(*transaction), true +} + +// WithTx returns a new context with an event transaction, such that events +// posted to the underlying context will be committed to the event log as a +// group, organized by a transaction id, when commit is called. +func WithTx(pctx context.Context) (ctx context.Context, commit func(), rollback func(err error)) { + poster := G(pctx) + parent, _ := getTx(pctx) + tx := parent.begin(pctx, poster) + + return context.WithValue(pctx, txKey{}, tx), func() { + tx.commit(poster) + }, func(err error) { + tx.rollback(poster, err) + } +} diff --git a/vendor/github.com/containerd/containerd/images/image.go b/vendor/github.com/containerd/containerd/images/image.go index 875e366e37..4e8780758f 100644 --- a/vendor/github.com/containerd/containerd/images/image.go +++ b/vendor/github.com/containerd/containerd/images/image.go @@ -3,12 +3,12 @@ package images import ( "context" "encoding/json" - "errors" "io/ioutil" "github.com/containerd/containerd/content" digest "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" ) // Image provides the model for how containerd views container images. @@ -18,7 +18,7 @@ type Image struct { } type Store interface { - Put(ctx context.Context, name string, desc ocispec.Descriptor) error + Update(ctx context.Context, name string, desc ocispec.Descriptor) error Get(ctx context.Context, name string) (Image, error) List(ctx context.Context) ([]Image, error) Delete(ctx context.Context, name string) error @@ -51,38 +51,13 @@ func (image *Image) RootFS(ctx context.Context, provider content.Provider) ([]di // Size returns the total size of an image's packed resources. func (image *Image) Size(ctx context.Context, provider content.Provider) (int64, error) { var size int64 - return size, Walk(ctx, HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { - switch image.Target.MediaType { - case MediaTypeDockerSchema2Manifest, ocispec.MediaTypeImageManifest: - size += desc.Size - rc, err := provider.Reader(ctx, image.Target.Digest) - if err != nil { - return nil, err - } - defer rc.Close() - - p, err := ioutil.ReadAll(rc) - if err != nil { - return nil, err - } - - var manifest ocispec.Manifest - if err := json.Unmarshal(p, &manifest); err != nil { - return nil, err - } - - size += manifest.Config.Size - - for _, layer := range manifest.Layers { - size += layer.Size - } - - return nil, nil - default: - return nil, errors.New("unsupported type") + return size, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { + if desc.Size < 0 { + return nil, errors.Errorf("invalid size %v in %v (%v)", desc.Size, desc.Digest, desc.MediaType) } - - }), image.Target) + size += desc.Size + return nil, nil + }), ChildrenHandler(provider)), image.Target) } func Config(ctx context.Context, provider content.Provider, image ocispec.Descriptor) (ocispec.Descriptor, error) { diff --git a/vendor/github.com/containerd/containerd/metadata/buckets.go b/vendor/github.com/containerd/containerd/metadata/buckets.go index ae0ae06427..536d040117 100644 --- a/vendor/github.com/containerd/containerd/metadata/buckets.go +++ b/vendor/github.com/containerd/containerd/metadata/buckets.go @@ -39,6 +39,8 @@ var ( bucketKeyLabels = []byte("labels") bucketKeyImage = []byte("image") bucketKeyRuntime = []byte("runtime") + bucketKeyName = []byte("name") + bucketKeyOptions = []byte("options") bucketKeySpec = []byte("spec") bucketKeyRootFS = []byte("rootfs") bucketKeyCreatedAt = []byte("createdat") diff --git a/vendor/github.com/containerd/containerd/metadata/containers.go b/vendor/github.com/containerd/containerd/metadata/containers.go index 40e5927d15..6fcf82e8ae 100644 --- a/vendor/github.com/containerd/containerd/metadata/containers.go +++ b/vendor/github.com/containerd/containerd/metadata/containers.go @@ -28,7 +28,7 @@ func (s *containerStore) Get(ctx context.Context, id string) (containers.Contain bkt := getContainerBucket(s.tx, namespace, id) if bkt == nil { - return containers.Container{}, errors.Wrap(ErrNotFound, "bucket does not exist") + return containers.Container{}, ErrNotFound("bucket does not exist") } container := containers.Container{ID: id} @@ -85,7 +85,7 @@ func (s *containerStore) Create(ctx context.Context, container containers.Contai cbkt, err := bkt.CreateBucket([]byte(container.ID)) if err != nil { if err == bolt.ErrBucketExists { - err = errors.Wrap(ErrExists, "content for id already exists") + err = ErrExists("content for id already exists") } return containers.Container{}, err } @@ -107,12 +107,12 @@ func (s *containerStore) Update(ctx context.Context, container containers.Contai bkt := getContainersBucket(s.tx, namespace) if bkt == nil { - return containers.Container{}, errors.Wrap(ErrNotFound, "no containers") + return containers.Container{}, ErrNotFound("no containers") } cbkt := bkt.Bucket([]byte(container.ID)) if cbkt == nil { - return containers.Container{}, errors.Wrap(ErrNotFound, "no content for id") + return containers.Container{}, ErrNotFound("no content for id") } container.UpdatedAt = time.Now() @@ -131,11 +131,11 @@ func (s *containerStore) Delete(ctx context.Context, id string) error { bkt := getContainersBucket(s.tx, namespace) if bkt == nil { - return errors.Wrap(ErrNotFound, "no containers") + return ErrNotFound("no containers") } if err := bkt.DeleteBucket([]byte(id)); err == bolt.ErrBucketNotFound { - return errors.Wrap(ErrNotFound, "no content for id") + return ErrNotFound("no content for id") } return err } @@ -146,7 +146,26 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error { case string(bucketKeyImage): container.Image = string(v) case string(bucketKeyRuntime): - container.Runtime = string(v) + rbkt := bkt.Bucket(bucketKeyRuntime) + if rbkt == nil { + return nil // skip runtime. should be an error? + } + + n := rbkt.Get(bucketKeyName) + if n != nil { + container.Runtime.Name = string(n) + } + + obkt := rbkt.Bucket(bucketKeyOptions) + if obkt == nil { + return nil + } + + container.Runtime.Options = map[string]string{} + return obkt.ForEach(func(k, v []byte) error { + container.Runtime.Options[string(k)] = string(v) + return nil + }) case string(bucketKeySpec): container.Spec = make([]byte, len(v)) copy(container.Spec, v) @@ -187,9 +206,9 @@ func writeContainer(container *containers.Container, bkt *bolt.Bucket) error { if err != nil { return err } + for _, v := range [][2][]byte{ {bucketKeyImage, []byte(container.Image)}, - {bucketKeyRuntime, []byte(container.Runtime)}, {bucketKeySpec, container.Spec}, {bucketKeyRootFS, []byte(container.RootFS)}, {bucketKeyCreatedAt, createdAt}, @@ -199,6 +218,33 @@ func writeContainer(container *containers.Container, bkt *bolt.Bucket) error { return err } } + + if rbkt := bkt.Bucket(bucketKeyRuntime); rbkt != nil { + if err := bkt.DeleteBucket(bucketKeyRuntime); err != nil { + return err + } + } + + rbkt, err := bkt.CreateBucket(bucketKeyRuntime) + if err != nil { + return err + } + + if err := rbkt.Put(bucketKeyName, []byte(container.Runtime.Name)); err != nil { + return err + } + + obkt, err := rbkt.CreateBucket(bucketKeyOptions) + if err != nil { + return err + } + + for k, v := range container.Runtime.Options { + if err := obkt.Put([]byte(k), []byte(v)); err != nil { + return err + } + } + // Remove existing labels to keep from merging if lbkt := bkt.Bucket(bucketKeyLabels); lbkt != nil { if err := bkt.DeleteBucket(bucketKeyLabels); err != nil { diff --git a/vendor/github.com/containerd/containerd/metadata/errors.go b/vendor/github.com/containerd/containerd/metadata/errors.go index 4607ec48e2..f9955c0b7c 100644 --- a/vendor/github.com/containerd/containerd/metadata/errors.go +++ b/vendor/github.com/containerd/containerd/metadata/errors.go @@ -2,21 +2,94 @@ package metadata import "github.com/pkg/errors" -var ( - ErrExists = errors.New("metadata: exists") - ErrNotFound = errors.New("metadata: not found") - ErrNotEmpty = errors.New("metadata: namespace not empty") -) +type metadataExistsErr struct { + desc string +} +type metadataNotFoundErr struct { + desc string +} +type metadataNotEmptyErr struct { + desc string +} + +// ErrExists is returned when an item already exists in metadata +func ErrExists(msg string) error { + if msg == "" { + msg = "metadata: exists" + } + return errors.WithStack(metadataExistsErr{ + desc: msg, + }) +} + +// ErrNotFound is returned when an item cannot be found in metadata +func ErrNotFound(msg string) error { + if msg == "" { + msg = "metadata: not found" + } + return errors.WithStack(metadataNotFoundErr{ + desc: msg, + }) +} + +// ErrNotEmpty is returned when a metadata item can't be deleted because it is not empty +func ErrNotEmpty(msg string) error { + if msg == "" { + msg = "metadata: namespace not empty" + } + return errors.WithStack(metadataNotEmptyErr{ + desc: msg, + }) +} + +func (m metadataExistsErr) Error() string { + return m.desc +} +func (m metadataNotFoundErr) Error() string { + return m.desc +} +func (m metadataNotEmptyErr) Error() string { + return m.desc +} + +func (m metadataExistsErr) Exists() bool { + return true +} + +func (m metadataNotFoundErr) NotFound() bool { + return true +} + +func (m metadataNotEmptyErr) NotEmpty() bool { + return true +} -// IsNotFound returns true if the error is due to a missing image. +// IsNotFound returns true if the error is due to a missing metadata item func IsNotFound(err error) bool { - return errors.Cause(err) == ErrNotFound + if err, ok := errors.Cause(err).(interface { + NotFound() bool + }); ok { + return err.NotFound() + } + return false } +// IsExists returns true if the error is due to an already existing metadata item func IsExists(err error) bool { - return errors.Cause(err) == ErrExists + if err, ok := errors.Cause(err).(interface { + Exists() bool + }); ok { + return err.Exists() + } + return false } +// IsNotEmpty returns true if the error is due to delete request of a non-empty metadata item func IsNotEmpty(err error) bool { - return errors.Cause(err) == ErrNotEmpty + if err, ok := errors.Cause(err).(interface { + NotEmpty() bool + }); ok { + return err.NotEmpty() + } + return false } diff --git a/vendor/github.com/containerd/containerd/metadata/images.go b/vendor/github.com/containerd/containerd/metadata/images.go index 43c7030198..1d0a6ba81c 100644 --- a/vendor/github.com/containerd/containerd/metadata/images.go +++ b/vendor/github.com/containerd/containerd/metadata/images.go @@ -30,12 +30,12 @@ func (s *imageStore) Get(ctx context.Context, name string) (images.Image, error) bkt := getImagesBucket(s.tx, namespace) if bkt == nil { - return images.Image{}, ErrNotFound + return images.Image{}, ErrNotFound("") } ibkt := bkt.Bucket([]byte(name)) if ibkt == nil { - return images.Image{}, ErrNotFound + return images.Image{}, ErrNotFound("") } image.Name = name @@ -46,7 +46,7 @@ func (s *imageStore) Get(ctx context.Context, name string) (images.Image, error) return image, nil } -func (s *imageStore) Put(ctx context.Context, name string, desc ocispec.Descriptor) error { +func (s *imageStore) Update(ctx context.Context, name string, desc ocispec.Descriptor) error { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return err @@ -124,7 +124,7 @@ func (s *imageStore) Delete(ctx context.Context, name string) error { return withImagesBucket(s.tx, namespace, func(bkt *bolt.Bucket) error { err := bkt.DeleteBucket([]byte(name)) if err == bolt.ErrBucketNotFound { - return ErrNotFound + return ErrNotFound("") } return err }) diff --git a/vendor/github.com/containerd/containerd/metadata/namespaces.go b/vendor/github.com/containerd/containerd/metadata/namespaces.go index ffe898f67f..b2b429500c 100644 --- a/vendor/github.com/containerd/containerd/metadata/namespaces.go +++ b/vendor/github.com/containerd/containerd/metadata/namespaces.go @@ -21,11 +21,15 @@ func (s *namespaceStore) Create(ctx context.Context, namespace string, labels ma return err } + if err := namespaces.Validate(namespace); err != nil { + return err + } + // provides the already exists error. bkt, err := topbkt.CreateBucket([]byte(namespace)) if err != nil { if err == bolt.ErrBucketExists { - return ErrExists + return ErrExists("") } return err @@ -100,12 +104,12 @@ func (s *namespaceStore) Delete(ctx context.Context, namespace string) error { if empty, err := s.namespaceEmpty(ctx, namespace); err != nil { return err } else if !empty { - return ErrNotEmpty + return ErrNotEmpty("") } if err := bkt.DeleteBucket([]byte(namespace)); err != nil { if err == bolt.ErrBucketNotFound { - return ErrNotFound + return ErrNotFound("") } return err diff --git a/vendor/github.com/containerd/containerd/namespaces/context.go b/vendor/github.com/containerd/containerd/namespaces/context.go index fe5049e983..4fae0e991f 100644 --- a/vendor/github.com/containerd/containerd/namespaces/context.go +++ b/vendor/github.com/containerd/containerd/namespaces/context.go @@ -1,16 +1,24 @@ package namespaces import ( + "os" + "github.com/pkg/errors" "golang.org/x/net/context" ) +const ( + NamespaceEnvVar = "CONTAINERD_NAMESPACE" + Default = "default" +) + var ( errNamespaceRequired = errors.New("namespace is required") ) type namespaceKey struct{} +// WithNamespace sets a given namespace on the context func WithNamespace(ctx context.Context, namespace string) context.Context { ctx = context.WithValue(ctx, namespaceKey{}, namespace) // set our key for namespace @@ -19,6 +27,19 @@ func WithNamespace(ctx context.Context, namespace string) context.Context { return withGRPCNamespaceHeader(ctx, namespace) } +// NamespaceFromEnv uses the namespace defined in CONTAINERD_NAMESPACE or +// default +func NamespaceFromEnv(ctx context.Context) context.Context { + namespace := os.Getenv(NamespaceEnvVar) + if namespace == "" { + namespace = Default + } + return WithNamespace(ctx, namespace) +} + +// Namespace returns the namespace from the context. +// +// The namespace is not guaranteed to be valid. func Namespace(ctx context.Context) (string, bool) { namespace, ok := ctx.Value(namespaceKey{}).(string) if !ok { @@ -28,15 +49,21 @@ func Namespace(ctx context.Context) (string, bool) { return namespace, ok } +// IsNamespaceRequired returns whether an error is caused by a missing namespace func IsNamespaceRequired(err error) bool { return errors.Cause(err) == errNamespaceRequired } +// NamespaceRequired returns the valid namepace from the context or an error. func NamespaceRequired(ctx context.Context) (string, error) { namespace, ok := Namespace(ctx) if !ok || namespace == "" { return "", errNamespaceRequired } + if err := Validate(namespace); err != nil { + return "", err + } + return namespace, nil } diff --git a/vendor/github.com/containerd/containerd/namespaces/validate.go b/vendor/github.com/containerd/containerd/namespaces/validate.go new file mode 100644 index 0000000000..033ed4b85a --- /dev/null +++ b/vendor/github.com/containerd/containerd/namespaces/validate.go @@ -0,0 +1,52 @@ +package namespaces + +import ( + "regexp" + + "github.com/pkg/errors" +) + +const ( + label = `[a-z][a-z0-9]+(?:[-]+[a-z0-9]+)*` +) + +func reGroup(s string) string { + return `(?:` + s + `)` +} + +func reAnchor(s string) string { + return `^` + s + `$` +} + +var ( + // namespaceRe validates that a namespace matches valid namespaces. + // + // Rules for domains, defined in RFC 1035, section 2.3.1, are used for + // namespaces. + namespaceRe = regexp.MustCompile(reAnchor(label + reGroup("[.]"+reGroup(label)) + "*")) + + errNamespaceInvalid = errors.Errorf("invalid namespace, must match %v", namespaceRe) +) + +// IsNamespacesValid return true if the error was due to an invalid namespace +// name. +func IsNamespaceInvalid(err error) bool { + return errors.Cause(err) == errNamespaceInvalid +} + +// Validate return nil if the string s is a valid namespace name. +// +// Namespaces must be valid domain names according to RFC 1035, section 2.3.1. +// To enforce case insensitvity, all characters must be lower case. +// +// In general, namespaces that pass this validation, should be safe for use as +// a domain name or filesystem path component. +// +// Typically, this function is used through NamespacesRequired, rather than +// directly. +func Validate(s string) error { + if !namespaceRe.MatchString(s) { + return errors.Wrapf(errNamespaceInvalid, "namespace %q", s) + } + return nil +} diff --git a/vendor/github.com/containerd/containerd/plugin/context.go b/vendor/github.com/containerd/containerd/plugin/context.go index 9f19dffa7e..0cc36c9018 100644 --- a/vendor/github.com/containerd/containerd/plugin/context.go +++ b/vendor/github.com/containerd/containerd/plugin/context.go @@ -3,6 +3,8 @@ package plugin import ( "context" "fmt" + + "github.com/containerd/containerd/events" ) func NewContext(plugins map[PluginType][]interface{}) *InitContext { @@ -15,6 +17,7 @@ type InitContext struct { Root string Context context.Context Config interface{} + Emitter *events.Emitter plugins map[PluginType][]interface{} } diff --git a/vendor/github.com/containerd/containerd/plugin/runtime.go b/vendor/github.com/containerd/containerd/plugin/runtime.go index 8c38a5eb14..4c6f44d6ec 100644 --- a/vendor/github.com/containerd/containerd/plugin/runtime.go +++ b/vendor/github.com/containerd/containerd/plugin/runtime.go @@ -25,6 +25,7 @@ type CreateOpts struct { } type Exit struct { + Pid uint32 Status uint32 Timestamp time.Time } @@ -34,14 +35,13 @@ type Exit struct { type Runtime interface { // ID of the runtime ID() string - // Create creates a container with the provided id and options + // Create creates a task with the provided id and options. Create(ctx context.Context, id string, opts CreateOpts) (Task, error) - // Get returns a container + // Get returns a task. Get(context.Context, string) (Task, error) - // Containers returns all the current containers for the runtime + // Tasks returns all the current tasks for the runtime. + // Any container runs at most one task at a time. Tasks(context.Context) ([]Task, error) - // Delete removes the container in the runtime + // Delete removes the task in the runtime. Delete(context.Context, Task) (*Exit, error) - // Events returns events for the runtime and all containers created by the runtime - Events(context.Context) <-chan *Event } diff --git a/vendor/github.com/containerd/containerd/plugin/container.go b/vendor/github.com/containerd/containerd/plugin/task.go similarity index 87% rename from vendor/github.com/containerd/containerd/plugin/container.go rename to vendor/github.com/containerd/containerd/plugin/task.go index cce33b316e..33e57ac85d 100644 --- a/vendor/github.com/containerd/containerd/plugin/container.go +++ b/vendor/github.com/containerd/containerd/plugin/task.go @@ -32,21 +32,11 @@ type Task interface { // CloseStdin closes the processes stdin CloseStdin(context.Context, uint32) error // Checkpoint checkpoints a container to an image with live system data - Checkpoint(context.Context, CheckpointOpts) error + Checkpoint(context.Context, string, map[string]string) error // DeleteProcess deletes a specific exec process via the pid DeleteProcess(context.Context, uint32) (*Exit, error) } -type CheckpointOpts struct { - Exit bool - AllowTCP bool - AllowUnixSockets bool - AllowTerminal bool - FileLocks bool - EmptyNamespaces []string - Path string -} - type ExecOpts struct { Spec []byte IO IO diff --git a/vendor/github.com/containerd/containerd/process.go b/vendor/github.com/containerd/containerd/process.go index e4f3e092a5..f0e34acb33 100644 --- a/vendor/github.com/containerd/containerd/process.go +++ b/vendor/github.com/containerd/containerd/process.go @@ -5,8 +5,11 @@ import ( "encoding/json" "syscall" - "github.com/containerd/containerd/api/services/execution" - taskapi "github.com/containerd/containerd/api/types/task" + eventsapi "github.com/containerd/containerd/api/services/events" + "github.com/containerd/containerd/api/services/tasks" + "github.com/containerd/containerd/api/types/event" + tasktypes "github.com/containerd/containerd/api/types/task" + "github.com/gogo/protobuf/proto" protobuf "github.com/gogo/protobuf/types" specs "github.com/opencontainers/runtime-spec/specs-go" ) @@ -38,7 +41,7 @@ func (p *process) Start(ctx context.Context) error { if err != nil { return err } - request := &execution.ExecRequest{ + request := &tasks.ExecProcessRequest{ ContainerID: p.task.containerID, Terminal: p.io.Terminal, Stdin: p.io.Stdin, @@ -59,10 +62,10 @@ func (p *process) Start(ctx context.Context) error { } func (p *process) Kill(ctx context.Context, s syscall.Signal) error { - _, err := p.task.client.TaskService().Kill(ctx, &execution.KillRequest{ + _, err := p.task.client.TaskService().Kill(ctx, &tasks.KillRequest{ Signal: uint32(s), ContainerID: p.task.containerID, - PidOrAll: &execution.KillRequest_Pid{ + PidOrAll: &tasks.KillRequest_Pid{ Pid: p.pid, }, }) @@ -70,30 +73,43 @@ func (p *process) Kill(ctx context.Context, s syscall.Signal) error { } func (p *process) Wait(ctx context.Context) (uint32, error) { - events, err := p.task.client.TaskService().Events(ctx, &execution.EventsRequest{}) + // TODO (ehazlett): add filtering for specific event + events, err := p.task.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{}) if err != nil { return UnknownExitStatus, err } <-p.pidSync for { - e, err := events.Recv() + evt, err := events.Recv() if err != nil { return UnknownExitStatus, err } - if e.Type != taskapi.Event_EXIT { - continue - } - if e.ID == p.task.containerID && e.Pid == p.pid { - return e.ExitStatus, nil + if evt.Event.TypeUrl == "types.containerd.io/containerd.v1.types.event.RuntimeEvent" { + e := &event.RuntimeEvent{} + if err := proto.Unmarshal(evt.Event.Value, e); err != nil { + return UnknownExitStatus, err + } + + if e.Type != tasktypes.Event_EXIT { + continue + } + + if e.ID == p.task.containerID && e.Pid == p.pid { + return e.ExitStatus, nil + } } } } -func (p *process) CloseStdin(ctx context.Context) error { - _, err := p.task.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{ +func (p *process) CloseIO(ctx context.Context, opts ...IOCloserOpts) error { + r := &tasks.CloseIORequest{ ContainerID: p.task.containerID, Pid: p.pid, - }) + } + for _, o := range opts { + o(r) + } + _, err := p.task.client.TaskService().CloseIO(ctx, r) return err } @@ -102,7 +118,7 @@ func (p *process) IO() *IO { } func (p *process) Resize(ctx context.Context, w, h uint32) error { - _, err := p.task.client.TaskService().Pty(ctx, &execution.PtyRequest{ + _, err := p.task.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ ContainerID: p.task.containerID, Width: w, Height: h, @@ -113,7 +129,7 @@ func (p *process) Resize(ctx context.Context, w, h uint32) error { func (p *process) Delete(ctx context.Context) (uint32, error) { cerr := p.io.Close() - r, err := p.task.client.TaskService().DeleteProcess(ctx, &execution.DeleteProcessRequest{ + r, err := p.task.client.TaskService().DeleteProcess(ctx, &tasks.DeleteProcessRequest{ ContainerID: p.task.containerID, Pid: p.pid, }) diff --git a/vendor/github.com/containerd/containerd/remotes/docker/pusher.go b/vendor/github.com/containerd/containerd/remotes/docker/pusher.go index f99701820d..e2c08e3cb0 100644 --- a/vendor/github.com/containerd/containerd/remotes/docker/pusher.go +++ b/vendor/github.com/containerd/containerd/remotes/docker/pusher.go @@ -31,7 +31,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten status, err := p.tracker.GetStatus(ref) if err == nil { if status.Offset == status.Total { - return nil, content.ErrExists + return nil, content.ErrExists("") } // TODO: Handle incomplete status } else if !content.IsNotFound(err) { @@ -72,7 +72,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten // TODO: Set updated time? }, }) - return nil, content.ErrExists + return nil, content.ErrExists("") } if resp.StatusCode != http.StatusNotFound { // TODO: log error diff --git a/vendor/github.com/containerd/containerd/remotes/docker/status.go b/vendor/github.com/containerd/containerd/remotes/docker/status.go index 34280f1d12..dc564b12cf 100644 --- a/vendor/github.com/containerd/containerd/remotes/docker/status.go +++ b/vendor/github.com/containerd/containerd/remotes/docker/status.go @@ -34,7 +34,7 @@ func (t *memoryStatusTracker) GetStatus(ref string) (Status, error) { defer t.m.Unlock() status, ok := t.statuses[ref] if !ok { - return Status{}, content.ErrNotFound + return Status{}, content.ErrNotFound("") } return status, nil } diff --git a/vendor/github.com/containerd/containerd/services/content/helpers.go b/vendor/github.com/containerd/containerd/services/content/helpers.go index d518909c57..a0a12898e9 100644 --- a/vendor/github.com/containerd/containerd/services/content/helpers.go +++ b/vendor/github.com/containerd/containerd/services/content/helpers.go @@ -10,13 +10,12 @@ import ( func rewriteGRPCError(err error) error { switch grpc.Code(errors.Cause(err)) { case codes.AlreadyExists: - return content.ErrExists + return content.ErrExists(grpc.ErrorDesc(err)) case codes.NotFound: - return content.ErrNotFound + return content.ErrNotFound(grpc.ErrorDesc(err)) case codes.Unavailable: - return content.ErrLocked + return content.ErrLocked(grpc.ErrorDesc(err)) } - return err } diff --git a/vendor/github.com/containerd/containerd/services/content/reader.go b/vendor/github.com/containerd/containerd/services/content/reader.go index 7c22db9874..b7a311b361 100644 --- a/vendor/github.com/containerd/containerd/services/content/reader.go +++ b/vendor/github.com/containerd/containerd/services/content/reader.go @@ -26,7 +26,7 @@ func (rr *remoteReader) Read(p []byte) (n int, err error) { p = p[n:] for len(p) > 0 { - var resp *contentapi.ReadResponse + var resp *contentapi.ReadContentResponse // fill our buffer up until we can fill p. resp, err = rr.client.Recv() if err != nil { @@ -56,7 +56,7 @@ type remoteReaderAt struct { } func (ra *remoteReaderAt) ReadAt(p []byte, off int64) (n int, err error) { - rr := &contentapi.ReadRequest{ + rr := &contentapi.ReadContentRequest{ Digest: ra.digest, Offset: off, Size_: int64(len(p)), @@ -67,7 +67,7 @@ func (ra *remoteReaderAt) ReadAt(p []byte, off int64) (n int, err error) { } for len(p) > 0 { - var resp *contentapi.ReadResponse + var resp *contentapi.ReadContentResponse // fill our buffer up until we can fill p. resp, err = rc.Recv() if err != nil { diff --git a/vendor/github.com/containerd/containerd/services/content/service.go b/vendor/github.com/containerd/containerd/services/content/service.go index fb84d113c6..20dc12a652 100644 --- a/vendor/github.com/containerd/containerd/services/content/service.go +++ b/vendor/github.com/containerd/containerd/services/content/service.go @@ -6,7 +6,9 @@ import ( "github.com/Sirupsen/logrus" api "github.com/containerd/containerd/api/services/content" + "github.com/containerd/containerd/api/types/event" "github.com/containerd/containerd/content" + "github.com/containerd/containerd/events" "github.com/containerd/containerd/log" "github.com/containerd/containerd/plugin" "github.com/golang/protobuf/ptypes/empty" @@ -18,7 +20,8 @@ import ( ) type Service struct { - store content.Store + store content.Store + emitter events.Poster } var bufPool = sync.Pool{ @@ -46,7 +49,8 @@ func NewService(ic *plugin.InitContext) (interface{}, error) { return nil, err } return &Service{ - store: c.(content.Store), + store: c.(content.Store), + emitter: events.GetPoster(ic.Context), }, nil } @@ -124,10 +128,16 @@ func (s *Service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*e return nil, serverErrorToGRPC(err, req.Digest.String()) } + if err := s.emit(ctx, "/content/delete", event.ContentDelete{ + Digest: req.Digest, + }); err != nil { + return nil, err + } + return &empty.Empty{}, nil } -func (s *Service) Read(req *api.ReadRequest, session api.Content_ReadServer) error { +func (s *Service) Read(req *api.ReadContentRequest, session api.Content_ReadServer) error { if err := req.Digest.Validate(); err != nil { return grpc.Errorf(codes.InvalidArgument, "%v: %v", req.Digest, err) } @@ -183,7 +193,7 @@ func (s *Service) Read(req *api.ReadRequest, session api.Content_ReadServer) err return nil } -// readResponseWriter is a writer that places the output into ReadResponse messages. +// readResponseWriter is a writer that places the output into ReadContentRequest messages. // // This allows io.CopyBuffer to do the heavy lifting of chunking the responses // into the buffer size. @@ -193,7 +203,7 @@ type readResponseWriter struct { } func (rw *readResponseWriter) Write(p []byte) (n int, err error) { - if err := rw.session.Send(&api.ReadResponse{ + if err := rw.session.Send(&api.ReadContentResponse{ Offset: rw.offset, Data: p, }); err != nil { @@ -205,9 +215,9 @@ func (rw *readResponseWriter) Write(p []byte) (n int, err error) { } func (s *Service) Status(ctx context.Context, req *api.StatusRequest) (*api.StatusResponse, error) { - statuses, err := s.store.Status(ctx, req.Regexp) + statuses, err := s.store.Status(ctx, req.Filter) if err != nil { - return nil, serverErrorToGRPC(err, req.Regexp) + return nil, serverErrorToGRPC(err, req.Filter) } var resp api.StatusResponse @@ -228,23 +238,25 @@ func (s *Service) Status(ctx context.Context, req *api.StatusRequest) (*api.Stat func (s *Service) Write(session api.Content_WriteServer) (err error) { var ( ctx = session.Context() - msg api.WriteResponse - req *api.WriteRequest + msg api.WriteContentResponse + req *api.WriteContentRequest ref string total int64 expected digest.Digest ) - defer func(msg *api.WriteResponse) { + defer func(msg *api.WriteContentResponse) { // pump through the last message if no error was encountered if err != nil { - // TODO(stevvooe): Really need a log line here to track which - // errors are actually causing failure on the server side. May want - // to configure the service with an interceptor to make this work - // identically across all GRPC methods. - // - // This is pretty noisy, so we can remove it but leave it for now. - log.G(ctx).WithError(err).Error("(*Service).Write failed") + if grpc.Code(err) != codes.AlreadyExists { + // TODO(stevvooe): Really need a log line here to track which + // errors are actually causing failure on the server side. May want + // to configure the service with an interceptor to make this work + // identically across all GRPC methods. + // + // This is pretty noisy, so we can remove it but leave it for now. + log.G(ctx).WithError(err).Error("(*Service).Write failed") + } return } @@ -407,3 +419,12 @@ func (s *Service) Abort(ctx context.Context, req *api.AbortRequest) (*empty.Empt return &empty.Empty{}, nil } + +func (s *Service) emit(ctx context.Context, topic string, evt interface{}) error { + emitterCtx := events.WithTopic(ctx, topic) + if err := s.emitter.Post(emitterCtx, evt); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/containerd/containerd/services/content/store.go b/vendor/github.com/containerd/containerd/services/content/store.go index 11ad37b0ea..d191b62c95 100644 --- a/vendor/github.com/containerd/containerd/services/content/store.go +++ b/vendor/github.com/containerd/containerd/services/content/store.go @@ -75,7 +75,7 @@ func (rs *remoteStore) Delete(ctx context.Context, dgst digest.Digest) error { } func (rs *remoteStore) Reader(ctx context.Context, dgst digest.Digest) (io.ReadCloser, error) { - client, err := rs.client.Read(ctx, &contentapi.ReadRequest{Digest: dgst}) + client, err := rs.client.Read(ctx, &contentapi.ReadContentRequest{Digest: dgst}) if err != nil { return nil, err } @@ -93,9 +93,9 @@ func (rs *remoteStore) ReaderAt(ctx context.Context, dgst digest.Digest) (io.Rea }, nil } -func (rs *remoteStore) Status(ctx context.Context, re string) ([]content.Status, error) { +func (rs *remoteStore) Status(ctx context.Context, filter string) ([]content.Status, error) { resp, err := rs.client.Status(ctx, &contentapi.StatusRequest{ - Regexp: re, + Filter: filter, }) if err != nil { return nil, rewriteGRPCError(err) @@ -146,7 +146,7 @@ func (rs *remoteStore) negotiate(ctx context.Context, ref string, size int64, ex return nil, 0, err } - if err := wrclient.Send(&contentapi.WriteRequest{ + if err := wrclient.Send(&contentapi.WriteContentRequest{ Action: contentapi.WriteActionStat, Ref: ref, Total: size, diff --git a/vendor/github.com/containerd/containerd/services/content/writer.go b/vendor/github.com/containerd/containerd/services/content/writer.go index 6ea17ef1ea..884de001f0 100644 --- a/vendor/github.com/containerd/containerd/services/content/writer.go +++ b/vendor/github.com/containerd/containerd/services/content/writer.go @@ -17,7 +17,7 @@ type remoteWriter struct { } // send performs a synchronous req-resp cycle on the client. -func (rw *remoteWriter) send(req *contentapi.WriteRequest) (*contentapi.WriteResponse, error) { +func (rw *remoteWriter) send(req *contentapi.WriteContentRequest) (*contentapi.WriteContentResponse, error) { if err := rw.client.Send(req); err != nil { return nil, err } @@ -35,7 +35,7 @@ func (rw *remoteWriter) send(req *contentapi.WriteRequest) (*contentapi.WriteRes } func (rw *remoteWriter) Status() (content.Status, error) { - resp, err := rw.send(&contentapi.WriteRequest{ + resp, err := rw.send(&contentapi.WriteContentRequest{ Action: contentapi.WriteActionStat, }) if err != nil { @@ -57,7 +57,7 @@ func (rw *remoteWriter) Digest() digest.Digest { func (rw *remoteWriter) Write(p []byte) (n int, err error) { offset := rw.offset - resp, err := rw.send(&contentapi.WriteRequest{ + resp, err := rw.send(&contentapi.WriteContentRequest{ Action: contentapi.WriteActionWrite, Offset: offset, Data: p, @@ -79,7 +79,7 @@ func (rw *remoteWriter) Write(p []byte) (n int, err error) { } func (rw *remoteWriter) Commit(size int64, expected digest.Digest) error { - resp, err := rw.send(&contentapi.WriteRequest{ + resp, err := rw.send(&contentapi.WriteContentRequest{ Action: contentapi.WriteActionCommit, Total: size, Offset: rw.offset, diff --git a/vendor/github.com/containerd/containerd/services/images/client.go b/vendor/github.com/containerd/containerd/services/images/client.go index 3e47f0336d..d12d1c09f3 100644 --- a/vendor/github.com/containerd/containerd/services/images/client.go +++ b/vendor/github.com/containerd/containerd/services/images/client.go @@ -18,10 +18,10 @@ func NewStoreFromClient(client imagesapi.ImagesClient) images.Store { } } -func (s *remoteStore) Put(ctx context.Context, name string, desc ocispec.Descriptor) error { +func (s *remoteStore) Update(ctx context.Context, name string, desc ocispec.Descriptor) error { // TODO(stevvooe): Consider that the remote may want to augment and return // a modified image. - _, err := s.client.Put(ctx, &imagesapi.PutRequest{ + _, err := s.client.Update(ctx, &imagesapi.UpdateImageRequest{ Image: imagesapi.Image{ Name: name, Target: descToProto(&desc), @@ -32,7 +32,7 @@ func (s *remoteStore) Put(ctx context.Context, name string, desc ocispec.Descrip } func (s *remoteStore) Get(ctx context.Context, name string) (images.Image, error) { - resp, err := s.client.Get(ctx, &imagesapi.GetRequest{ + resp, err := s.client.Get(ctx, &imagesapi.GetImageRequest{ Name: name, }) if err != nil { @@ -43,7 +43,7 @@ func (s *remoteStore) Get(ctx context.Context, name string) (images.Image, error } func (s *remoteStore) List(ctx context.Context) ([]images.Image, error) { - resp, err := s.client.List(ctx, &imagesapi.ListRequest{}) + resp, err := s.client.List(ctx, &imagesapi.ListImagesRequest{}) if err != nil { return nil, rewriteGRPCError(err) } @@ -52,7 +52,7 @@ func (s *remoteStore) List(ctx context.Context) ([]images.Image, error) { } func (s *remoteStore) Delete(ctx context.Context, name string) error { - _, err := s.client.Delete(ctx, &imagesapi.DeleteRequest{ + _, err := s.client.Delete(ctx, &imagesapi.DeleteImageRequest{ Name: name, }) diff --git a/vendor/github.com/containerd/containerd/services/images/helpers.go b/vendor/github.com/containerd/containerd/services/images/helpers.go index 19ce9e18af..f2d9aed56b 100644 --- a/vendor/github.com/containerd/containerd/services/images/helpers.go +++ b/vendor/github.com/containerd/containerd/services/images/helpers.go @@ -69,9 +69,9 @@ func rewriteGRPCError(err error) error { switch grpc.Code(errors.Cause(err)) { case codes.AlreadyExists: - return metadata.ErrExists + return metadata.ErrExists(grpc.ErrorDesc(err)) case codes.NotFound: - return metadata.ErrNotFound + return metadata.ErrNotFound(grpc.ErrorDesc(err)) } return err @@ -85,6 +85,8 @@ func mapGRPCError(err error, id string) error { return grpc.Errorf(codes.AlreadyExists, "image %v already exists", id) case namespaces.IsNamespaceRequired(err): return grpc.Errorf(codes.InvalidArgument, "namespace required, please set %q header", namespaces.GRPCHeader) + case namespaces.IsNamespaceInvalid(err): + return grpc.Errorf(codes.InvalidArgument, err.Error()) } return err diff --git a/vendor/github.com/containerd/containerd/services/images/service.go b/vendor/github.com/containerd/containerd/services/images/service.go index 57d1f0b146..31d9fd5383 100644 --- a/vendor/github.com/containerd/containerd/services/images/service.go +++ b/vendor/github.com/containerd/containerd/services/images/service.go @@ -3,6 +3,8 @@ package images import ( "github.com/boltdb/bolt" imagesapi "github.com/containerd/containerd/api/services/images" + "github.com/containerd/containerd/api/types/event" + "github.com/containerd/containerd/events" "github.com/containerd/containerd/images" "github.com/containerd/containerd/metadata" "github.com/containerd/containerd/plugin" @@ -19,21 +21,26 @@ func init() { plugin.MetadataPlugin, }, Init: func(ic *plugin.InitContext) (interface{}, error) { + e := events.GetPoster(ic.Context) m, err := ic.Get(plugin.MetadataPlugin) if err != nil { return nil, err } - return NewService(m.(*bolt.DB)), nil + return NewService(m.(*bolt.DB), e), nil }, }) } type Service struct { - db *bolt.DB + db *bolt.DB + emitter events.Poster } -func NewService(db *bolt.DB) imagesapi.ImagesServer { - return &Service{db: db} +func NewService(db *bolt.DB, evts events.Poster) imagesapi.ImagesServer { + return &Service{ + db: db, + emitter: evts, + } } func (s *Service) Register(server *grpc.Server) error { @@ -41,8 +48,8 @@ func (s *Service) Register(server *grpc.Server) error { return nil } -func (s *Service) Get(ctx context.Context, req *imagesapi.GetRequest) (*imagesapi.GetResponse, error) { - var resp imagesapi.GetResponse +func (s *Service) Get(ctx context.Context, req *imagesapi.GetImageRequest) (*imagesapi.GetImageResponse, error) { + var resp imagesapi.GetImageResponse return &resp, s.withStoreView(ctx, func(ctx context.Context, store images.Store) error { image, err := store.Get(ctx, req.Name) @@ -55,14 +62,28 @@ func (s *Service) Get(ctx context.Context, req *imagesapi.GetRequest) (*imagesap }) } -func (s *Service) Put(ctx context.Context, req *imagesapi.PutRequest) (*empty.Empty, error) { - return &empty.Empty{}, s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error { - return mapGRPCError(store.Put(ctx, req.Image.Name, descFromProto(&req.Image.Target)), req.Image.Name) - }) +func (s *Service) Update(ctx context.Context, req *imagesapi.UpdateImageRequest) (*imagesapi.UpdateImageResponse, error) { + if err := s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error { + return mapGRPCError(store.Update(ctx, req.Image.Name, descFromProto(&req.Image.Target)), req.Image.Name) + }); err != nil { + return nil, err + } + + if err := s.emit(ctx, "/images/update", event.ImageUpdate{ + Name: req.Image.Name, + Labels: req.Image.Labels, + }); err != nil { + return nil, err + } + + // TODO: get image back out to return + return &imagesapi.UpdateImageResponse{ + //Image: nil, + }, nil } -func (s *Service) List(ctx context.Context, _ *imagesapi.ListRequest) (*imagesapi.ListResponse, error) { - var resp imagesapi.ListResponse +func (s *Service) List(ctx context.Context, _ *imagesapi.ListImagesRequest) (*imagesapi.ListImagesResponse, error) { + var resp imagesapi.ListImagesResponse return &resp, s.withStoreView(ctx, func(ctx context.Context, store images.Store) error { images, err := store.List(ctx) @@ -75,10 +96,20 @@ func (s *Service) List(ctx context.Context, _ *imagesapi.ListRequest) (*imagesap }) } -func (s *Service) Delete(ctx context.Context, req *imagesapi.DeleteRequest) (*empty.Empty, error) { - return &empty.Empty{}, s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error { +func (s *Service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest) (*empty.Empty, error) { + if err := s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error { return mapGRPCError(store.Delete(ctx, req.Name), req.Name) - }) + }); err != nil { + return nil, err + } + + if err := s.emit(ctx, "/images/delete", event.ImageDelete{ + Name: req.Name, + }); err != nil { + return nil, err + } + + return &empty.Empty{}, nil } func (s *Service) withStore(ctx context.Context, fn func(ctx context.Context, store images.Store) error) func(tx *bolt.Tx) error { @@ -92,3 +123,12 @@ func (s *Service) withStoreView(ctx context.Context, fn func(ctx context.Context func (s *Service) withStoreUpdate(ctx context.Context, fn func(ctx context.Context, store images.Store) error) error { return s.db.Update(s.withStore(ctx, fn)) } + +func (s *Service) emit(ctx context.Context, topic string, evt interface{}) error { + emitterCtx := events.WithTopic(ctx, topic) + if err := s.emitter.Post(emitterCtx, evt); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/containerd/containerd/services/snapshot/client.go b/vendor/github.com/containerd/containerd/services/snapshot/client.go index 747aeb6ee1..96124b7acd 100644 --- a/vendor/github.com/containerd/containerd/services/snapshot/client.go +++ b/vendor/github.com/containerd/containerd/services/snapshot/client.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc/codes" snapshotapi "github.com/containerd/containerd/api/services/snapshot" + mountapi "github.com/containerd/containerd/api/types/mount" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/snapshot" "github.com/pkg/errors" @@ -16,18 +17,18 @@ import ( // NewSnapshotterFromClient returns a new Snapshotter which communicates // over a GRPC connection. -func NewSnapshotterFromClient(client snapshotapi.SnapshotClient) snapshot.Snapshotter { +func NewSnapshotterFromClient(client snapshotapi.SnapshotsClient) snapshot.Snapshotter { return &remoteSnapshotter{ client: client, } } type remoteSnapshotter struct { - client snapshotapi.SnapshotClient + client snapshotapi.SnapshotsClient } func (r *remoteSnapshotter) Stat(ctx context.Context, key string) (snapshot.Info, error) { - resp, err := r.client.Stat(ctx, &snapshotapi.StatRequest{Key: key}) + resp, err := r.client.Stat(ctx, &snapshotapi.StatSnapshotRequest{Key: key}) if err != nil { return snapshot.Info{}, rewriteGRPCError(err) } @@ -47,27 +48,27 @@ func (r *remoteSnapshotter) Mounts(ctx context.Context, key string) ([]mount.Mou if err != nil { return nil, rewriteGRPCError(err) } - return toMounts(resp), nil + return toMounts(resp.Mounts), nil } func (r *remoteSnapshotter) Prepare(ctx context.Context, key, parent string) ([]mount.Mount, error) { - resp, err := r.client.Prepare(ctx, &snapshotapi.PrepareRequest{Key: key, Parent: parent}) + resp, err := r.client.Prepare(ctx, &snapshotapi.PrepareSnapshotRequest{Key: key, Parent: parent}) if err != nil { return nil, rewriteGRPCError(err) } - return toMounts(resp), nil + return toMounts(resp.Mounts), nil } func (r *remoteSnapshotter) View(ctx context.Context, key, parent string) ([]mount.Mount, error) { - resp, err := r.client.View(ctx, &snapshotapi.PrepareRequest{Key: key, Parent: parent}) + resp, err := r.client.View(ctx, &snapshotapi.ViewSnapshotRequest{Key: key, Parent: parent}) if err != nil { return nil, rewriteGRPCError(err) } - return toMounts(resp), nil + return toMounts(resp.Mounts), nil } func (r *remoteSnapshotter) Commit(ctx context.Context, name, key string) error { - _, err := r.client.Commit(ctx, &snapshotapi.CommitRequest{ + _, err := r.client.Commit(ctx, &snapshotapi.CommitSnapshotRequest{ Name: name, Key: key, }) @@ -75,12 +76,12 @@ func (r *remoteSnapshotter) Commit(ctx context.Context, name, key string) error } func (r *remoteSnapshotter) Remove(ctx context.Context, key string) error { - _, err := r.client.Remove(ctx, &snapshotapi.RemoveRequest{Key: key}) + _, err := r.client.Remove(ctx, &snapshotapi.RemoveSnapshotRequest{Key: key}) return rewriteGRPCError(err) } func (r *remoteSnapshotter) Walk(ctx context.Context, fn func(context.Context, snapshot.Info) error) error { - sc, err := r.client.List(ctx, &snapshotapi.ListRequest{}) + sc, err := r.client.List(ctx, &snapshotapi.ListSnapshotsRequest{}) if err != nil { rewriteGRPCError(err) } @@ -145,9 +146,9 @@ func toUsage(resp *snapshotapi.UsageResponse) snapshot.Usage { } } -func toMounts(resp *snapshotapi.MountsResponse) []mount.Mount { - mounts := make([]mount.Mount, len(resp.Mounts)) - for i, m := range resp.Mounts { +func toMounts(mm []*mountapi.Mount) []mount.Mount { + mounts := make([]mount.Mount, len(mm)) + for i, m := range mm { mounts[i] = mount.Mount{ Type: m.Type, Source: m.Source, diff --git a/vendor/github.com/containerd/containerd/services/snapshot/service.go b/vendor/github.com/containerd/containerd/services/snapshot/service.go index f4baf72577..e2ecd6948f 100644 --- a/vendor/github.com/containerd/containerd/services/snapshot/service.go +++ b/vendor/github.com/containerd/containerd/services/snapshot/service.go @@ -4,7 +4,9 @@ import ( gocontext "context" snapshotapi "github.com/containerd/containerd/api/services/snapshot" + "github.com/containerd/containerd/api/types/event" mounttypes "github.com/containerd/containerd/api/types/mount" + "github.com/containerd/containerd/events" "github.com/containerd/containerd/log" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/plugin" @@ -23,11 +25,12 @@ func init() { plugin.SnapshotPlugin, }, Init: func(ic *plugin.InitContext) (interface{}, error) { + e := events.GetPoster(ic.Context) s, err := ic.Get(plugin.SnapshotPlugin) if err != nil { return nil, err } - return newService(s.(snapshot.Snapshotter)) + return newService(s.(snapshot.Snapshotter), e) }, }) } @@ -36,20 +39,22 @@ var empty = &protoempty.Empty{} type service struct { snapshotter snapshot.Snapshotter + emitter events.Poster } -func newService(snapshotter snapshot.Snapshotter) (*service, error) { +func newService(snapshotter snapshot.Snapshotter, evts events.Poster) (*service, error) { return &service{ snapshotter: snapshotter, + emitter: evts, }, nil } func (s *service) Register(gs *grpc.Server) error { - snapshotapi.RegisterSnapshotServer(gs, s) + snapshotapi.RegisterSnapshotsServer(gs, s) return nil } -func (s *service) Prepare(ctx context.Context, pr *snapshotapi.PrepareRequest) (*snapshotapi.MountsResponse, error) { +func (s *service) Prepare(ctx context.Context, pr *snapshotapi.PrepareSnapshotRequest) (*snapshotapi.PrepareSnapshotResponse, error) { log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing snapshot") // TODO: Apply namespace // TODO: Lookup snapshot id from metadata store @@ -57,10 +62,19 @@ func (s *service) Prepare(ctx context.Context, pr *snapshotapi.PrepareRequest) ( if err != nil { return nil, grpcError(err) } - return fromMounts(mounts), nil + + if err := s.emit(ctx, "/snapshot/prepare", event.SnapshotPrepare{ + Key: pr.Key, + Parent: pr.Parent, + }); err != nil { + return nil, err + } + return &snapshotapi.PrepareSnapshotResponse{ + Mounts: fromMounts(mounts), + }, nil } -func (s *service) View(ctx context.Context, pr *snapshotapi.PrepareRequest) (*snapshotapi.MountsResponse, error) { +func (s *service) View(ctx context.Context, pr *snapshotapi.ViewSnapshotRequest) (*snapshotapi.ViewSnapshotResponse, error) { log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing view snapshot") // TODO: Apply namespace // TODO: Lookup snapshot id from metadata store @@ -68,7 +82,9 @@ func (s *service) View(ctx context.Context, pr *snapshotapi.PrepareRequest) (*sn if err != nil { return nil, grpcError(err) } - return fromMounts(mounts), nil + return &snapshotapi.ViewSnapshotResponse{ + Mounts: fromMounts(mounts), + }, nil } func (s *service) Mounts(ctx context.Context, mr *snapshotapi.MountsRequest) (*snapshotapi.MountsResponse, error) { @@ -79,30 +95,45 @@ func (s *service) Mounts(ctx context.Context, mr *snapshotapi.MountsRequest) (*s if err != nil { return nil, grpcError(err) } - return fromMounts(mounts), nil + return &snapshotapi.MountsResponse{ + Mounts: fromMounts(mounts), + }, nil } -func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitRequest) (*protoempty.Empty, error) { +func (s *service) Commit(ctx context.Context, cr *snapshotapi.CommitSnapshotRequest) (*protoempty.Empty, error) { log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("Committing snapshot") // TODO: Apply namespace // TODO: Lookup snapshot id from metadata store if err := s.snapshotter.Commit(ctx, cr.Name, cr.Key); err != nil { return nil, grpcError(err) } + + if err := s.emit(ctx, "/snapshot/commit", event.SnapshotCommit{ + Key: cr.Key, + Name: cr.Name, + }); err != nil { + return nil, err + } return empty, nil } -func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveRequest) (*protoempty.Empty, error) { +func (s *service) Remove(ctx context.Context, rr *snapshotapi.RemoveSnapshotRequest) (*protoempty.Empty, error) { log.G(ctx).WithField("key", rr.Key).Debugf("Removing snapshot") // TODO: Apply namespace // TODO: Lookup snapshot id from metadata store if err := s.snapshotter.Remove(ctx, rr.Key); err != nil { return nil, grpcError(err) } + + if err := s.emit(ctx, "/snapshot/remove", event.SnapshotRemove{ + Key: rr.Key, + }); err != nil { + return nil, err + } return empty, nil } -func (s *service) Stat(ctx context.Context, sr *snapshotapi.StatRequest) (*snapshotapi.StatResponse, error) { +func (s *service) Stat(ctx context.Context, sr *snapshotapi.StatSnapshotRequest) (*snapshotapi.StatSnapshotResponse, error) { log.G(ctx).WithField("key", sr.Key).Debugf("Statting snapshot") // TODO: Apply namespace info, err := s.snapshotter.Stat(ctx, sr.Key) @@ -110,16 +141,15 @@ func (s *service) Stat(ctx context.Context, sr *snapshotapi.StatRequest) (*snaps return nil, grpcError(err) } - return &snapshotapi.StatResponse{Info: fromInfo(info)}, nil + return &snapshotapi.StatSnapshotResponse{Info: fromInfo(info)}, nil } -func (s *service) List(sr *snapshotapi.ListRequest, ss snapshotapi.Snapshot_ListServer) error { +func (s *service) List(sr *snapshotapi.ListSnapshotsRequest, ss snapshotapi.Snapshots_ListServer) error { // TODO: Apply namespace - var ( buffer []snapshotapi.Info sendBlock = func(block []snapshotapi.Info) error { - return ss.Send(&snapshotapi.ListResponse{ + return ss.Send(&snapshotapi.ListSnapshotsResponse{ Info: block, }) } @@ -197,16 +227,23 @@ func fromUsage(usage snapshot.Usage) *snapshotapi.UsageResponse { } } -func fromMounts(mounts []mount.Mount) *snapshotapi.MountsResponse { - resp := &snapshotapi.MountsResponse{ - Mounts: make([]*mounttypes.Mount, len(mounts)), - } +func fromMounts(mounts []mount.Mount) []*mounttypes.Mount { + out := make([]*mounttypes.Mount, len(mounts)) for i, m := range mounts { - resp.Mounts[i] = &mounttypes.Mount{ + out[i] = &mounttypes.Mount{ Type: m.Type, Source: m.Source, Options: m.Options, } } - return resp + return out +} + +func (s *service) emit(ctx context.Context, topic string, evt interface{}) error { + emitterCtx := events.WithTopic(ctx, topic) + if err := s.emitter.Post(emitterCtx, evt); err != nil { + return err + } + + return nil } diff --git a/vendor/github.com/containerd/containerd/spec_unix.go b/vendor/github.com/containerd/containerd/spec_unix.go index c74d88e5fc..9eb337710e 100644 --- a/vendor/github.com/containerd/containerd/spec_unix.go +++ b/vendor/github.com/containerd/containerd/spec_unix.go @@ -188,6 +188,24 @@ func WithHostNamespace(ns specs.LinuxNamespaceType) SpecOpts { } } +// WithLinuxNamespace uses the passed in namespace for the spec. If a namespace of the same type already exists in the +// spec, the existing namespace is replaced by the one provided. +func WithLinuxNamespace(ns specs.LinuxNamespace) SpecOpts { + return func(s *specs.Spec) error { + for i, n := range s.Linux.Namespaces { + if n.Type == ns.Type { + before := s.Linux.Namespaces[:i] + after := s.Linux.Namespaces[i+1:] + s.Linux.Namespaces = append(before, ns) + s.Linux.Namespaces = append(s.Linux.Namespaces, after...) + return nil + } + } + s.Linux.Namespaces = append(s.Linux.Namespaces, ns) + return nil + } +} + func WithImageConfig(ctx context.Context, i Image) SpecOpts { return func(s *specs.Spec) error { var ( diff --git a/vendor/github.com/containerd/containerd/task.go b/vendor/github.com/containerd/containerd/task.go index 77570ad1df..8b2875a64f 100644 --- a/vendor/github.com/containerd/containerd/task.go +++ b/vendor/github.com/containerd/containerd/task.go @@ -11,10 +11,13 @@ import ( "syscall" "github.com/containerd/containerd/api/services/containers" - "github.com/containerd/containerd/api/services/execution" - taskapi "github.com/containerd/containerd/api/types/task" + eventsapi "github.com/containerd/containerd/api/services/events" + "github.com/containerd/containerd/api/services/tasks" + "github.com/containerd/containerd/api/types/event" + tasktypes "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/content" "github.com/containerd/containerd/rootfs" + "github.com/gogo/protobuf/proto" "github.com/opencontainers/image-spec/specs-go/v1" specs "github.com/opencontainers/runtime-spec/specs-go" ) @@ -31,7 +34,13 @@ const ( Pausing TaskStatus = "pausing" ) -type CheckpointOpts func(*execution.CheckpointRequest) error +type IOCloserOpts func(*tasks.CloseIORequest) + +func WithStdinCloser(r *tasks.CloseIORequest) { + r.Stdin = true +} + +type CheckpointOpts func(*tasks.CheckpointTaskRequest) error type Task interface { Pid() uint32 @@ -44,7 +53,7 @@ type Task interface { Wait(context.Context) (uint32, error) Exec(context.Context, *specs.Process, IOCreation) (Process, error) Processes(context.Context) ([]uint32, error) - CloseStdin(context.Context) error + CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO Checkpoint(context.Context, ...CheckpointOpts) (v1.Descriptor, error) @@ -56,7 +65,7 @@ type Process interface { Delete(context.Context) (uint32, error) Kill(context.Context, syscall.Signal) error Wait(context.Context) (uint32, error) - CloseStdin(context.Context) error + CloseIO(context.Context, ...IOCloserOpts) error Resize(ctx context.Context, w, h uint32) error IO() *IO } @@ -70,7 +79,7 @@ type task struct { containerID string pid uint32 - deferred *execution.CreateRequest + deferred *tasks.CreateTaskRequest pidSync chan struct{} } @@ -90,17 +99,17 @@ func (t *task) Start(ctx context.Context) error { close(t.pidSync) return nil } - _, err := t.client.TaskService().Start(ctx, &execution.StartRequest{ + _, err := t.client.TaskService().Start(ctx, &tasks.StartTaskRequest{ ContainerID: t.containerID, }) return err } func (t *task) Kill(ctx context.Context, s syscall.Signal) error { - _, err := t.client.TaskService().Kill(ctx, &execution.KillRequest{ + _, err := t.client.TaskService().Kill(ctx, &tasks.KillRequest{ Signal: uint32(s), ContainerID: t.containerID, - PidOrAll: &execution.KillRequest_All{ + PidOrAll: &tasks.KillRequest_All{ All: true, }, }) @@ -108,21 +117,21 @@ func (t *task) Kill(ctx context.Context, s syscall.Signal) error { } func (t *task) Pause(ctx context.Context) error { - _, err := t.client.TaskService().Pause(ctx, &execution.PauseRequest{ + _, err := t.client.TaskService().Pause(ctx, &tasks.PauseTaskRequest{ ContainerID: t.containerID, }) return err } func (t *task) Resume(ctx context.Context) error { - _, err := t.client.TaskService().Resume(ctx, &execution.ResumeRequest{ + _, err := t.client.TaskService().Resume(ctx, &tasks.ResumeTaskRequest{ ContainerID: t.containerID, }) return err } func (t *task) Status(ctx context.Context) (TaskStatus, error) { - r, err := t.client.TaskService().Info(ctx, &execution.InfoRequest{ + r, err := t.client.TaskService().Get(ctx, &tasks.GetTaskRequest{ ContainerID: t.containerID, }) if err != nil { @@ -133,21 +142,30 @@ func (t *task) Status(ctx context.Context) (TaskStatus, error) { // Wait is a blocking call that will wait for the task to exit and return the exit status func (t *task) Wait(ctx context.Context) (uint32, error) { - events, err := t.client.TaskService().Events(ctx, &execution.EventsRequest{}) + // TODO (ehazlett): add filtering for specific event + events, err := t.client.EventService().Stream(ctx, &eventsapi.StreamEventsRequest{}) if err != nil { return UnknownExitStatus, err } <-t.pidSync for { - e, err := events.Recv() + evt, err := events.Recv() if err != nil { return UnknownExitStatus, err } - if e.Type != taskapi.Event_EXIT { - continue - } - if e.ID == t.containerID && e.Pid == t.pid { - return e.ExitStatus, nil + if evt.Event.TypeUrl == "types.containerd.io/containerd.v1.types.event.RuntimeEvent" { + e := &event.RuntimeEvent{} + if err := proto.Unmarshal(evt.Event.Value, e); err != nil { + return UnknownExitStatus, err + } + + if e.Type != tasktypes.Event_EXIT { + continue + } + + if e.ID == t.containerID && e.Pid == t.pid { + return e.ExitStatus, nil + } } } } @@ -160,7 +178,7 @@ func (t *task) Delete(ctx context.Context) (uint32, error) { if t.io != nil { cerr = t.io.Close() } - r, err := t.client.TaskService().Delete(ctx, &execution.DeleteRequest{ + r, err := t.client.TaskService().Delete(ctx, &tasks.DeleteTaskRequest{ ContainerID: t.containerID, }) if err != nil { @@ -183,7 +201,7 @@ func (t *task) Exec(ctx context.Context, spec *specs.Process, ioCreate IOCreatio } func (t *task) Processes(ctx context.Context) ([]uint32, error) { - response, err := t.client.TaskService().Processes(ctx, &execution.ProcessesRequest{ + response, err := t.client.TaskService().ListProcesses(ctx, &tasks.ListProcessesRequest{ ContainerID: t.containerID, }) if err != nil { @@ -196,11 +214,15 @@ func (t *task) Processes(ctx context.Context) ([]uint32, error) { return out, nil } -func (t *task) CloseStdin(ctx context.Context) error { - _, err := t.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{ +func (t *task) CloseIO(ctx context.Context, opts ...IOCloserOpts) error { + r := &tasks.CloseIORequest{ ContainerID: t.containerID, Pid: t.pid, - }) + } + for _, o := range opts { + o(r) + } + _, err := t.client.TaskService().CloseIO(ctx, r) return err } @@ -209,7 +231,7 @@ func (t *task) IO() *IO { } func (t *task) Resize(ctx context.Context, w, h uint32) error { - _, err := t.client.TaskService().Pty(ctx, &execution.PtyRequest{ + _, err := t.client.TaskService().ResizePty(ctx, &tasks.ResizePtyRequest{ ContainerID: t.containerID, Width: w, Height: h, @@ -218,28 +240,26 @@ func (t *task) Resize(ctx context.Context, w, h uint32) error { return err } -func WithExit(r *execution.CheckpointRequest) error { - r.Exit = true +func WithExit(r *tasks.CheckpointTaskRequest) error { + r.Options["exit"] = "true" return nil } func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Descriptor, err error) { - request := &execution.CheckpointRequest{ + request := &tasks.CheckpointTaskRequest{ ContainerID: t.containerID, + Options: make(map[string]string), } for _, o := range opts { if err := o(request); err != nil { return d, err } } - // if we are not exiting the container after the checkpoint, make sure we pause it and resume after - // all other filesystem operations are completed - if !request.Exit { - if err := t.Pause(ctx); err != nil { - return d, err - } - defer t.Resume(ctx) + // make sure we pause it and resume after all other filesystem operations are completed + if err := t.Pause(ctx); err != nil { + return d, err } + defer t.Resume(ctx) cr, err := t.client.ContainerService().Get(ctx, &containers.GetContainerRequest{ ID: t.containerID, }) @@ -261,7 +281,7 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointOpts) (d v1.Des return t.writeIndex(ctx, &index) } -func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *execution.CheckpointRequest) error { +func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *tasks.CheckpointTaskRequest) error { response, err := t.client.TaskService().Checkpoint(ctx, request) if err != nil { return err diff --git a/vendor/github.com/containerd/containerd/vendor.conf b/vendor/github.com/containerd/containerd/vendor.conf index cf83911655..ed83d2132b 100644 --- a/vendor/github.com/containerd/containerd/vendor.conf +++ b/vendor/github.com/containerd/containerd/vendor.conf @@ -3,6 +3,7 @@ github.com/containerd/go-runc 60e87b3b047d4c93faa996699f6fdcfa34685e65 github.com/containerd/console e0a2cdcf03d4d99c3bc061635a66cf92336c6c82 github.com/containerd/cgroups 7b2d1a0f50963678d5799e29d17a4d611f5a5dee github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 +github.com/docker/go-events aa2e3b613fbbfdddbe055a7b9e3ce271cfd83eca github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f github.com/prometheus/client_golang v0.8.0 github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6 @@ -12,7 +13,7 @@ github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 github.com/matttproud/golang_protobuf_extensions v1.0.0 github.com/docker/go-units v0.3.1 github.com/gogo/protobuf d2e1ade2d719b78fe5b061b4c18a9f7111b5bdc8 -github.com/golang/protobuf 7a211bcf3bce0e3f1d74f9894916e6f116ae83b4 +github.com/golang/protobuf 5a0f697c9ed9d68fef0116532c6e05cfeae00e55 github.com/opencontainers/runtime-spec v1.0.0-rc5 github.com/opencontainers/runc 639454475cb9c8b861cc599f8bcd5c8c790ae402 github.com/Sirupsen/logrus v0.11.0 diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE index fafcaafdc7..835ba3e755 100644 --- a/vendor/github.com/pkg/errors/LICENSE +++ b/vendor/github.com/pkg/errors/LICENSE @@ -21,4 +21,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md index 6ea6422ec7..273db3c98a 100644 --- a/vendor/github.com/pkg/errors/README.md +++ b/vendor/github.com/pkg/errors/README.md @@ -2,6 +2,8 @@ Package errors provides simple error handling primitives. +`go get github.com/pkg/errors` + The traditional error handling idiom in Go is roughly akin to ```go if err != nil { diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go index 65bf7a0fa5..842ee80456 100644 --- a/vendor/github.com/pkg/errors/errors.go +++ b/vendor/github.com/pkg/errors/errors.go @@ -14,13 +14,18 @@ // Adding context to an error // // The errors.Wrap function returns a new error that adds context to the -// original error. For example +// original error by recording a stack trace at the point Wrap is called, +// and the supplied message. For example // // _, err := ioutil.ReadAll(r) // if err != nil { // return errors.Wrap(err, "read failed") // } // +// If additional control is required the errors.WithStack and errors.WithMessage +// functions destructure errors.Wrap into its component operations of annotating +// an error with a stack trace and an a message, respectively. +// // Retrieving the cause of an error // // Using errors.Wrap constructs a stack of errors, adding context to the @@ -28,7 +33,7 @@ // to reverse the operation of errors.Wrap to retrieve the original error // for inspection. Any error value which implements this interface // -// type Causer interface { +// type causer interface { // Cause() error // } // @@ -43,6 +48,9 @@ // // unknown error // } // +// causer interface is not exported by this package, but is considered a part +// of stable public API. +// // Formatted printing of errors // // All error values returned from this package implement fmt.Formatter and can @@ -59,7 +67,7 @@ // New, Errorf, Wrap, and Wrapf record a stack trace at the point they are // invoked. This information can be retrieved with the following interface. // -// type StackTrace interface { +// type stackTracer interface { // StackTrace() errors.StackTrace // } // @@ -67,16 +75,19 @@ // // type StackTrace []Frame // -// The Frame type represents a call site in the stacktrace. Frame supports +// The Frame type represents a call site in the stack trace. Frame supports // the fmt.Formatter interface that can be used for printing information about -// the stacktrace of this error. For example: +// the stack trace of this error. For example: // -// if err, ok := err.(StackTrace); ok { +// if err, ok := err.(stackTracer); ok { // for _, f := range err.StackTrace() { // fmt.Printf("%+s:%d", f) // } // } // +// stackTracer interface is not exported by this package, but is considered a part +// of stable public API. +// // See the documentation for Frame.Format for more details. package errors @@ -85,102 +96,149 @@ import ( "io" ) -// _error is an error implementation returned by New and Errorf -// that implements its own fmt.Formatter. -type _error struct { +// New returns an error with the supplied message. +// New also records the stack trace at the point it was called. +func New(message string) error { + return &fundamental{ + msg: message, + stack: callers(), + } +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +// Errorf also records the stack trace at the point it was called. +func Errorf(format string, args ...interface{}) error { + return &fundamental{ + msg: fmt.Sprintf(format, args...), + stack: callers(), + } +} + +// fundamental is an error that has a message and a stack, but no caller. +type fundamental struct { msg string *stack } -func (e _error) Error() string { return e.msg } +func (f *fundamental) Error() string { return f.msg } -func (e _error) Format(s fmt.State, verb rune) { +func (f *fundamental) Format(s fmt.State, verb rune) { switch verb { case 'v': if s.Flag('+') { - io.WriteString(s, e.msg) - fmt.Fprintf(s, "%+v", e.StackTrace()) + io.WriteString(s, f.msg) + f.stack.Format(s, verb) return } fallthrough case 's': - io.WriteString(s, e.msg) + io.WriteString(s, f.msg) + case 'q': + fmt.Fprintf(s, "%q", f.msg) } } -// New returns an error with the supplied message. -func New(message string) error { - return _error{ - message, - callers(), +// WithStack annotates err with a stack trace at the point WithStack was called. +// If err is nil, WithStack returns nil. +func WithStack(err error) error { + if err == nil { + return nil } -} - -// Errorf formats according to a format specifier and returns the string -// as a value that satisfies error. -func Errorf(format string, args ...interface{}) error { - return _error{ - fmt.Sprintf(format, args...), + return &withStack{ + err, callers(), } } -type cause struct { - cause error - msg string -} - -func (c cause) Error() string { return fmt.Sprintf("%s: %v", c.msg, c.Cause()) } -func (c cause) Cause() error { return c.cause } - -// wrapper is an error implementation returned by Wrap and Wrapf -// that implements its own fmt.Formatter. -type wrapper struct { - cause +type withStack struct { + error *stack } -func (w wrapper) Format(s fmt.State, verb rune) { +func (w *withStack) Cause() error { return w.error } + +func (w *withStack) Format(s fmt.State, verb rune) { switch verb { case 'v': if s.Flag('+') { - fmt.Fprintf(s, "%+v\n", w.Cause()) - fmt.Fprintf(s, "%+v: %s", w.StackTrace()[0], w.msg) + fmt.Fprintf(s, "%+v", w.Cause()) + w.stack.Format(s, verb) return } fallthrough case 's': io.WriteString(s, w.Error()) + case 'q': + fmt.Fprintf(s, "%q", w.Error()) } } -// Wrap returns an error annotating err with message. +// Wrap returns an error annotating err with a stack trace +// at the point Wrap is called, and the supplied message. // If err is nil, Wrap returns nil. func Wrap(err error, message string) error { if err == nil { return nil } - return wrapper{ - cause: cause{ - cause: err, - msg: message, - }, - stack: callers(), + err = &withMessage{ + cause: err, + msg: message, + } + return &withStack{ + err, + callers(), } } -// Wrapf returns an error annotating err with the format specifier. +// Wrapf returns an error annotating err with a stack trace +// at the point Wrapf is call, and the format specifier. // If err is nil, Wrapf returns nil. func Wrapf(err error, format string, args ...interface{}) error { if err == nil { return nil } - return wrapper{ - cause: cause{ - cause: err, - msg: fmt.Sprintf(format, args...), - }, - stack: callers(), + err = &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } + return &withStack{ + err, + callers(), + } +} + +// WithMessage annotates err with a new message. +// If err is nil, WithMessage returns nil. +func WithMessage(err error, message string) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: message, + } +} + +type withMessage struct { + cause error + msg string +} + +func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } +func (w *withMessage) Cause() error { return w.cause } + +func (w *withMessage) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) + return + } + fallthrough + case 's', 'q': + io.WriteString(s, w.Error()) } } @@ -188,7 +246,7 @@ func Wrapf(err error, format string, args ...interface{}) error { // An error value has a cause if it implements the following // interface: // -// type Causer interface { +// type causer interface { // Cause() error // } // diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go index 243a64a2ac..6b1f2891a5 100644 --- a/vendor/github.com/pkg/errors/stack.go +++ b/vendor/github.com/pkg/errors/stack.go @@ -100,6 +100,19 @@ func (st StackTrace) Format(s fmt.State, verb rune) { // stack represents a stack of program counters. type stack []uintptr +func (s *stack) Format(st fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case st.Flag('+'): + for _, pc := range *s { + f := Frame(pc) + fmt.Fprintf(st, "\n%+v", f) + } + } + } +} + func (s *stack) StackTrace() StackTrace { f := make([]Frame, len(*s)) for i := 0; i < len(f); i++ { From b7714c63e8f2152ed5133d25501a59d9f37a0f57 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 23 Jun 2017 10:14:44 +0100 Subject: [PATCH 34/35] containerd: Require a namespace from the application. When inspecting a system with `ctr` by default you will now need to export `CONTAINERD_NAMESPACE=swarmd`. Signed-off-by: Ian Campbell --- agent/exec/containerd/executor.go | 9 +++++---- cmd/swarmd/main.go | 9 +++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/agent/exec/containerd/executor.go b/agent/exec/containerd/executor.go index 9a485f9538..3b9f9ba09c 100644 --- a/agent/exec/containerd/executor.go +++ b/agent/exec/containerd/executor.go @@ -24,10 +24,11 @@ type executor struct { var _ exec.Executor = &executor{} // NewExecutor returns an executor using the given containerd control socket -func NewExecutor(sock string, genericResources []*api.GenericResource) (exec.Executor, error) { - // TODO(ijc), configurable namespace. - // TODO(ijc), default to swarmd? - client, err := containerd.New(sock, containerd.WithDefaultNamespace("default")) +func NewExecutor(sock, namespace string, genericResources []*api.GenericResource) (exec.Executor, error) { + if namespace == "" { + return nil, errors.New("A containerd namespace is required") + } + client, err := containerd.New(sock, containerd.WithDefaultNamespace(namespace)) if err != nil { return nil, errors.Wrap(err, "creating containerd client") } diff --git a/cmd/swarmd/main.go b/cmd/swarmd/main.go index b957de517a..bc4ff1a792 100644 --- a/cmd/swarmd/main.go +++ b/cmd/swarmd/main.go @@ -140,6 +140,10 @@ var ( if err != nil { return err } + containerdNamespace, err := cmd.Flags().GetString("containerd-namespace") + if err != nil { + return err + } autolockManagers, err := cmd.Flags().GetBool("autolock") if err != nil { @@ -181,8 +185,8 @@ var ( var executor exec.Executor if containerdAddr != "" { - logrus.Infof("Using containerd via %s", containerdAddr) - executor, err = containerd.NewExecutor(containerdAddr, resources) + logrus.Infof("Using containerd via %q with namespace %q", containerdAddr, containerdNamespace) + executor, err = containerd.NewExecutor(containerdAddr, containerdNamespace, resources) if err != nil { return err } @@ -275,6 +279,7 @@ func init() { mainCmd.Flags().StringP("join-token", "", "", "Specifies the secret token required to join the cluster") mainCmd.Flags().String("engine-addr", "unix:///var/run/docker.sock", "Address of engine instance of agent.") mainCmd.Flags().String("containerd-addr", "", "Address of containerd instance of agent.") + mainCmd.Flags().String("containerd-namespace", "swarmd", "Namespace to use when using containerd agent.") mainCmd.Flags().String("hostname", "", "Override reported agent hostname") mainCmd.Flags().String("advertise-remote-api", "", "Advertise address for remote API") mainCmd.Flags().String("listen-remote-api", "0.0.0.0:4242", "Listen address for remote API") From 33000f1213c07225ac96f51ba948b62a4d62b274 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 26 Jun 2017 13:45:58 +0100 Subject: [PATCH 35/35] containerd: Wait indefinitely after sending fallback SIGKILL on shutdown. There is no good choice of timeout here and SIGKILL is always eventually fatal, although the death can be deferred in some cases by long uninterruptible sleeps. Signed-off-by: Ian Campbell --- agent/exec/containerd/adapter.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/agent/exec/containerd/adapter.go b/agent/exec/containerd/adapter.go index e5cfc40b67..32f896ba86 100644 --- a/agent/exec/containerd/adapter.go +++ b/agent/exec/containerd/adapter.go @@ -375,9 +375,6 @@ func (c *containerAdapter) shutdown(ctx context.Context) error { return c.exitStatus case <-ctx.Done(): return ctx.Err() - case <-time.After(timeout): - c.log(ctx).Infof("Task did exit after %s", timeout) - return errors.New("task is unkillable") } }