From 539742881da6d004496180908124a5075a3431aa Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Mon, 15 May 2017 17:44:50 -0700 Subject: [PATCH 1/2] api/services: define the container metadata service Working from feedback on the existing implementation, we have now introduced a central metadata object to represent the lifecycle and pin the resources required to implement what people today know as containers. This includes the runtime specification and the root filesystem snapshots. We also allow arbitrary labeling of the container. Such provisions will bring the containerd definition of container closer to what is expected by users. The objects that encompass today's ContainerService, centered around the runtime, will be known as tasks. These tasks take on the existing lifecycle behavior of containerd's containers, which means that they are deleted when they exit. Largely, there are no other changes except for naming. The `Container` object will operate purely as a metadata object. No runtime state will be held on `Container`. It only informs the execution service on what is required for creating tasks and the resources in use by that container. The resources referenced by that container will be deleted when the container is deleted, if not in use. In this sense, users can create, list, label and delete containers in a similar way as they do with docker today, without the complexity of runtime locks that plagues current implementations. Signed-off-by: Stephen J Day --- api/services/containers/containers.pb.go | 2206 +++++++++++++++++ api/services/containers/containers.proto | 116 + api/services/execution/execution.pb.go | 1022 ++++---- api/services/execution/execution.proto | 76 +- api/services/images/images.pb.go | 165 +- api/services/images/images.proto | 9 +- api/services/shim/shim.pb.go | 146 +- api/services/shim/shim.proto | 2 +- .../container.pb.go => task/task.pb.go} | 402 +-- .../container.proto => task/task.proto} | 11 +- cmd/containerd/builtins.go | 1 + cmd/containerd/main.go | 17 +- cmd/ctr/checkpoint.go | 23 +- cmd/ctr/delete.go | 17 +- cmd/ctr/events.go | 4 +- cmd/ctr/exec.go | 8 +- cmd/ctr/exec_unix.go | 2 +- cmd/ctr/exec_windows.go | 2 +- cmd/ctr/info.go | 24 +- cmd/ctr/kill.go | 8 +- cmd/ctr/list.go | 47 +- cmd/ctr/pause.go | 6 +- cmd/ctr/ps.go | 6 +- cmd/ctr/resume.go | 6 +- cmd/ctr/run.go | 37 +- cmd/ctr/run_unix.go | 69 +- cmd/ctr/run_windows.go | 44 +- cmd/ctr/utils.go | 25 +- cmd/ctrd-protobuild/main.go | 1 + containers/containers.go | 24 + containers/storage.go | 57 + images/storage.go | 2 +- linux/runtime.go | 42 +- linux/shim/client.go | 6 +- linux/shim/service.go | 46 +- linux/{container.go => task.go} | 67 +- metrics/cgroups/cgroups.go | 6 +- plugin/container.go | 13 +- plugin/monitor.go | 34 +- plugin/plugin.go | 4 +- plugin/runtime.go | 6 +- services/containers/helpers.go | 56 + services/containers/service.go | 148 ++ services/execution/service.go | 155 +- services/images/service.go | 2 +- windows/container.go | 4 +- windows/runtime.go | 8 +- 47 files changed, 4067 insertions(+), 1115 deletions(-) create mode 100644 api/services/containers/containers.pb.go create mode 100644 api/services/containers/containers.proto rename api/types/{container/container.pb.go => task/task.pb.go} (72%) rename api/types/{container/container.proto => task/task.proto} (87%) create mode 100644 containers/containers.go create mode 100644 containers/storage.go rename linux/{container.go => task.go} (68%) create mode 100644 services/containers/helpers.go create mode 100644 services/containers/service.go diff --git a/api/services/containers/containers.pb.go b/api/services/containers/containers.pb.go new file mode 100644 index 000000000..96de79d98 --- /dev/null +++ b/api/services/containers/containers.pb.go @@ -0,0 +1,2206 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/services/containers/containers.proto +// DO NOT EDIT! + +/* + Package containers is a generated protocol buffer package. + + It is generated from these files: + github.com/containerd/containerd/api/services/containers/containers.proto + + It has these top-level messages: + Container + GetContainerRequest + GetContainerResponse + ListContainersRequest + ListContainersResponse + CreateContainerRequest + CreateContainerResponse + UpdateContainerRequest + UpdateContainerResponse + DeleteContainerRequest +*/ +package containers + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import google_protobuf1 "github.com/gogo/protobuf/types" +import google_protobuf2 "github.com/golang/protobuf/ptypes/empty" +import google_protobuf3 "github.com/gogo/protobuf/types" +import _ "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 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 Container struct { + // ID is the user-specified identifier. + // + // This field may not be updated. + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Labels provides an area to include arbitrary data on containers. + // + // 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"` + // Image contains the reference of the image used to build the + // specification and snapshots for running this container. + // + // 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"` + // 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"` + // 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 + // task create request. + // + // 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"` +} + +func (m *Container) Reset() { *m = Container{} } +func (*Container) ProtoMessage() {} +func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{0} } + +type GetContainerRequest struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *GetContainerRequest) Reset() { *m = GetContainerRequest{} } +func (*GetContainerRequest) ProtoMessage() {} +func (*GetContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{1} } + +type GetContainerResponse struct { + Container Container `protobuf:"bytes,1,opt,name=container" json:"container"` +} + +func (m *GetContainerResponse) Reset() { *m = GetContainerResponse{} } +func (*GetContainerResponse) ProtoMessage() {} +func (*GetContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{2} } + +type ListContainersRequest struct { + Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (m *ListContainersRequest) Reset() { *m = ListContainersRequest{} } +func (*ListContainersRequest) ProtoMessage() {} +func (*ListContainersRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{3} } + +type ListContainersResponse struct { + Containers []Container `protobuf:"bytes,1,rep,name=containers" json:"containers"` +} + +func (m *ListContainersResponse) Reset() { *m = ListContainersResponse{} } +func (*ListContainersResponse) ProtoMessage() {} +func (*ListContainersResponse) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{4} } + +type CreateContainerRequest struct { + Container Container `protobuf:"bytes,1,opt,name=container" json:"container"` +} + +func (m *CreateContainerRequest) Reset() { *m = CreateContainerRequest{} } +func (*CreateContainerRequest) ProtoMessage() {} +func (*CreateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{5} } + +type CreateContainerResponse struct { + Container Container `protobuf:"bytes,1,opt,name=container" json:"container"` +} + +func (m *CreateContainerResponse) Reset() { *m = CreateContainerResponse{} } +func (*CreateContainerResponse) ProtoMessage() {} +func (*CreateContainerResponse) Descriptor() ([]byte, []int) { + return fileDescriptorContainers, []int{6} +} + +// UpdateContainerRequest updates the metadata on one or more container. +// +// 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 UpdateContainerRequest struct { + // Container provides the target values, as declared by the mask, for the update. + // + // The ID field must be set. + Container Container `protobuf:"bytes,1,opt,name=container" json:"container"` + // UpdateMask specifies which fields to perform the update on. If empty, + // the operation applies to all fields. + UpdateMask *google_protobuf3.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask" json:"update_mask,omitempty"` +} + +func (m *UpdateContainerRequest) Reset() { *m = UpdateContainerRequest{} } +func (*UpdateContainerRequest) ProtoMessage() {} +func (*UpdateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptorContainers, []int{7} } + +type UpdateContainerResponse struct { + Container Container `protobuf:"bytes,1,opt,name=container" json:"container"` +} + +func (m *UpdateContainerResponse) Reset() { *m = UpdateContainerResponse{} } +func (*UpdateContainerResponse) ProtoMessage() {} +func (*UpdateContainerResponse) Descriptor() ([]byte, []int) { + return fileDescriptorContainers, []int{8} +} + +type DeleteContainerRequest struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *DeleteContainerRequest) Reset() { *m = DeleteContainerRequest{} } +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") +} + +// 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 Containers service + +type ContainersClient interface { + Get(ctx context.Context, in *GetContainerRequest, opts ...grpc.CallOption) (*GetContainerResponse, error) + List(ctx context.Context, in *ListContainersRequest, opts ...grpc.CallOption) (*ListContainersResponse, error) + Create(ctx context.Context, in *CreateContainerRequest, opts ...grpc.CallOption) (*CreateContainerResponse, error) + Update(ctx context.Context, in *UpdateContainerRequest, opts ...grpc.CallOption) (*UpdateContainerResponse, error) + Delete(ctx context.Context, in *DeleteContainerRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) +} + +type containersClient struct { + cc *grpc.ClientConn +} + +func NewContainersClient(cc *grpc.ClientConn) ContainersClient { + return &containersClient{cc} +} + +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...) + if err != nil { + return nil, err + } + return out, nil +} + +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...) + if err != nil { + return nil, err + } + return out, nil +} + +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...) + if err != nil { + return nil, err + } + return out, nil +} + +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...) + if err != nil { + return nil, err + } + return out, nil +} + +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...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Containers service + +type ContainersServer interface { + Get(context.Context, *GetContainerRequest) (*GetContainerResponse, error) + List(context.Context, *ListContainersRequest) (*ListContainersResponse, error) + Create(context.Context, *CreateContainerRequest) (*CreateContainerResponse, error) + Update(context.Context, *UpdateContainerRequest) (*UpdateContainerResponse, error) + Delete(context.Context, *DeleteContainerRequest) (*google_protobuf2.Empty, error) +} + +func RegisterContainersServer(s *grpc.Server, srv ContainersServer) { + s.RegisterService(&_Containers_serviceDesc, srv) +} + +func _Containers_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainersServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Containers/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainersServer).Get(ctx, req.(*GetContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containers_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListContainersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainersServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Containers/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainersServer).List(ctx, req.(*ListContainersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containers_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainersServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Containers/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainersServer).Create(ctx, req.(*CreateContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containers_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainersServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Containers/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainersServer).Update(ctx, req.(*UpdateContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Containers_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteContainerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ContainersServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Containers/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ContainersServer).Delete(ctx, req.(*DeleteContainerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Containers_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.Containers", + HandlerType: (*ContainersServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Get", + Handler: _Containers_Get_Handler, + }, + { + MethodName: "List", + Handler: _Containers_List_Handler, + }, + { + MethodName: "Create", + Handler: _Containers_Create_Handler, + }, + { + MethodName: "Update", + Handler: _Containers_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _Containers_Delete_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/containers/containers.proto", +} + +func (m *Container) 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) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if len(m.Labels) > 0 { + for k, _ := range m.Labels { + dAtA[i] = 0x12 + i++ + v := m.Labels[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) + } + } + if len(m.Image) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.Image))) + i += copy(dAtA[i:], m.Image) + } + if len(m.Runtime) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.Runtime))) + i += copy(dAtA[i:], m.Runtime) + } + if m.Spec != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Spec.Size())) + n1, err := m.Spec.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if len(m.RootFS) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.RootFS))) + i += copy(dAtA[i:], m.RootFS) + } + return i, nil +} + +func (m *GetContainerRequest) 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 *GetContainerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + return i, nil +} + +func (m *GetContainerResponse) 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 *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n2, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *ListContainersRequest) 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 *ListContainersRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filter) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.Filter))) + i += copy(dAtA[i:], m.Filter) + } + return i, nil +} + +func (m *ListContainersResponse) 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 *ListContainersResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Containers) > 0 { + for _, msg := range m.Containers { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *CreateContainerRequest) 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 *CreateContainerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n3, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + return i, nil +} + +func (m *CreateContainerResponse) 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 *CreateContainerResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n4, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + return i, nil +} + +func (m *UpdateContainerRequest) 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 *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n5, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + if m.UpdateMask != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.UpdateMask.Size())) + n6, err := m.UpdateMask.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + return i, nil +} + +func (m *UpdateContainerResponse) 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 *UpdateContainerResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(m.Container.Size())) + n7, err := m.Container.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + return i, nil +} + +func (m *DeleteContainerRequest) 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 *DeleteContainerRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ID) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContainers(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + return i, nil +} + +func encodeFixed64Containers(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 encodeFixed32Containers(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 encodeVarintContainers(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 *Container) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovContainers(uint64(len(k))) + 1 + len(v) + sovContainers(uint64(len(v))) + n += mapEntrySize + 1 + sovContainers(uint64(mapEntrySize)) + } + } + l = len(m.Image) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + l = len(m.Runtime) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + if m.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovContainers(uint64(l)) + } + l = len(m.RootFS) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + +func (m *GetContainerRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + +func (m *GetContainerResponse) Size() (n int) { + var l int + _ = l + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + return n +} + +func (m *ListContainersRequest) Size() (n int) { + var l int + _ = l + l = len(m.Filter) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + +func (m *ListContainersResponse) Size() (n int) { + var l int + _ = l + if len(m.Containers) > 0 { + for _, e := range m.Containers { + l = e.Size() + n += 1 + l + sovContainers(uint64(l)) + } + } + return n +} + +func (m *CreateContainerRequest) Size() (n int) { + var l int + _ = l + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + return n +} + +func (m *CreateContainerResponse) Size() (n int) { + var l int + _ = l + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + return n +} + +func (m *UpdateContainerRequest) Size() (n int) { + var l int + _ = l + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + if m.UpdateMask != nil { + l = m.UpdateMask.Size() + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + +func (m *UpdateContainerResponse) Size() (n int) { + var l int + _ = l + l = m.Container.Size() + n += 1 + l + sovContainers(uint64(l)) + return n +} + +func (m *DeleteContainerRequest) Size() (n int) { + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } + return n +} + +func sovContainers(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozContainers(x uint64) (n int) { + return sovContainers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Container) 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{`&Container{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Labels:` + mapStringForLabels + `,`, + `Image:` + fmt.Sprintf("%v", this.Image) + `,`, + `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) + `,`, + `}`, + }, "") + return s +} +func (this *GetContainerRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetContainerRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `}`, + }, "") + return s +} +func (this *GetContainerResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GetContainerResponse{`, + `Container:` + strings.Replace(strings.Replace(this.Container.String(), "Container", "Container", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ListContainersRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListContainersRequest{`, + `Filter:` + fmt.Sprintf("%v", this.Filter) + `,`, + `}`, + }, "") + return s +} +func (this *ListContainersResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ListContainersResponse{`, + `Containers:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Containers), "Container", "Container", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CreateContainerRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateContainerRequest{`, + `Container:` + strings.Replace(strings.Replace(this.Container.String(), "Container", "Container", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *CreateContainerResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CreateContainerResponse{`, + `Container:` + strings.Replace(strings.Replace(this.Container.String(), "Container", "Container", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateContainerRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateContainerRequest{`, + `Container:` + strings.Replace(strings.Replace(this.Container.String(), "Container", "Container", 1), `&`, ``, 1) + `,`, + `UpdateMask:` + strings.Replace(fmt.Sprintf("%v", this.UpdateMask), "FieldMask", "google_protobuf3.FieldMask", 1) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateContainerResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateContainerResponse{`, + `Container:` + strings.Replace(strings.Replace(this.Container.String(), "Container", "Container", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeleteContainerRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeleteContainerRequest{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `}`, + }, "") + return s +} +func valueToStringContainers(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Container) 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: Container: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Container: 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 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.ID = 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 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.Labels == nil { + m.Labels = 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.Labels[mapkey] = mapvalue + } else { + var mapvalue string + m.Labels[mapkey] = mapvalue + } + iNdEx = postIndex + case 3: + 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 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.Image = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 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.Runtime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", 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 m.Spec == nil { + m.Spec = &google_protobuf1.Any{} + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + 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 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.RootFS = string(dAtA[iNdEx:postIndex]) + 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 + 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: GetContainerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetContainerRequest: 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 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.ID = string(dAtA[iNdEx:postIndex]) + 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 *GetContainerResponse) 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: GetContainerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetContainerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", 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 := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *ListContainersRequest) 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: ListContainersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListContainersRequest: 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 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.Filter = string(dAtA[iNdEx:postIndex]) + 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 *ListContainersResponse) 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: ListContainersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ListContainersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Containers", 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 + } + m.Containers = append(m.Containers, Container{}) + if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *CreateContainerRequest) 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: CreateContainerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateContainerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", 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 := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *CreateContainerResponse) 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: CreateContainerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateContainerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", 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 := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *UpdateContainerRequest) 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: UpdateContainerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateContainerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", 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 := m.Container.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 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 m.UpdateMask == nil { + m.UpdateMask = &google_protobuf3.FieldMask{} + } + if err := m.UpdateMask.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *UpdateContainerResponse) 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: UpdateContainerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateContainerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Container", 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 := m.Container.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *DeleteContainerRequest) 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: DeleteContainerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeleteContainerRequest: 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 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.ID = string(dAtA[iNdEx:postIndex]) + 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 skipContainers(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, ErrIntOverflowContainers + } + 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, ErrIntOverflowContainers + } + 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, ErrIntOverflowContainers + } + 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, ErrInvalidLengthContainers + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContainers + } + 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 := skipContainers(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 ( + ErrInvalidLengthContainers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowContainers = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/containers/containers.proto", fileDescriptorContainers) +} + +var fileDescriptorContainers = []byte{ + // 625 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, 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d, + 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, 0xe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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, +} diff --git a/api/services/containers/containers.proto b/api/services/containers/containers.proto new file mode 100644 index 000000000..bcdb85d00 --- /dev/null +++ b/api/services/containers/containers.proto @@ -0,0 +1,116 @@ +syntax = "proto3"; + +package containerd.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; + +// Containers provides metadata storage for containers used in the execution +// service. +// +// The objects here provide an state-independent view of containers for use in +// management and resource pinning. From that perspective, contaienrs do not +// have a "state" but rather this is the set of resources that will be +// considered in use by the container. +// +// From the perspective of the execution service, these objects represent the +// base parameters for creating a container process. +// +// In general, when looking to add fields for this type, first ask yourself +// whether or not the function of the field has to do with runtime execution or +// is invariant of the runtime state of the container. If it has to do with +// runtime, or changes as the "container" is started and stops, it probably +// doesn't belong on this object. +service Containers { + rpc Get(GetContainerRequest) returns (GetContainerResponse); + rpc List(ListContainersRequest) returns (ListContainersResponse); + rpc Create(CreateContainerRequest) returns (CreateContainerResponse); + rpc Update(UpdateContainerRequest) returns (UpdateContainerResponse); + rpc Delete(DeleteContainerRequest) returns (google.protobuf.Empty); +} + +message Container { + // ID is the user-specified identifier. + // + // This field may not be updated. + string id = 1; + + // Labels provides an area to include arbitrary data on containers. + // + // 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; + + // Image contains the reference of the image used to build the + // specification and snapshots for running this container. + // + // If this field is updated, the spec and rootfs needed to updated, as well. + string image = 3; + + // Runtime specifies which runtime to use for executing this container. + string runtime = 4; + + // Spec to be used when creating the container. This is runtime specific. + google.protobuf.Any spec = 6; + + // 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 + // task create request. + // + // Snapshots referenced in this field will not be garbage collected. + // + // This field may be updated. + string rootfs = 7 [(gogoproto.customname) = "RootFS"]; +} + +message GetContainerRequest { + string id = 1; +} + +message GetContainerResponse { + Container container = 1 [(gogoproto.nullable) = false]; +} + +message ListContainersRequest { + string filter = 1; // TODO(stevvooe): Define a filtering syntax to make these queries. +} + +message ListContainersResponse { + repeated Container containers = 1 [(gogoproto.nullable) = false]; +} + +message CreateContainerRequest { + Container container = 1 [(gogoproto.nullable) = false]; +} + +message CreateContainerResponse { + Container container = 1 [(gogoproto.nullable) = false]; +} + +// UpdateContainerRequest updates the metadata on one or more container. +// +// 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 UpdateContainerRequest { + // Container provides the target values, as declared by the mask, for the update. + // + // The ID field must be set. + Container container = 1 [(gogoproto.nullable) = false]; + + // UpdateMask specifies which fields to perform the update on. If empty, + // the operation applies to all fields. + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateContainerResponse { + Container container = 1 [(gogoproto.nullable) = false]; +} + +message DeleteContainerRequest { + string id = 1; +} diff --git a/api/services/execution/execution.pb.go b/api/services/execution/execution.pb.go index cee6786bd..a2b5dc8d9 100644 --- a/api/services/execution/execution.pb.go +++ b/api/services/execution/execution.pb.go @@ -15,6 +15,7 @@ DeleteRequest DeleteResponse InfoRequest + InfoResponse ListRequest ListResponse KillRequest @@ -39,8 +40,8 @@ import google_protobuf "github.com/golang/protobuf/ptypes/empty" import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import containerd_v1_types "github.com/containerd/containerd/api/types/mount" -import containerd_v1_types1 "github.com/containerd/containerd/api/types/container" -import containerd_v1_types2 "github.com/containerd/containerd/api/types/descriptor" +import containerd_v1_types1 "github.com/containerd/containerd/api/types/descriptor" +import containerd_v1_types2 "github.com/containerd/containerd/api/types/task" import _ "github.com/gogo/protobuf/types" import time "time" @@ -71,15 +72,26 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type CreateRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Spec *google_protobuf1.Any `protobuf:"bytes,2,opt,name=spec" json:"spec,omitempty"` + // 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. + // + // These are for mounts that cannot be performed in the user namespace. + // 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"` - Runtime string `protobuf:"bytes,4,opt,name=runtime,proto3" json:"runtime,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_types2.Descriptor `protobuf:"bytes,9,opt,name=checkpoint" json:"checkpoint,omitempty"` + Checkpoint *containerd_v1_types1.Descriptor `protobuf:"bytes,9,opt,name=checkpoint" json:"checkpoint,omitempty"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -87,8 +99,8 @@ func (*CreateRequest) ProtoMessage() {} func (*CreateRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{0} } type CreateResponse struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + 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{} } @@ -96,7 +108,7 @@ func (*CreateResponse) ProtoMessage() {} func (*CreateResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{1} } type StartRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } func (m *StartRequest) Reset() { *m = StartRequest{} } @@ -104,7 +116,7 @@ func (*StartRequest) ProtoMessage() {} func (*StartRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{2} } type DeleteRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -112,9 +124,9 @@ func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{3} } type DeleteResponse struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"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"` + 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"` } func (m *DeleteResponse) Reset() { *m = DeleteResponse{} } @@ -122,31 +134,39 @@ func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{4} } type InfoRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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} } +type InfoResponse 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{6} } + type ListRequest struct { } func (m *ListRequest) Reset() { *m = ListRequest{} } func (*ListRequest) ProtoMessage() {} -func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{6} } +func (*ListRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{7} } type ListResponse struct { - Containers []*containerd_v1_types1.Container `protobuf:"bytes,1,rep,name=containers" json:"containers,omitempty"` + 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{7} } +func (*ListResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } type KillRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` + ContainerID string `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"` + Signal uint32 `protobuf:"varint,2,opt,name=signal,proto3" json:"signal,omitempty"` // Types that are valid to be assigned to PidOrAll: // *KillRequest_All // *KillRequest_Pid @@ -155,7 +175,7 @@ type KillRequest struct { func (m *KillRequest) Reset() { *m = KillRequest{} } func (*KillRequest) ProtoMessage() {} -func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{8} } +func (*KillRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } type isKillRequest_PidOrAll interface { isKillRequest_PidOrAll() @@ -267,20 +287,24 @@ type EventsRequest struct { func (m *EventsRequest) Reset() { *m = EventsRequest{} } func (*EventsRequest) ProtoMessage() {} -func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{9} } +func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{10} } type ExecRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"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"` - Spec *google_protobuf1.Any `protobuf:"bytes,6,opt,name=spec" json:"spec,omitempty"` + // 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"` + // 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{10} } +func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } type ExecResponse struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` @@ -288,62 +312,62 @@ type ExecResponse struct { func (m *ExecResponse) Reset() { *m = ExecResponse{} } func (*ExecResponse) ProtoMessage() {} -func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{11} } +func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{12} } type PtyRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"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"` + 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{12} } +func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } type CloseStdinRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + 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 *CloseStdinRequest) Reset() { *m = CloseStdinRequest{} } func (*CloseStdinRequest) ProtoMessage() {} -func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{13} } +func (*CloseStdinRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{14} } type PauseRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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{14} } +func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{15} } type ResumeRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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{15} } +func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{16} } type ProcessesRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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{16} } +func (*ProcessesRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{17} } type ProcessesResponse struct { - Processes []*containerd_v1_types1.Process `protobuf:"bytes,1,rep,name=processes" json:"processes,omitempty"` + 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{17} } +func (*ProcessesResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } type CheckpointRequest struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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"` @@ -355,37 +379,38 @@ type CheckpointRequest struct { func (m *CheckpointRequest) Reset() { *m = CheckpointRequest{} } func (*CheckpointRequest) ProtoMessage() {} -func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{18} } +func (*CheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{19} } type CheckpointResponse struct { - Descriptors []*containerd_v1_types2.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` + 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{19} } +func (*CheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptorExecution, []int{20} } func init() { - proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest") - proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.CreateResponse") - proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.StartRequest") - proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.DeleteRequest") - proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.DeleteResponse") - proto.RegisterType((*InfoRequest)(nil), "containerd.v1.services.InfoRequest") - proto.RegisterType((*ListRequest)(nil), "containerd.v1.services.ListRequest") - proto.RegisterType((*ListResponse)(nil), "containerd.v1.services.ListResponse") - proto.RegisterType((*KillRequest)(nil), "containerd.v1.services.KillRequest") - proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest") - proto.RegisterType((*ExecRequest)(nil), "containerd.v1.services.ExecRequest") - proto.RegisterType((*ExecResponse)(nil), "containerd.v1.services.ExecResponse") - proto.RegisterType((*PtyRequest)(nil), "containerd.v1.services.PtyRequest") - proto.RegisterType((*CloseStdinRequest)(nil), "containerd.v1.services.CloseStdinRequest") - proto.RegisterType((*PauseRequest)(nil), "containerd.v1.services.PauseRequest") - proto.RegisterType((*ResumeRequest)(nil), "containerd.v1.services.ResumeRequest") - proto.RegisterType((*ProcessesRequest)(nil), "containerd.v1.services.ProcessesRequest") - proto.RegisterType((*ProcessesResponse)(nil), "containerd.v1.services.ProcessesResponse") - proto.RegisterType((*CheckpointRequest)(nil), "containerd.v1.services.CheckpointRequest") - proto.RegisterType((*CheckpointResponse)(nil), "containerd.v1.services.CheckpointResponse") + 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((*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") } // Reference imports to suppress errors if they are not otherwise used. @@ -396,16 +421,16 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// Client API for ContainerService service +// Client API for Tasks service -type ContainerServiceClient interface { +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) - Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, 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) - Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, 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) @@ -415,74 +440,74 @@ type ContainerServiceClient interface { Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) } -type containerServiceClient struct { +type tasksClient struct { cc *grpc.ClientConn } -func NewContainerServiceClient(cc *grpc.ClientConn) ContainerServiceClient { - return &containerServiceClient{cc} +func NewTasksClient(cc *grpc.ClientConn) TasksClient { + return &tasksClient{cc} } -func (c *containerServiceClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { +func (c *tasksClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { out := new(CreateResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Create", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Create", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Start", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Start", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { +func (c *tasksClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Delete", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Delete", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, error) { - out := new(containerd_v1_types1.Container) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Info", in, out, c.cc, opts...) +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...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { +func (c *tasksClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { out := new(ListResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/List", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/List", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Kill(ctx context.Context, in *KillRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +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.ContainerService/Kill", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Kill", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error) { - stream, err := grpc.NewClientStream(ctx, &_ContainerService_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.ContainerService/Events", opts...) +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 := &containerServiceEventsClient{stream} + x := &tasksEventsClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -492,96 +517,96 @@ func (c *containerServiceClient) Events(ctx context.Context, in *EventsRequest, return x, nil } -type ContainerService_EventsClient interface { - Recv() (*containerd_v1_types1.Event, error) +type Tasks_EventsClient interface { + Recv() (*containerd_v1_types2.Event, error) grpc.ClientStream } -type containerServiceEventsClient struct { +type tasksEventsClient struct { grpc.ClientStream } -func (x *containerServiceEventsClient) Recv() (*containerd_v1_types1.Event, error) { - m := new(containerd_v1_types1.Event) +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 *containerServiceClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { +func (c *tasksClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) { out := new(ExecResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Exec", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Exec", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Pty", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Pty", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) CloseStdin(ctx context.Context, in *CloseStdinRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/CloseStdin", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/CloseStdin", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Pause", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Pause", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { +func (c *tasksClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { out := new(google_protobuf.Empty) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Resume", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Resume", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) { +func (c *tasksClient) Processes(ctx context.Context, in *ProcessesRequest, opts ...grpc.CallOption) (*ProcessesResponse, error) { out := new(ProcessesResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Processes", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Processes", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *containerServiceClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) { +func (c *tasksClient) Checkpoint(ctx context.Context, in *CheckpointRequest, opts ...grpc.CallOption) (*CheckpointResponse, error) { out := new(CheckpointResponse) - err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Checkpoint", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/containerd.v1.services.execution.Tasks/Checkpoint", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// Server API for ContainerService service +// Server API for Tasks service -type ContainerServiceServer interface { +type TasksServer interface { Create(context.Context, *CreateRequest) (*CreateResponse, error) Start(context.Context, *StartRequest) (*google_protobuf.Empty, error) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) - Info(context.Context, *InfoRequest) (*containerd_v1_types1.Container, error) + Info(context.Context, *InfoRequest) (*InfoResponse, error) List(context.Context, *ListRequest) (*ListResponse, error) Kill(context.Context, *KillRequest) (*google_protobuf.Empty, error) - Events(*EventsRequest, ContainerService_EventsServer) 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) @@ -591,326 +616,326 @@ type ContainerServiceServer interface { Checkpoint(context.Context, *CheckpointRequest) (*CheckpointResponse, error) } -func RegisterContainerServiceServer(s *grpc.Server, srv ContainerServiceServer) { - s.RegisterService(&_ContainerService_serviceDesc, srv) +func RegisterTasksServer(s *grpc.Server, srv TasksServer) { + s.RegisterService(&_Tasks_serviceDesc, srv) } -func _ContainerService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Create(ctx, in) + return srv.(TasksServer).Create(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Create", + FullMethod: "/containerd.v1.services.execution.Tasks/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Create(ctx, req.(*CreateRequest)) + return srv.(TasksServer).Create(ctx, req.(*CreateRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StartRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Start(ctx, in) + return srv.(TasksServer).Start(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Start", + FullMethod: "/containerd.v1.services.execution.Tasks/Start", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Start(ctx, req.(*StartRequest)) + return srv.(TasksServer).Start(ctx, req.(*StartRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Delete(ctx, in) + return srv.(TasksServer).Delete(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Delete", + FullMethod: "/containerd.v1.services.execution.Tasks/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Delete(ctx, req.(*DeleteRequest)) + return srv.(TasksServer).Delete(ctx, req.(*DeleteRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +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 { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Info(ctx, in) + return srv.(TasksServer).Info(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Info", + FullMethod: "/containerd.v1.services.execution.Tasks/Info", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Info(ctx, req.(*InfoRequest)) + return srv.(TasksServer).Info(ctx, req.(*InfoRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).List(ctx, in) + return srv.(TasksServer).List(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/List", + FullMethod: "/containerd.v1.services.execution.Tasks/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).List(ctx, req.(*ListRequest)) + return srv.(TasksServer).List(ctx, req.(*ListRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Kill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KillRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Kill(ctx, in) + return srv.(TasksServer).Kill(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Kill", + FullMethod: "/containerd.v1.services.execution.Tasks/Kill", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Kill(ctx, req.(*KillRequest)) + return srv.(TasksServer).Kill(ctx, req.(*KillRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Events_Handler(srv interface{}, stream grpc.ServerStream) error { +func _Tasks_Events_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(EventsRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ContainerServiceServer).Events(m, &containerServiceEventsServer{stream}) + return srv.(TasksServer).Events(m, &tasksEventsServer{stream}) } -type ContainerService_EventsServer interface { - Send(*containerd_v1_types1.Event) error +type Tasks_EventsServer interface { + Send(*containerd_v1_types2.Event) error grpc.ServerStream } -type containerServiceEventsServer struct { +type tasksEventsServer struct { grpc.ServerStream } -func (x *containerServiceEventsServer) Send(m *containerd_v1_types1.Event) error { +func (x *tasksEventsServer) Send(m *containerd_v1_types2.Event) error { return x.ServerStream.SendMsg(m) } -func _ContainerService_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ExecRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Exec(ctx, in) + return srv.(TasksServer).Exec(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Exec", + FullMethod: "/containerd.v1.services.execution.Tasks/Exec", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Exec(ctx, req.(*ExecRequest)) + return srv.(TasksServer).Exec(ctx, req.(*ExecRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PtyRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Pty(ctx, in) + return srv.(TasksServer).Pty(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Pty", + FullMethod: "/containerd.v1.services.execution.Tasks/Pty", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Pty(ctx, req.(*PtyRequest)) + return srv.(TasksServer).Pty(ctx, req.(*PtyRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_CloseStdin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CloseStdinRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).CloseStdin(ctx, in) + return srv.(TasksServer).CloseStdin(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/CloseStdin", + FullMethod: "/containerd.v1.services.execution.Tasks/CloseStdin", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).CloseStdin(ctx, req.(*CloseStdinRequest)) + return srv.(TasksServer).CloseStdin(ctx, req.(*CloseStdinRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Pause_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PauseRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Pause(ctx, in) + return srv.(TasksServer).Pause(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Pause", + FullMethod: "/containerd.v1.services.execution.Tasks/Pause", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Pause(ctx, req.(*PauseRequest)) + return srv.(TasksServer).Pause(ctx, req.(*PauseRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ResumeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Resume(ctx, in) + return srv.(TasksServer).Resume(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Resume", + FullMethod: "/containerd.v1.services.execution.Tasks/Resume", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Resume(ctx, req.(*ResumeRequest)) + return srv.(TasksServer).Resume(ctx, req.(*ResumeRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Processes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ProcessesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Processes(ctx, in) + return srv.(TasksServer).Processes(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Processes", + FullMethod: "/containerd.v1.services.execution.Tasks/Processes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Processes(ctx, req.(*ProcessesRequest)) + return srv.(TasksServer).Processes(ctx, req.(*ProcessesRequest)) } return interceptor(ctx, in, info, handler) } -func _ContainerService_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Tasks_Checkpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CheckpointRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ContainerServiceServer).Checkpoint(ctx, in) + return srv.(TasksServer).Checkpoint(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/containerd.v1.services.ContainerService/Checkpoint", + FullMethod: "/containerd.v1.services.execution.Tasks/Checkpoint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ContainerServiceServer).Checkpoint(ctx, req.(*CheckpointRequest)) + return srv.(TasksServer).Checkpoint(ctx, req.(*CheckpointRequest)) } return interceptor(ctx, in, info, handler) } -var _ContainerService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "containerd.v1.services.ContainerService", - HandlerType: (*ContainerServiceServer)(nil), +var _Tasks_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.v1.services.execution.Tasks", + HandlerType: (*TasksServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", - Handler: _ContainerService_Create_Handler, + Handler: _Tasks_Create_Handler, }, { MethodName: "Start", - Handler: _ContainerService_Start_Handler, + Handler: _Tasks_Start_Handler, }, { MethodName: "Delete", - Handler: _ContainerService_Delete_Handler, + Handler: _Tasks_Delete_Handler, }, { MethodName: "Info", - Handler: _ContainerService_Info_Handler, + Handler: _Tasks_Info_Handler, }, { MethodName: "List", - Handler: _ContainerService_List_Handler, + Handler: _Tasks_List_Handler, }, { MethodName: "Kill", - Handler: _ContainerService_Kill_Handler, + Handler: _Tasks_Kill_Handler, }, { MethodName: "Exec", - Handler: _ContainerService_Exec_Handler, + Handler: _Tasks_Exec_Handler, }, { MethodName: "Pty", - Handler: _ContainerService_Pty_Handler, + Handler: _Tasks_Pty_Handler, }, { MethodName: "CloseStdin", - Handler: _ContainerService_CloseStdin_Handler, + Handler: _Tasks_CloseStdin_Handler, }, { MethodName: "Pause", - Handler: _ContainerService_Pause_Handler, + Handler: _Tasks_Pause_Handler, }, { MethodName: "Resume", - Handler: _ContainerService_Resume_Handler, + Handler: _Tasks_Resume_Handler, }, { MethodName: "Processes", - Handler: _ContainerService_Processes_Handler, + Handler: _Tasks_Processes_Handler, }, { MethodName: "Checkpoint", - Handler: _ContainerService_Checkpoint_Handler, + Handler: _Tasks_Checkpoint_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Events", - Handler: _ContainerService_Events_Handler, + Handler: _Tasks_Events_Handler, ServerStreams: true, }, }, @@ -932,21 +957,11 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) - } - if m.Spec != nil { + if len(m.ContainerID) > 0 { dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(m.Spec.Size())) - n1, err := m.Spec.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if len(m.Rootfs) > 0 { for _, msg := range m.Rootfs { @@ -960,12 +975,6 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { i += n } } - if len(m.Runtime) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.Runtime))) - i += copy(dAtA[i:], m.Runtime) - } if len(m.Stdin) > 0 { dAtA[i] = 0x2a i++ @@ -998,11 +1007,11 @@ func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x4a i++ i = encodeVarintExecution(dAtA, i, uint64(m.Checkpoint.Size())) - n2, err := m.Checkpoint.MarshalTo(dAtA[i:]) + n1, err := m.Checkpoint.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n1 } return i, nil } @@ -1022,14 +1031,14 @@ func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { - dAtA[i] = 0xa + if len(m.ContainerID) > 0 { + dAtA[i] = 0x12 i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { - dAtA[i] = 0x10 + dAtA[i] = 0x18 i++ i = encodeVarintExecution(dAtA, i, uint64(m.Pid)) } @@ -1051,11 +1060,11 @@ func (m *StartRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } return i, nil } @@ -1075,11 +1084,11 @@ func (m *DeleteRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } return i, nil } @@ -1099,11 +1108,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.ExitStatus != 0 { dAtA[i] = 0x10 @@ -1113,11 +1122,11 @@ func (m *DeleteResponse) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintExecution(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) - n3, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) + n2, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err } - i += n3 + i += n2 return i, nil } @@ -1136,11 +1145,39 @@ func (m *InfoRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) + } + return i, nil +} + +func (m *InfoResponse) 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 *InfoResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Task != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintExecution(dAtA, i, uint64(m.Task.Size())) + n3, err := m.Task.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 } return i, nil } @@ -1178,8 +1215,8 @@ func (m *ListResponse) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Containers) > 0 { - for _, msg := range m.Containers { + if len(m.Tasks) > 0 { + for _, msg := range m.Tasks { dAtA[i] = 0xa i++ i = encodeVarintExecution(dAtA, i, uint64(msg.Size())) @@ -1208,11 +1245,11 @@ func (m *KillRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.Signal != 0 { dAtA[i] = 0x10 @@ -1281,11 +1318,11 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.Terminal { dAtA[i] = 0x10 @@ -1366,11 +1403,11 @@ func (m *PtyRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x10 @@ -1405,11 +1442,11 @@ func (m *CloseStdinRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.Pid != 0 { dAtA[i] = 0x10 @@ -1434,11 +1471,11 @@ func (m *PauseRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } return i, nil } @@ -1458,11 +1495,11 @@ func (m *ResumeRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } return i, nil } @@ -1482,11 +1519,11 @@ func (m *ProcessesRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } return i, nil } @@ -1536,11 +1573,11 @@ func (m *CheckpointRequest) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ID) > 0 { + if len(m.ContainerID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintExecution(dAtA, i, uint64(len(m.ID))) - i += copy(dAtA[i:], m.ID) + i = encodeVarintExecution(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } if m.AllowTcp { dAtA[i] = 0x10 @@ -1676,24 +1713,16 @@ func encodeVarintExecution(dAtA []byte, offset int, v uint64) int { func (m *CreateRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } - if m.Spec != nil { - l = m.Spec.Size() - n += 1 + l + sovExecution(uint64(l)) - } if len(m.Rootfs) > 0 { for _, e := range m.Rootfs { l = e.Size() n += 1 + l + sovExecution(uint64(l)) } } - l = len(m.Runtime) - if l > 0 { - n += 1 + l + sovExecution(uint64(l)) - } l = len(m.Stdin) if l > 0 { n += 1 + l + sovExecution(uint64(l)) @@ -1719,7 +1748,7 @@ func (m *CreateRequest) Size() (n int) { func (m *CreateResponse) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1732,7 +1761,7 @@ func (m *CreateResponse) Size() (n int) { func (m *StartRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1742,7 +1771,7 @@ func (m *StartRequest) Size() (n int) { func (m *DeleteRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1752,7 +1781,7 @@ func (m *DeleteRequest) Size() (n int) { func (m *DeleteResponse) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1767,13 +1796,23 @@ func (m *DeleteResponse) Size() (n int) { func (m *InfoRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } return n } +func (m *InfoResponse) Size() (n int) { + var l int + _ = l + if m.Task != nil { + l = m.Task.Size() + n += 1 + l + sovExecution(uint64(l)) + } + return n +} + func (m *ListRequest) Size() (n int) { var l int _ = l @@ -1783,8 +1822,8 @@ func (m *ListRequest) Size() (n int) { func (m *ListResponse) Size() (n int) { var l int _ = l - if len(m.Containers) > 0 { - for _, e := range m.Containers { + if len(m.Tasks) > 0 { + for _, e := range m.Tasks { l = e.Size() n += 1 + l + sovExecution(uint64(l)) } @@ -1795,7 +1834,7 @@ func (m *ListResponse) Size() (n int) { func (m *KillRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1829,7 +1868,7 @@ func (m *EventsRequest) Size() (n int) { func (m *ExecRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1867,7 +1906,7 @@ func (m *ExecResponse) Size() (n int) { func (m *PtyRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1886,7 +1925,7 @@ func (m *PtyRequest) Size() (n int) { func (m *CloseStdinRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1899,7 +1938,7 @@ func (m *CloseStdinRequest) Size() (n int) { func (m *PauseRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1909,7 +1948,7 @@ func (m *PauseRequest) Size() (n int) { func (m *ResumeRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1919,7 +1958,7 @@ func (m *ResumeRequest) Size() (n int) { func (m *ProcessesRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -1941,7 +1980,7 @@ func (m *ProcessesResponse) Size() (n int) { func (m *CheckpointRequest) Size() (n int) { var l int _ = l - l = len(m.ID) + l = len(m.ContainerID) if l > 0 { n += 1 + l + sovExecution(uint64(l)) } @@ -2003,15 +2042,13 @@ func (this *CreateRequest) String() string { return "nil" } s := strings.Join([]string{`&CreateRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, - `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Rootfs:` + strings.Replace(fmt.Sprintf("%v", this.Rootfs), "Mount", "containerd_v1_types.Mount", 1) + `,`, - `Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, - `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_v1_types2.Descriptor", 1) + `,`, + `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, `}`, }, "") return s @@ -2021,7 +2058,7 @@ func (this *CreateResponse) String() string { return "nil" } s := strings.Join([]string{`&CreateResponse{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") @@ -2032,7 +2069,7 @@ func (this *StartRequest) String() string { return "nil" } s := strings.Join([]string{`&StartRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s @@ -2042,7 +2079,7 @@ func (this *DeleteRequest) String() string { return "nil" } s := strings.Join([]string{`&DeleteRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s @@ -2052,7 +2089,7 @@ func (this *DeleteResponse) String() string { return "nil" } s := strings.Join([]string{`&DeleteResponse{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitedAt:` + strings.Replace(strings.Replace(this.ExitedAt.String(), "Timestamp", "google_protobuf3.Timestamp", 1), `&`, ``, 1) + `,`, `}`, @@ -2064,7 +2101,17 @@ func (this *InfoRequest) String() string { return "nil" } s := strings.Join([]string{`&InfoRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, + `}`, + }, "") + return s +} +func (this *InfoResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&InfoResponse{`, + `Task:` + strings.Replace(fmt.Sprintf("%v", this.Task), "Task", "containerd_v1_types2.Task", 1) + `,`, `}`, }, "") return s @@ -2083,7 +2130,7 @@ func (this *ListResponse) String() string { return "nil" } s := strings.Join([]string{`&ListResponse{`, - `Containers:` + strings.Replace(fmt.Sprintf("%v", this.Containers), "Container", "containerd_v1_types1.Container", 1) + `,`, + `Tasks:` + strings.Replace(fmt.Sprintf("%v", this.Tasks), "Task", "containerd_v1_types2.Task", 1) + `,`, `}`, }, "") return s @@ -2093,7 +2140,7 @@ func (this *KillRequest) String() string { return "nil" } s := strings.Join([]string{`&KillRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Signal:` + fmt.Sprintf("%v", this.Signal) + `,`, `PidOrAll:` + fmt.Sprintf("%v", this.PidOrAll) + `,`, `}`, @@ -2134,7 +2181,7 @@ func (this *ExecRequest) String() string { return "nil" } s := strings.Join([]string{`&ExecRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Stdin:` + fmt.Sprintf("%v", this.Stdin) + `,`, `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, @@ -2159,7 +2206,7 @@ func (this *PtyRequest) String() string { return "nil" } s := strings.Join([]string{`&PtyRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `Width:` + fmt.Sprintf("%v", this.Width) + `,`, `Height:` + fmt.Sprintf("%v", this.Height) + `,`, @@ -2172,7 +2219,7 @@ func (this *CloseStdinRequest) String() string { return "nil" } s := strings.Join([]string{`&CloseStdinRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `}`, }, "") @@ -2183,7 +2230,7 @@ func (this *PauseRequest) String() string { return "nil" } s := strings.Join([]string{`&PauseRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s @@ -2193,7 +2240,7 @@ func (this *ResumeRequest) String() string { return "nil" } s := strings.Join([]string{`&ResumeRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s @@ -2203,7 +2250,7 @@ func (this *ProcessesRequest) String() string { return "nil" } s := strings.Join([]string{`&ProcessesRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `}`, }, "") return s @@ -2213,7 +2260,7 @@ func (this *ProcessesResponse) String() string { return "nil" } s := strings.Join([]string{`&ProcessesResponse{`, - `Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types1.Process", 1) + `,`, + `Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types2.Process", 1) + `,`, `}`, }, "") return s @@ -2223,7 +2270,7 @@ func (this *CheckpointRequest) String() string { return "nil" } s := strings.Join([]string{`&CheckpointRequest{`, - `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `AllowTcp:` + fmt.Sprintf("%v", this.AllowTcp) + `,`, `AllowUnixSockets:` + fmt.Sprintf("%v", this.AllowUnixSockets) + `,`, `AllowTerminal:` + fmt.Sprintf("%v", this.AllowTerminal) + `,`, @@ -2240,7 +2287,7 @@ func (this *CheckpointResponse) String() string { return "nil" } s := strings.Join([]string{`&CheckpointResponse{`, - `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_v1_types2.Descriptor", 1) + `,`, + `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_v1_types1.Descriptor", 1) + `,`, `}`, }, "") return s @@ -2282,9 +2329,9 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: CreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2309,40 +2356,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { 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 Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowExecution - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthExecution - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Spec == nil { - m.Spec = &google_protobuf1.Any{} - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -2375,35 +2389,6 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - 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 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.Runtime = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Stdin", wireType) @@ -2538,7 +2523,7 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Checkpoint == nil { - m.Checkpoint = &containerd_v1_types2.Descriptor{} + m.Checkpoint = &containerd_v1_types1.Descriptor{} } if err := m.Checkpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2594,9 +2579,9 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: CreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2621,9 +2606,9 @@ func (m *CreateResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) } @@ -2694,7 +2679,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2719,7 +2704,7 @@ func (m *StartRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2773,7 +2758,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2798,7 +2783,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2852,7 +2837,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2877,7 +2862,7 @@ func (m *DeleteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -2980,7 +2965,7 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3005,7 +2990,90 @@ func (m *InfoRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 *InfoResponse) 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: InfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowExecution + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthExecution + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Task == nil { + m.Task = &containerd_v1_types2.Task{} + } + if err := m.Task.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3109,7 +3177,7 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tasks", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3133,8 +3201,8 @@ func (m *ListResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Containers = append(m.Containers, &containerd_v1_types1.Container{}) - if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tasks = append(m.Tasks, &containerd_v1_types2.Task{}) + if err := m.Tasks[len(m.Tasks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3190,7 +3258,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3215,7 +3283,7 @@ func (m *KillRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -3379,7 +3447,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3404,7 +3472,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -3667,7 +3735,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3692,7 +3760,7 @@ func (m *PtyRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -3803,7 +3871,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3828,7 +3896,7 @@ func (m *CloseStdinRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -3901,7 +3969,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3926,7 +3994,7 @@ func (m *PauseRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3980,7 +4048,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4005,7 +4073,7 @@ func (m *ResumeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4059,7 +4127,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4084,7 +4152,7 @@ func (m *ProcessesRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4162,7 +4230,7 @@ func (m *ProcessesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Processes = append(m.Processes, &containerd_v1_types1.Process{}) + m.Processes = append(m.Processes, &containerd_v1_types2.Process{}) if err := m.Processes[len(m.Processes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4219,7 +4287,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4244,7 +4312,7 @@ func (m *CheckpointRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ID = string(dAtA[iNdEx:postIndex]) + m.ContainerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -4480,7 +4548,7 @@ func (m *CheckpointResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Descriptors = append(m.Descriptors, &containerd_v1_types2.Descriptor{}) + m.Descriptors = append(m.Descriptors, &containerd_v1_types1.Descriptor{}) if err := m.Descriptors[len(m.Descriptors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4616,79 +4684,81 @@ func init() { } var fileDescriptorExecution = []byte{ - // 1173 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xae, 0x93, 0x34, 0x9b, 0x9c, 0x34, 0xdd, 0x74, 0x54, 0x55, 0xc6, 0x0b, 0x49, 0x64, 0xb6, - 0x4b, 0x5a, 0x81, 0x03, 0xe5, 0x6e, 0xc5, 0x8f, 0xfa, 0xc7, 0xb2, 0xda, 0xbf, 0xe2, 0x2e, 0xda, - 0xcb, 0xe0, 0xda, 0xd3, 0x74, 0x54, 0xc7, 0x63, 0x3c, 0xe3, 0x6e, 0x7b, 0xc7, 0x03, 0x70, 0xc1, - 0xab, 0xf0, 0x0a, 0x5c, 0xf5, 0x92, 0x4b, 0x84, 0x50, 0x61, 0xfb, 0x1e, 0x48, 0x68, 0xc6, 0x76, - 0xe2, 0xa4, 0x19, 0xdc, 0xde, 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xd0, 0x3c, 0x17, - 0x0a, 0xb4, 0x01, 0x2d, 0xc9, 0xd0, 0x83, 0xc0, 0x19, 0x61, 0x16, 0x3a, 0x2e, 0x66, 0x7a, 0xb5, - 0x5b, 0xee, 0xd5, 0xed, 0xfb, 0x52, 0xff, 0x72, 0xac, 0x46, 0x03, 0x58, 0x09, 0x9d, 0x08, 0x07, - 0x7c, 0x90, 0x83, 0x68, 0x09, 0xed, 0x3b, 0x5b, 0x02, 0x6d, 0xfe, 0xbc, 0xea, 0x6c, 0xe6, 0xb8, - 0x92, 0x86, 0x38, 0x98, 0x5c, 0xfb, 0xfe, 0x90, 0x7e, 0xe2, 0x91, 0x21, 0x66, 0xdc, 0xda, 0x93, - 0x7f, 0x76, 0x2b, 0x09, 0x36, 0xe9, 0x1d, 0x42, 0x50, 0x11, 0x58, 0x95, 0x92, 0x82, 0x3c, 0x9b, - 0x6f, 0x00, 0xe5, 0xbb, 0x9b, 0x0e, 0x6c, 0x1b, 0x1a, 0x13, 0x7e, 0xcd, 0x46, 0x56, 0xc8, 0x13, - 0x79, 0x9f, 0xad, 0x7f, 0x6b, 0xd0, 0x1a, 0x03, 0xd4, 0x61, 0xf2, 0xf9, 0x82, 0xde, 0x40, 0x35, - 0x61, 0x0f, 0xb4, 0x6e, 0xcd, 0xff, 0xc0, 0xb1, 0xa6, 0x18, 0xda, 0x78, 0x54, 0x64, 0x96, 0x26, - 0xbc, 0x0f, 0x8b, 0x92, 0x5a, 0xd0, 0x43, 0x95, 0x43, 0x9e, 0x79, 0x8c, 0xb5, 0x1b, 0x28, 0xb0, - 0x2f, 0x86, 0x21, 0xf2, 0x4b, 0xf8, 0x44, 0x9d, 0xdf, 0x14, 0x33, 0xa9, 0xf3, 0x9b, 0xa1, 0xa5, - 0x67, 0x50, 0x11, 0xd4, 0x80, 0x3e, 0x54, 0xd9, 0xe7, 0x88, 0xc3, 0x28, 0x40, 0x7b, 0xf4, 0x1d, - 0x54, 0x04, 0x63, 0xa8, 0x83, 0xe5, 0xe8, 0xc5, 0x78, 0xf8, 0xff, 0x46, 0x69, 0x7e, 0xbb, 0x50, - 0x11, 0xa4, 0xa1, 0x0e, 0x99, 0xa3, 0x14, 0x65, 0xf7, 0x5e, 0x40, 0x35, 0x21, 0x01, 0x75, 0xf7, - 0xa6, 0x48, 0xc2, 0x98, 0xff, 0xb5, 0x24, 0x6d, 0x3e, 0xd5, 0x44, 0x99, 0x02, 0x8e, 0xd5, 0x39, - 0xe5, 0xf8, 0x45, 0x5d, 0xe6, 0x14, 0xa2, 0x6f, 0x43, 0xf9, 0x80, 0x5f, 0x20, 0x53, 0x65, 0x3c, - 0x01, 0x77, 0x65, 0x91, 0xaf, 0x00, 0x26, 0xe0, 0x8c, 0x36, 0x94, 0xfb, 0x39, 0x0b, 0xe0, 0xca, - 0x80, 0xfb, 0xb0, 0x28, 0xe1, 0x5a, 0xbd, 0xba, 0x79, 0x34, 0x57, 0x86, 0x79, 0x02, 0xd5, 0x04, - 0xcd, 0xd5, 0xcd, 0x9f, 0x42, 0x7b, 0x65, 0xa0, 0x1f, 0xa0, 0x3e, 0x46, 0x70, 0xd4, 0x53, 0xe6, - 0x34, 0x43, 0x08, 0xc6, 0xc6, 0x2d, 0x2c, 0xd3, 0x29, 0xb8, 0x00, 0x39, 0x54, 0x52, 0xb7, 0x70, - 0x16, 0xf5, 0x8d, 0xcd, 0xdb, 0x98, 0x26, 0x2f, 0xd9, 0xd1, 0x2f, 0xdf, 0xb5, 0x17, 0xfe, 0x78, - 0xd7, 0x5e, 0xf8, 0xe9, 0xba, 0xad, 0x5d, 0x5e, 0xb7, 0xb5, 0xdf, 0xaf, 0xdb, 0xda, 0x3f, 0xd7, - 0x6d, 0xed, 0xa8, 0x2a, 0x0b, 0xfe, 0xfc, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x79, 0x3f, - 0x8c, 0xac, 0x0d, 0x00, 0x00, + // 1209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x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a, 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, } diff --git a/api/services/execution/execution.proto b/api/services/execution/execution.proto index 7a3e3ca7f..4aa3f3d6c 100644 --- a/api/services/execution/execution.proto +++ b/api/services/execution/execution.proto @@ -1,20 +1,20 @@ syntax = "proto3"; -package containerd.v1.services; +package containerd.v1.services.execution; import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "github.com/containerd/containerd/api/types/mount/mount.proto"; -import "github.com/containerd/containerd/api/types/container/container.proto"; import "github.com/containerd/containerd/api/types/descriptor/descriptor.proto"; +import "github.com/containerd/containerd/api/types/task/task.proto"; import "google/protobuf/timestamp.proto"; -service ContainerService { +service Tasks { rpc Create(CreateRequest) returns (CreateResponse); rpc Start(StartRequest) returns (google.protobuf.Empty); rpc Delete(DeleteRequest) returns (DeleteResponse); - rpc Info(InfoRequest) returns (containerd.v1.types.Container); + rpc Info(InfoRequest) returns (InfoResponse); rpc List(ListRequest) returns (ListResponse); rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); @@ -28,49 +28,76 @@ service ContainerService { } message CreateRequest { - string id = 1; - google.protobuf.Any spec = 2; + // 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 + // executing the container task. + // + // These are for mounts that cannot be performed in the user namespace. + // Typically, these mounts should be resolved from snapshots specified on + // the container object. repeated containerd.v1.types.Mount rootfs = 3; - string runtime = 4; + string stdin = 5; string stdout = 6; string stderr = 7; bool terminal = 8; + types.Descriptor checkpoint = 9; } message CreateResponse { - string id = 1; - uint32 pid = 2; + // 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 + // running. + // + // Hence, we are leaving this here and reserving the field number in case + // we need to move in this direction. + // string id = 1; + + string container_id = 2; + uint32 pid = 3; } message StartRequest { - string id = 1; + string container_id = 1; } message DeleteRequest { - string id = 1; + string container_id = 1; } message DeleteResponse { - string id = 1; + string container_id = 1; uint32 exit_status = 2; google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message InfoRequest { - string id = 1; + string container_id = 1; +} + +message InfoResponse { + types.Task task = 1; } message ListRequest { } message ListResponse { - repeated containerd.v1.types.Container containers = 1; + repeated containerd.v1.types.Task tasks = 1; } message KillRequest { - string id = 1; + string container_id = 1; uint32 signal = 2; oneof pid_or_all { bool all = 3; @@ -82,11 +109,16 @@ message EventsRequest { } message ExecRequest { - string id = 1; + // 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; + + // Spec for starting a process in the target container. + // + // For runc, this is a process spec, for example. google.protobuf.Any spec = 6; } @@ -95,27 +127,27 @@ message ExecResponse { } message PtyRequest { - string id = 1; + string container_id = 1; uint32 pid = 2; uint32 width = 3; uint32 height = 4; } message CloseStdinRequest { - string id = 1; + string container_id = 1; uint32 pid = 2; } message PauseRequest { - string id = 1; + string container_id = 1; } message ResumeRequest { - string id = 1; + string container_id = 1; } message ProcessesRequest { - string id = 1; + string container_id = 1; } message ProcessesResponse{ @@ -123,7 +155,7 @@ message ProcessesResponse{ } message CheckpointRequest { - string id = 1; + string container_id = 1; bool allow_tcp = 2; bool allow_unix_sockets = 3; bool allow_terminal = 4; diff --git a/api/services/images/images.pb.go b/api/services/images/images.pb.go index 63bfcde1d..451a9a1d1 100644 --- a/api/services/images/images.pb.go +++ b/api/services/images/images.pb.go @@ -50,7 +50,8 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type Image struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Target containerd_v1_types1.Descriptor `protobuf:"bytes,2,opt,name=target" json:"target"` + 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"` } func (m *Image) Reset() { *m = Image{} } @@ -127,11 +128,11 @@ const _ = grpc.SupportPackageIsVersion4 type ImagesClient interface { // Get returns an image by name. Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, 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 // image. Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) - // List returns a list of all images known to containerd. - List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) // Delete deletes the image by name. Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) } @@ -153,18 +154,18 @@ func (c *imagesClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.Cal 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) 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...) 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) 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...) if err != nil { return nil, err } @@ -185,11 +186,11 @@ 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) + // 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 // image. Put(context.Context, *PutRequest) (*google_protobuf1.Empty, error) - // List returns a list of all images known to containerd. - List(context.Context, *ListRequest) (*ListResponse, error) // Delete deletes the image by name. Delete(context.Context, *DeleteRequest) (*google_protobuf1.Empty, error) } @@ -216,24 +217,6 @@ func _Images_Get_Handler(srv interface{}, ctx context.Context, dec func(interfac 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) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ImagesServer).Put(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/containerd.v1.Images/Put", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ImagesServer).Put(ctx, req.(*PutRequest)) - } - 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) if err := dec(in); err != nil { @@ -252,6 +235,24 @@ func _Images_List_Handler(srv interface{}, ctx context.Context, dec func(interfa 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) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ImagesServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.v1.Images/Put", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ImagesServer).Put(ctx, req.(*PutRequest)) + } + 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) if err := dec(in); err != nil { @@ -278,14 +279,14 @@ var _Images_serviceDesc = grpc.ServiceDesc{ MethodName: "Get", Handler: _Images_Get_Handler, }, - { - MethodName: "Put", - Handler: _Images_Put_Handler, - }, { MethodName: "List", Handler: _Images_List_Handler, }, + { + MethodName: "Put", + Handler: _Images_Put_Handler, + }, { MethodName: "Delete", Handler: _Images_Delete_Handler, @@ -316,7 +317,13 @@ func (m *Image) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintImages(dAtA, i, uint64(len(m.Name))) i += copy(dAtA[i:], m.Name) } - dAtA[i] = 0x12 + if len(m.Labels) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintImages(dAtA, i, uint64(len(m.Labels))) + i += copy(dAtA[i:], m.Labels) + } + dAtA[i] = 0x1a i++ i = encodeVarintImages(dAtA, i, uint64(m.Target.Size())) n1, err := m.Target.MarshalTo(dAtA[i:]) @@ -511,6 +518,10 @@ 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)) + } l = m.Target.Size() n += 1 + l + sovImages(uint64(l)) return n @@ -591,6 +602,7 @@ func (this *Image) String() string { } 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) + `,`, `}`, }, "") @@ -722,6 +734,35 @@ func (m *Image) Unmarshal(dAtA []byte) error { 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 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.Labels = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) } @@ -1334,32 +1375,32 @@ func init() { } var fileDescriptorImages = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xcd, 0x36, 0xa9, 0x25, 0xc6, 0xe4, 0xb2, 0xaa, 0x90, 0x71, 0x91,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, 0x8f, 0xcc, 0x5b, 0x8f, 0x7c, 0x6f, 0x3d, 0xf2, 0xab, 0xf5, - 0xc8, 0xd4, 0x52, 0xc8, 0xe7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x45, 0x0e, 0x92, 0xb1, 0xa2, - 0x03, 0x00, 0x00, + // 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, 0x1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a, 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, } diff --git a/api/services/images/images.proto b/api/services/images/images.proto index ec678826f..176caccb6 100644 --- a/api/services/images/images.proto +++ b/api/services/images/images.proto @@ -22,20 +22,21 @@ service Images { // Get returns an image by name. rpc Get(GetRequest) returns (GetResponse); + // List returns a list of all images known to containerd. + rpc List(ListRequest) returns (ListResponse); + // Put assigns the name to a given target image based on the provided // image. rpc Put(PutRequest) returns (google.protobuf.Empty); - // List returns a list of all images known to containerd. - rpc List(ListRequest) returns (ListResponse); - // Delete deletes the image by name. rpc Delete(DeleteRequest) returns (google.protobuf.Empty); } message Image { string name = 1; - types.Descriptor target = 2 [(gogoproto.nullable) = false]; + string labels = 2; + types.Descriptor target = 3 [(gogoproto.nullable) = false]; } message GetRequest { diff --git a/api/services/shim/shim.pb.go b/api/services/shim/shim.pb.go index 85b9ee30e..5c39effd0 100644 --- a/api/services/shim/shim.pb.go +++ b/api/services/shim/shim.pb.go @@ -39,7 +39,7 @@ import google_protobuf "github.com/gogo/protobuf/types" import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" import _ "github.com/gogo/protobuf/gogoproto" import containerd_v1_types "github.com/containerd/containerd/api/types/mount" -import containerd_v1_types1 "github.com/containerd/containerd/api/types/container" +import containerd_v1_types1 "github.com/containerd/containerd/api/types/task" import _ "github.com/gogo/protobuf/types" import time "time" @@ -4251,76 +4251,76 @@ func init() { } var fileDescriptorShim = []byte{ - // 1125 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcb, 0x72, 0xe3, 0x44, - 0x17, 0x1e, 0xd9, 0x8e, 0xc7, 0x3e, 0x1e, 0xe7, 0xd2, 0x95, 0x4a, 0x69, 0x9c, 0xff, 0x77, 0x82, - 0xaa, 0xa6, 0x70, 0x32, 0x20, 0x43, 0x66, 0x47, 0xc1, 0x22, 0x37, 0x8a, 0x81, 0x00, 0xae, 0x4e, - 0x58, 0x51, 0x85, 0x4b, 0x91, 0x3b, 0x76, 0x13, 0x49, 0x2d, 0xd4, 0xad, 0x4c, 0xb2, 0xe3, 0x11, - 0xd8, 0xf2, 0x24, 0xec, 0x59, 0x65, 0xc9, 0x0e, 0x56, 0x03, 0x93, 0xb7, 0x60, 0x47, 0xf5, 0x45, - 0xb2, 0x9d, 0x44, 0x76, 0xb2, 0x71, 0x9d, 0x73, 0xfa, 0xeb, 0xa3, 0x73, 0xfd, 0xda, 0xf0, 0xd9, - 0x90, 0x8a, 0x51, 0x7a, 0xea, 0xfa, 0x2c, 0xec, 0xfa, 0x2c, 0x12, 0x1e, 0x8d, 0x48, 0x32, 0x98, - 0x14, 0xbd, 0x98, 0x76, 0x39, 0x49, 0x2e, 0xa8, 0x4f, 0x78, 0x97, 0x8f, 0x68, 0xa8, 0x7e, 0xdc, - 0x38, 0x61, 0x82, 0xa1, 0xf5, 0x31, 0xd0, 0xbd, 0xf8, 0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33, 0xff, 0xcf, 0xd0, 0xda, 0x7a, 0x00, 0xd2, 0x0c, - 0xcd, 0xe7, 0x50, 0xee, 0x89, 0x2b, 0xf4, 0xfe, 0xec, 0x91, 0xc9, 0x1f, 0xe3, 0x99, 0x2d, 0xce, - 0xdf, 0x80, 0x79, 0x2d, 0xbe, 0xfd, 0x58, 0x14, 0x79, 0xdd, 0xb3, 0xaf, 0xdf, 0xb5, 0x9f, 0xfc, - 0xf5, 0xae, 0xfd, 0xe4, 0xe7, 0x9b, 0xb6, 0x75, 0x7d, 0xd3, 0xb6, 0xfe, 0xb8, 0x69, 0x5b, 0xff, - 0xdc, 0xb4, 0xad, 0xd3, 0xaa, 0x42, 0xbe, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x44, 0x45, - 0xe4, 0xa5, 0x0c, 0x00, 0x00, + // 1126 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x5f, 0x27, 0x69, 0x36, 0x79, 0xd9, 0x74, 0xdb, 0x51, 0x55, 0x79, 0x53, 0x48, 0x8b, 0xa5, + 0x15, 0x69, 0x17, 0x1c, 0xe8, 0xde, 0x56, 0x70, 0xe8, 0x3f, 0xc4, 0x42, 0x81, 0x68, 0x5a, 0x4e, + 0x48, 0x44, 0xae, 0x33, 0x4d, 0x86, 0xda, 0x1e, 0xe3, 0x19, 0x77, 0xdb, 0x1b, 0x1f, 0x81, 0x2b, + 0x9f, 0x84, 0x3b, 0xa7, 0x1e, 0xb9, 0xc1, 0x69, 0x61, 0xfb, 0x2d, 0xb8, 0xa1, 0xf9, 0x63, 0x27, + 0x69, 0xeb, 0xa4, 0xbd, 0x58, 0xf3, 0xde, 0xfc, 0xe6, 0xcd, 0xfb, 0xfb, 0x1b, 0xc3, 0xe7, 0x43, + 0x2a, 0x46, 0xe9, 0x89, 0xeb, 0xb3, 0xb0, 0xeb, 0xb3, 0x48, 0x78, 0x34, 0x22, 0xc9, 0x60, 0x72, + 0xe9, 0xc5, 0xb4, 0xcb, 0x49, 0x72, 0x4e, 0x7d, 0xc2, 0xbb, 0x7c, 0x44, 0x43, 0xf5, 0x71, 0xe3, + 0x84, 0x09, 0x86, 0xd6, 0xc6, 0x40, 0xf7, 0xfc, 0x53, 0x37, 0xc3, 0xb9, 0x12, 0xd2, 0x7a, 0x36, + 0x64, 0x6c, 0x18, 0x90, 0xae, 0x82, 0x9e, 0xa4, 0xa7, 0x5d, 0x2f, 0xba, 0xd4, 0xe7, 0x5a, 0x6b, + 0x37, 0xb7, 0x48, 0x18, 0x8b, 0x6c, 0x73, 0x65, 0xc8, 0x86, 0x4c, 0x2d, 0xbb, 0x72, 0x65, 0xb4, + 0x9f, 0xdd, 0xcb, 0x53, 0x71, 0x19, 0x13, 0xde, 0x0d, 0x59, 0x1a, 0x09, 0xfd, 0x35, 0xa7, 0x5f, + 0x3d, 0xe0, 0xb4, 0xf0, 0xf8, 0x99, 0xfa, 0x98, 0xb3, 0xeb, 0x37, 0x9d, 0x15, 0x34, 0x24, 0x5c, + 0x78, 0x61, 0xac, 0x01, 0xce, 0x5f, 0x25, 0x68, 0xee, 0x25, 0xc4, 0x13, 0x04, 0x93, 0x9f, 0x53, + 0xc2, 0x05, 0x5a, 0x85, 0x12, 0x1d, 0xd8, 0xd6, 0x86, 0xd5, 0xa9, 0xef, 0x56, 0xaf, 0xdf, 0xae, + 0x97, 0x5e, 0xef, 0xe3, 0x12, 0x1d, 0xa0, 0x55, 0xa8, 0x9e, 0xa4, 0xd1, 0x20, 0x20, 0x76, 0x49, + 0xee, 0x61, 0x23, 0x21, 0x1b, 0x1e, 0x27, 0x69, 0x24, 0xed, 0xda, 0x65, 0xb5, 0x91, 0x89, 0xe8, + 0x19, 0xd4, 0x22, 0xd6, 0x8f, 0xe9, 0x39, 0x13, 0x76, 0x65, 0xc3, 0xea, 0xd4, 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 0xf5, 0x0b, 0x31, 0x27, 0xda, 0xa9, 0x67, 0xa4, 0x75, + 0xf7, 0x7f, 0x8e, 0xc2, 0x7c, 0x62, 0x49, 0xef, 0x24, 0xbf, 0xce, 0xf1, 0x6e, 0x82, 0x82, 0x0b, + 0xbd, 0xfb, 0x41, 0xc6, 0x49, 0xfc, 0xb9, 0x71, 0xe6, 0xff, 0x0c, 0xad, 0xcd, 0x7b, 0x20, 0x4d, + 0xd3, 0x7c, 0x01, 0xe5, 0x9e, 0xb8, 0x44, 0x1f, 0xce, 0x6e, 0x99, 0xfc, 0x31, 0x9e, 0x59, 0xe2, + 0xfc, 0x0d, 0x98, 0x57, 0xe2, 0x9b, 0x8f, 0x45, 0x91, 0xd5, 0x5d, 0xfb, 0xea, 0x5d, 0xfb, 0xd1, + 0xdf, 0xef, 0xda, 0x8f, 0x7e, 0xb9, 0x6e, 0x5b, 0x57, 0xd7, 0x6d, 0xeb, 0xcf, 0xeb, 0xb6, 0xf5, + 0xef, 0x75, 0xdb, 0x3a, 0xa9, 0x2a, 0xe4, 0xcb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xef, 0xf8, + 0x34, 0x69, 0x9b, 0x0c, 0x00, 0x00, } diff --git a/api/services/shim/shim.proto b/api/services/shim/shim.proto index 62cbe5227..6848412f5 100644 --- a/api/services/shim/shim.proto +++ b/api/services/shim/shim.proto @@ -6,7 +6,7 @@ import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; import "gogoproto/gogo.proto"; import "github.com/containerd/containerd/api/types/mount/mount.proto"; -import "github.com/containerd/containerd/api/types/container/container.proto"; +import "github.com/containerd/containerd/api/types/task/task.proto"; import "google/protobuf/timestamp.proto"; // Shim service is launched for each container and is responsible for owning the IO diff --git a/api/types/container/container.pb.go b/api/types/task/task.pb.go similarity index 72% rename from api/types/container/container.pb.go rename to api/types/task/task.pb.go index 58c8cf640..cb8775ef4 100644 --- a/api/types/container/container.pb.go +++ b/api/types/task/task.pb.go @@ -1,20 +1,20 @@ // Code generated by protoc-gen-gogo. -// source: github.com/containerd/containerd/api/types/container/container.proto +// source: github.com/containerd/containerd/api/types/task/task.proto // DO NOT EDIT! /* - Package container is a generated protocol buffer package. + Package task is a generated protocol buffer package. It is generated from these files: - github.com/containerd/containerd/api/types/container/container.proto + github.com/containerd/containerd/api/types/task/task.proto It has these top-level messages: - Container + Task Process User Event */ -package container +package task import proto "github.com/gogo/protobuf/proto" import fmt "fmt" @@ -72,7 +72,7 @@ var Status_value = map[string]int32{ func (x Status) String() string { return proto.EnumName(Status_name, int32(x)) } -func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} } +func (Status) EnumDescriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } type Event_EventType int32 @@ -105,18 +105,19 @@ var Event_EventType_value = map[string]int32{ func (x Event_EventType) String() string { return proto.EnumName(Event_EventType_name, int32(x)) } -func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorContainer, []int{3, 0} } +func (Event_EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorTask, []int{3, 0} } -type Container struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` - Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"` - Spec *google_protobuf1.Any `protobuf:"bytes,4,opt,name=spec" json:"spec,omitempty"` +type Task struct { + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + 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"` + 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"` } -func (m *Container) Reset() { *m = Container{} } -func (*Container) ProtoMessage() {} -func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} } +func (m *Task) Reset() { *m = Task{} } +func (*Task) ProtoMessage() {} +func (*Task) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{0} } type Process struct { Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` @@ -132,7 +133,7 @@ type Process struct { func (m *Process) Reset() { *m = Process{} } func (*Process) ProtoMessage() {} -func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{1} } +func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{1} } type User struct { Uid uint32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` @@ -142,7 +143,7 @@ type User struct { func (m *User) Reset() { *m = User{} } func (*User) ProtoMessage() {} -func (*User) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} } +func (*User) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{2} } type Event struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -154,17 +155,17 @@ type Event struct { func (m *Event) Reset() { *m = Event{} } func (*Event) ProtoMessage() {} -func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{3} } +func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorTask, []int{3} } func init() { - proto.RegisterType((*Container)(nil), "containerd.v1.types.Container") + proto.RegisterType((*Task)(nil), "containerd.v1.types.Task") proto.RegisterType((*Process)(nil), "containerd.v1.types.Process") proto.RegisterType((*User)(nil), "containerd.v1.types.User") proto.RegisterType((*Event)(nil), "containerd.v1.types.Event") proto.RegisterEnum("containerd.v1.types.Status", Status_name, Status_value) proto.RegisterEnum("containerd.v1.types.Event_EventType", Event_EventType_name, Event_EventType_value) } -func (m *Container) Marshal() (dAtA []byte, err error) { +func (m *Task) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -174,7 +175,7 @@ func (m *Container) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Container) MarshalTo(dAtA []byte) (int, error) { +func (m *Task) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -182,23 +183,29 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) { if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.ID))) + i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } - if m.Pid != 0 { - dAtA[i] = 0x10 + if len(m.ContainerID) > 0 { + dAtA[i] = 0x12 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Pid)) + i = encodeVarintTask(dAtA, i, uint64(len(m.ContainerID))) + i += copy(dAtA[i:], m.ContainerID) } - if m.Status != 0 { + if m.Pid != 0 { dAtA[i] = 0x18 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Status)) + i = encodeVarintTask(dAtA, i, uint64(m.Pid)) + } + if m.Status != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintTask(dAtA, i, uint64(m.Status)) } if m.Spec != nil { - dAtA[i] = 0x22 + dAtA[i] = 0x2a i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Spec.Size())) + i = encodeVarintTask(dAtA, i, uint64(m.Spec.Size())) n1, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -226,7 +233,7 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { if m.Pid != 0 { dAtA[i] = 0x8 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Pid)) + i = encodeVarintTask(dAtA, i, uint64(m.Pid)) } if len(m.Args) > 0 { for _, s := range m.Args { @@ -261,7 +268,7 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { if m.User != nil { dAtA[i] = 0x22 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.User.Size())) + i = encodeVarintTask(dAtA, i, uint64(m.User.Size())) n2, err := m.User.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -271,7 +278,7 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { if len(m.Cwd) > 0 { dAtA[i] = 0x2a i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.Cwd))) + i = encodeVarintTask(dAtA, i, uint64(len(m.Cwd))) i += copy(dAtA[i:], m.Cwd) } if m.Terminal { @@ -287,17 +294,17 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) { if m.ExitStatus != 0 { dAtA[i] = 0x38 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.ExitStatus)) + i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) } if m.Status != 0 { dAtA[i] = 0x40 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Status)) + i = encodeVarintTask(dAtA, i, uint64(m.Status)) } if m.RuntimeData != nil { dAtA[i] = 0x4a i++ - i = encodeVarintContainer(dAtA, i, uint64(m.RuntimeData.Size())) + i = encodeVarintTask(dAtA, i, uint64(m.RuntimeData.Size())) n3, err := m.RuntimeData.MarshalTo(dAtA[i:]) if err != nil { return 0, err @@ -325,12 +332,12 @@ func (m *User) MarshalTo(dAtA []byte) (int, error) { if m.Uid != 0 { dAtA[i] = 0x8 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Uid)) + i = encodeVarintTask(dAtA, i, uint64(m.Uid)) } if m.Gid != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Gid)) + i = encodeVarintTask(dAtA, i, uint64(m.Gid)) } if len(m.AdditionalGids) > 0 { dAtA5 := make([]byte, len(m.AdditionalGids)*10) @@ -346,7 +353,7 @@ func (m *User) MarshalTo(dAtA []byte) (int, error) { } dAtA[i] = 0x1a i++ - i = encodeVarintContainer(dAtA, i, uint64(j4)) + i = encodeVarintTask(dAtA, i, uint64(j4)) i += copy(dAtA[i:], dAtA5[:j4]) } return i, nil @@ -370,27 +377,27 @@ func (m *Event) MarshalTo(dAtA []byte) (int, error) { if len(m.ID) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintContainer(dAtA, i, uint64(len(m.ID))) + i = encodeVarintTask(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } if m.Type != 0 { dAtA[i] = 0x10 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Type)) + i = encodeVarintTask(dAtA, i, uint64(m.Type)) } if m.Pid != 0 { dAtA[i] = 0x18 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.Pid)) + i = encodeVarintTask(dAtA, i, uint64(m.Pid)) } if m.ExitStatus != 0 { dAtA[i] = 0x20 i++ - i = encodeVarintContainer(dAtA, i, uint64(m.ExitStatus)) + i = encodeVarintTask(dAtA, i, uint64(m.ExitStatus)) } dAtA[i] = 0x2a i++ - i = encodeVarintContainer(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) + i = encodeVarintTask(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt))) n6, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i:]) if err != nil { return 0, err @@ -399,7 +406,7 @@ func (m *Event) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Container(dAtA []byte, offset int, v uint64) int { +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) @@ -410,14 +417,14 @@ func encodeFixed64Container(dAtA []byte, offset int, v uint64) int { dAtA[offset+7] = uint8(v >> 56) return offset + 8 } -func encodeFixed32Container(dAtA []byte, offset int, v uint32) int { +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 encodeVarintContainer(dAtA []byte, offset int, v uint64) int { +func encodeVarintTask(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 @@ -426,22 +433,26 @@ func encodeVarintContainer(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *Container) Size() (n int) { +func (m *Task) Size() (n int) { var l int _ = l l = len(m.ID) if l > 0 { - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) + } + l = len(m.ContainerID) + if l > 0 { + n += 1 + l + sovTask(uint64(l)) } if m.Pid != 0 { - n += 1 + sovContainer(uint64(m.Pid)) + n += 1 + sovTask(uint64(m.Pid)) } if m.Status != 0 { - n += 1 + sovContainer(uint64(m.Status)) + n += 1 + sovTask(uint64(m.Status)) } if m.Spec != nil { l = m.Spec.Size() - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } return n } @@ -450,40 +461,40 @@ func (m *Process) Size() (n int) { var l int _ = l if m.Pid != 0 { - n += 1 + sovContainer(uint64(m.Pid)) + n += 1 + sovTask(uint64(m.Pid)) } if len(m.Args) > 0 { for _, s := range m.Args { l = len(s) - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } } if len(m.Env) > 0 { for _, s := range m.Env { l = len(s) - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } } if m.User != nil { l = m.User.Size() - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } l = len(m.Cwd) if l > 0 { - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } if m.Terminal { n += 2 } if m.ExitStatus != 0 { - n += 1 + sovContainer(uint64(m.ExitStatus)) + n += 1 + sovTask(uint64(m.ExitStatus)) } if m.Status != 0 { - n += 1 + sovContainer(uint64(m.Status)) + n += 1 + sovTask(uint64(m.Status)) } if m.RuntimeData != nil { l = m.RuntimeData.Size() - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } return n } @@ -492,17 +503,17 @@ func (m *User) Size() (n int) { var l int _ = l if m.Uid != 0 { - n += 1 + sovContainer(uint64(m.Uid)) + n += 1 + sovTask(uint64(m.Uid)) } if m.Gid != 0 { - n += 1 + sovContainer(uint64(m.Gid)) + n += 1 + sovTask(uint64(m.Gid)) } if len(m.AdditionalGids) > 0 { l = 0 for _, e := range m.AdditionalGids { - l += sovContainer(uint64(e)) + l += sovTask(uint64(e)) } - n += 1 + sovContainer(uint64(l)) + l + n += 1 + sovTask(uint64(l)) + l } return n } @@ -512,23 +523,23 @@ func (m *Event) Size() (n int) { _ = l l = len(m.ID) if l > 0 { - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) } if m.Type != 0 { - n += 1 + sovContainer(uint64(m.Type)) + n += 1 + sovTask(uint64(m.Type)) } if m.Pid != 0 { - n += 1 + sovContainer(uint64(m.Pid)) + n += 1 + sovTask(uint64(m.Pid)) } if m.ExitStatus != 0 { - n += 1 + sovContainer(uint64(m.ExitStatus)) + n += 1 + sovTask(uint64(m.ExitStatus)) } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) - n += 1 + l + sovContainer(uint64(l)) + n += 1 + l + sovTask(uint64(l)) return n } -func sovContainer(x uint64) (n int) { +func sovTask(x uint64) (n int) { for { n++ x >>= 7 @@ -538,15 +549,16 @@ func sovContainer(x uint64) (n int) { } return n } -func sozContainer(x uint64) (n int) { - return sovContainer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozTask(x uint64) (n int) { + return sovTask(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *Container) String() string { +func (this *Task) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Container{`, + s := strings.Join([]string{`&Task{`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `ContainerID:` + fmt.Sprintf("%v", this.ContainerID) + `,`, `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) + `,`, @@ -598,7 +610,7 @@ func (this *Event) String() string { }, "") return s } -func valueToStringContainer(v interface{}) string { +func valueToStringTask(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" @@ -606,7 +618,7 @@ func valueToStringContainer(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *Container) Unmarshal(dAtA []byte) error { +func (m *Task) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -614,7 +626,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -629,10 +641,10 @@ func (m *Container) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Container: wiretype end group for non-group") + return fmt.Errorf("proto: Task: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Task: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -642,7 +654,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -656,7 +668,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + intStringLen if postIndex > l { @@ -665,13 +677,42 @@ func (m *Container) Unmarshal(dAtA []byte) error { m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + 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 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 ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -683,14 +724,14 @@ func (m *Container) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -702,14 +743,14 @@ func (m *Container) Unmarshal(dAtA []byte) error { break } } - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -722,7 +763,7 @@ func (m *Container) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + msglen if postIndex > l { @@ -737,12 +778,12 @@ func (m *Container) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipContainer(dAtA[iNdEx:]) + skippy, err := skipTask(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -764,7 +805,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -792,7 +833,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -811,7 +852,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -825,7 +866,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + intStringLen if postIndex > l { @@ -840,7 +881,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -854,7 +895,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + intStringLen if postIndex > l { @@ -869,7 +910,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -882,7 +923,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + msglen if postIndex > l { @@ -902,7 +943,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -916,7 +957,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + intStringLen if postIndex > l { @@ -931,7 +972,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -951,7 +992,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { m.ExitStatus = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -970,7 +1011,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -989,7 +1030,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1002,7 +1043,7 @@ func (m *Process) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + msglen if postIndex > l { @@ -1017,12 +1058,12 @@ func (m *Process) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipContainer(dAtA[iNdEx:]) + skippy, err := skipTask(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1044,7 +1085,7 @@ func (m *User) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1072,7 +1113,7 @@ func (m *User) Unmarshal(dAtA []byte) error { m.Uid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1091,7 +1132,7 @@ func (m *User) Unmarshal(dAtA []byte) error { m.Gid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1108,7 +1149,7 @@ func (m *User) Unmarshal(dAtA []byte) error { var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1125,7 +1166,7 @@ func (m *User) Unmarshal(dAtA []byte) error { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1138,7 +1179,7 @@ func (m *User) Unmarshal(dAtA []byte) error { } } if packedLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + packedLen if postIndex > l { @@ -1148,7 +1189,7 @@ func (m *User) Unmarshal(dAtA []byte) error { var v uint32 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1167,12 +1208,12 @@ func (m *User) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipContainer(dAtA[iNdEx:]) + skippy, err := skipTask(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1194,7 +1235,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1222,7 +1263,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1236,7 +1277,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + intStringLen if postIndex > l { @@ -1251,7 +1292,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { m.Type = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1270,7 +1311,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { m.Pid = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1289,7 +1330,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { m.ExitStatus = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1308,7 +1349,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowContainer + return ErrIntOverflowTask } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1321,7 +1362,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } postIndex := iNdEx + msglen if postIndex > l { @@ -1333,12 +1374,12 @@ func (m *Event) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipContainer(dAtA[iNdEx:]) + skippy, err := skipTask(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthContainer + return ErrInvalidLengthTask } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1352,14 +1393,14 @@ func (m *Event) Unmarshal(dAtA []byte) error { } return nil } -func skipContainer(dAtA []byte) (n int, err error) { +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, ErrIntOverflowContainer + return 0, ErrIntOverflowTask } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1376,7 +1417,7 @@ func skipContainer(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowContainer + return 0, ErrIntOverflowTask } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1394,7 +1435,7 @@ func skipContainer(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowContainer + return 0, ErrIntOverflowTask } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1408,7 +1449,7 @@ func skipContainer(dAtA []byte) (n int, err error) { } iNdEx += length if length < 0 { - return 0, ErrInvalidLengthContainer + return 0, ErrInvalidLengthTask } return iNdEx, nil case 3: @@ -1417,7 +1458,7 @@ func skipContainer(dAtA []byte) (n int, err error) { var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowContainer + return 0, ErrIntOverflowTask } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1433,7 +1474,7 @@ func skipContainer(dAtA []byte) (n int, err error) { if innerWireType == 4 { break } - next, err := skipContainer(dAtA[start:]) + next, err := skipTask(dAtA[start:]) if err != nil { return 0, err } @@ -1453,58 +1494,59 @@ func skipContainer(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthContainer = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowContainer = fmt.Errorf("proto: integer overflow") + 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/container/container.proto", fileDescriptorContainer) + proto.RegisterFile("github.com/containerd/containerd/api/types/task/task.proto", fileDescriptorTask) } -var fileDescriptorContainer = []byte{ - // 694 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xbf, 0x6f, 0xdb, 0x46, - 0x18, 0xd5, 0x91, 0xd4, 0xaf, 0x93, 0xad, 0xb2, 0x57, 0xa3, 0xa0, 0xd5, 0x82, 0x22, 0x84, 0x02, - 0x15, 0x0a, 0x94, 0x42, 0xe5, 0xa1, 0x5d, 0x65, 0x91, 0x30, 0x8c, 0x22, 0x92, 0x42, 0x49, 0x88, - 0x37, 0xe1, 0x2c, 0x5e, 0x18, 0x22, 0xd6, 0x91, 0x20, 0x8f, 0x76, 0xb4, 0x65, 0x0c, 0x3c, 0x65, - 0xc8, 0xea, 0x25, 0xc9, 0x9a, 0x35, 0x43, 0xfe, 0x02, 0x8f, 0x19, 0x33, 0x39, 0xb1, 0xfe, 0x92, - 0xe0, 0x8e, 0x94, 0x29, 0xd8, 0x4e, 0x90, 0x85, 0x78, 0x77, 0xef, 0xf1, 0xfb, 0xde, 0xf7, 0xbe, - 0x83, 0x96, 0xe7, 0xb3, 0x27, 0xc9, 0xb1, 0x39, 0x0f, 0x16, 0x9d, 0x79, 0x40, 0x19, 0xf6, 0x29, - 0x89, 0xdc, 0x4d, 0x88, 0x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 0x4a, 0x07, 0x97, 0x2b, 0x1d, 0x7c, 0x5c, 0xe9, 0xe0, - 0xcb, 0x4a, 0x07, 0xc7, 0x25, 0x91, 0xe6, 0xde, 0xd7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0x6e, - 0xa4, 0xd7, 0xc9, 0x04, 0x00, 0x00, +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, + 0x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87, 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, } diff --git a/api/types/container/container.proto b/api/types/task/task.proto similarity index 87% rename from api/types/container/container.proto rename to api/types/task/task.proto index a5efa4090..cce329f8e 100644 --- a/api/types/container/container.proto +++ b/api/types/task/task.proto @@ -17,11 +17,12 @@ enum Status { PAUSED = 4 [(gogoproto.enumvalue_customname) = "StatusPaused"]; } -message Container { - string id = 1; - uint32 pid = 2; - Status status = 3; - google.protobuf.Any spec = 4; +message Task { + string id = 1; // TODO(stevvooe): For now, this is just the container id. + string container_id = 2; + uint32 pid = 3; + Status status = 4; + google.protobuf.Any spec = 5; } message Process { diff --git a/cmd/containerd/builtins.go b/cmd/containerd/builtins.go index 8124b592a..5baa9dacf 100644 --- a/cmd/containerd/builtins.go +++ b/cmd/containerd/builtins.go @@ -2,6 +2,7 @@ package main // register containerd builtins here import ( + _ "github.com/containerd/containerd/services/containers" _ "github.com/containerd/containerd/services/content" _ "github.com/containerd/containerd/services/diff" _ "github.com/containerd/containerd/services/execution" diff --git a/cmd/containerd/main.go b/cmd/containerd/main.go index f2f5d81f3..0c3907763 100644 --- a/cmd/containerd/main.go +++ b/cmd/containerd/main.go @@ -17,6 +17,7 @@ import ( "google.golang.org/grpc/health/grpc_health_v1" "github.com/Sirupsen/logrus" + containersapi "github.com/containerd/containerd/api/services/containers" contentapi "github.com/containerd/containerd/api/services/content" diffapi "github.com/containerd/containerd/api/services/diff" api "github.com/containerd/containerd/api/services/execution" @@ -265,7 +266,7 @@ func resolveMetaDB(ctx *cli.Context) (*bolt.DB, error) { return db, nil } -func loadRuntimes(monitor plugin.ContainerMonitor) (map[string]plugin.Runtime, error) { +func loadRuntimes(monitor plugin.TaskMonitor) (map[string]plugin.Runtime, error) { o := make(map[string]plugin.Runtime) for name, rr := range plugin.Registrations() { if rr.Type != plugin.RuntimePlugin { @@ -293,10 +294,10 @@ func loadRuntimes(monitor plugin.ContainerMonitor) (map[string]plugin.Runtime, e return o, nil } -func loadMonitor() (plugin.ContainerMonitor, error) { - var monitors []plugin.ContainerMonitor +func loadMonitor() (plugin.TaskMonitor, error) { + var monitors []plugin.TaskMonitor for name, m := range plugin.Registrations() { - if m.Type != plugin.ContainerMonitorPlugin { + if m.Type != plugin.TaskMonitorPlugin { continue } log.G(global).Infof("loading monitor plugin %q...", name) @@ -309,12 +310,12 @@ func loadMonitor() (plugin.ContainerMonitor, error) { if err != nil { return nil, err } - monitors = append(monitors, mm.(plugin.ContainerMonitor)) + monitors = append(monitors, mm.(plugin.TaskMonitor)) } if len(monitors) == 0 { return plugin.NewNoopMonitor(), nil } - return plugin.NewMultiContainerMonitor(monitors...), nil + return plugin.NewMultiTaskMonitor(monitors...), nil } func loadSnapshotter(store content.Store) (snapshot.Snapshotter, error) { @@ -414,8 +415,10 @@ func interceptor(ctx gocontext.Context, ) (interface{}, error) { ctx = log.WithModule(ctx, "containerd") switch info.Server.(type) { - case api.ContainerServiceServer: + case api.TasksServer: ctx = log.WithModule(ctx, "execution") + case containersapi.ContainersServer: + ctx = log.WithModule(ctx, "containers") case contentapi.ContentServer: ctx = log.WithModule(ctx, "content") case imagesapi.ImagesServer: diff --git a/cmd/ctr/checkpoint.go b/cmd/ctr/checkpoint.go index 65065bb31..2cee5b0dc 100644 --- a/cmd/ctr/checkpoint.go +++ b/cmd/ctr/checkpoint.go @@ -46,7 +46,8 @@ var checkpointCommand = cli.Command{ if id == "" { return errors.New("container id must be provided") } - containers, err := getExecutionService(context) + + tasks, err := getTasksService(context) if err != nil { return err } @@ -59,13 +60,13 @@ var checkpointCommand = cli.Command{ return errors.Wrap(err, "failed resolving image store") } var spec specs.Spec - info, err := containers.Info(ctx, &execution.InfoRequest{ - ID: id, + info, err := tasks.Info(ctx, &execution.InfoRequest{ + ContainerID: id, }) if err != nil { return err } - if err := json.Unmarshal(info.Spec.Value, &spec); err != nil { + if err := json.Unmarshal(info.Task.Spec.Value, &spec); err != nil { return err } stopped := context.Bool("exit") @@ -73,22 +74,22 @@ var checkpointCommand = cli.Command{ // we pause the container and give us time to checkpoint the filesystem before // it resumes execution if !stopped { - if _, err := containers.Pause(ctx, &execution.PauseRequest{ - ID: id, + if _, err := tasks.Pause(ctx, &execution.PauseRequest{ + ContainerID: id, }); err != nil { return err } defer func() { - if _, err := containers.Resume(ctx, &execution.ResumeRequest{ - ID: id, + if _, err := tasks.Resume(ctx, &execution.ResumeRequest{ + ContainerID: id, }); err != nil { logrus.WithError(err).Error("ctr: unable to resume container") } }() } - checkpoint, err := containers.Checkpoint(ctx, &execution.CheckpointRequest{ - ID: id, - Exit: context.Bool("exit"), + checkpoint, err := tasks.Checkpoint(ctx, &execution.CheckpointRequest{ + ContainerID: id, + Exit: context.Bool("exit"), }) if err != nil { return err diff --git a/cmd/ctr/delete.go b/cmd/ctr/delete.go index 570325f2e..64075e139 100644 --- a/cmd/ctr/delete.go +++ b/cmd/ctr/delete.go @@ -3,6 +3,7 @@ package main import ( gocontext "context" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/pkg/errors" "github.com/urfave/cli" @@ -13,10 +14,15 @@ var deleteCommand = cli.Command{ Usage: "delete an existing container", ArgsUsage: "CONTAINER", Action: func(context *cli.Context) error { - containers, err := getExecutionService(context) + containers, err := getContainersService(context) if err != nil { return err } + tasks, err := getTasksService(context) + if err != nil { + return err + } + snapshotter, err := getSnapshotter(context) if err != nil { return err @@ -26,13 +32,20 @@ var deleteCommand = cli.Command{ return errors.New("container id must be provided") } ctx := gocontext.TODO() - _, err = containers.Delete(ctx, &execution.DeleteRequest{ + _, err = containers.Delete(ctx, &containersapi.DeleteContainerRequest{ ID: id, }) if err != nil { return errors.Wrap(err, "failed to delete container") } + _, err = tasks.Delete(ctx, &execution.DeleteRequest{ + ContainerID: id, + }) + if err != nil { + return errors.Wrap(err, "failed to delete container") + } + if err := snapshotter.Remove(ctx, id); err != nil { return errors.Wrapf(err, "failed to remove snapshot %q", id) } diff --git a/cmd/ctr/events.go b/cmd/ctr/events.go index 5ef1fec01..6bd31bd17 100644 --- a/cmd/ctr/events.go +++ b/cmd/ctr/events.go @@ -14,11 +14,11 @@ var eventsCommand = cli.Command{ Name: "events", Usage: "display containerd events", Action: func(context *cli.Context) error { - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } - events, err := containers.Events(gocontext.Background(), &execution.EventsRequest{}) + events, err := tasks.Events(gocontext.Background(), &execution.EventsRequest{}) if err != nil { return err } diff --git a/cmd/ctr/exec.go b/cmd/ctr/exec.go index fc26f1727..57a8a7c82 100644 --- a/cmd/ctr/exec.go +++ b/cmd/ctr/exec.go @@ -37,11 +37,11 @@ var execCommand = cli.Command{ return errors.New("container id must be provided") } - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } - events, err := containers.Events(ctx, &execution.EventsRequest{}) + events, err := tasks.Events(ctx, &execution.EventsRequest{}) if err != nil { return err } @@ -66,12 +66,12 @@ var execCommand = cli.Command{ if err != nil { return err } - response, err := containers.Exec(ctx, request) + response, err := tasks.Exec(ctx, request) if err != nil { return err } if request.Terminal { - if err := handleConsoleResize(ctx, containers, id, response.Pid, con); err != nil { + if err := handleConsoleResize(ctx, tasks, id, response.Pid, con); err != nil { logrus.WithError(err).Error("console resize") } } diff --git a/cmd/ctr/exec_unix.go b/cmd/ctr/exec_unix.go index 086cda007..78736508f 100644 --- a/cmd/ctr/exec_unix.go +++ b/cmd/ctr/exec_unix.go @@ -56,7 +56,7 @@ func newExecRequest(context *cli.Context, tmpDir, id string) (*execution.ExecReq return nil, err } return &execution.ExecRequest{ - ID: id, + ContainerID: id, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: data, diff --git a/cmd/ctr/exec_windows.go b/cmd/ctr/exec_windows.go index 85394a215..5e1ee6473 100644 --- a/cmd/ctr/exec_windows.go +++ b/cmd/ctr/exec_windows.go @@ -23,7 +23,7 @@ func newExecRequest(context *cli.Context, tmpDir, id string) (*execution.ExecReq } now := time.Now().UnixNano() request := &execution.ExecRequest{ - ID: id, + ContainerID: id, Spec: &protobuf.Any{ TypeUrl: specs.Version, Value: data, diff --git a/cmd/ctr/info.go b/cmd/ctr/info.go index 30fb256cb..2cfba1151 100644 --- a/cmd/ctr/info.go +++ b/cmd/ctr/info.go @@ -6,6 +6,7 @@ import ( gocontext "context" "fmt" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/pkg/errors" "github.com/urfave/cli" @@ -26,11 +27,30 @@ var infoCommand = cli.Command{ return errors.New("container id must be provided") } - containers, err := getExecutionService(context) + containers, err := getContainersService(context) if err != nil { return err } - response, err := containers.Info(gocontext.Background(), &execution.InfoRequest{ID: id}) + tasks, err := getTasksService(context) + if err != nil { + return err + } + + containerResponse, err := containers.Get(gocontext.TODO(), &containersapi.GetContainerRequest{ID: id}) + if err != nil { + return err + } + + // TODO(stevvooe): Just dumping the container and the task, for now. We + // should split this into two separate commands. + cjson, err := json.MarshalIndent(containerResponse, "", " ") + if err != nil { + return err + } + + fmt.Println(string(cjson)) + + response, err := tasks.Info(gocontext.Background(), &execution.InfoRequest{ContainerID: id}) if err != nil { return err } diff --git a/cmd/ctr/kill.go b/cmd/ctr/kill.go index 38c69d7f8..afa12144e 100644 --- a/cmd/ctr/kill.go +++ b/cmd/ctr/kill.go @@ -49,8 +49,8 @@ var killCommand = cli.Command{ } killRequest := &execution.KillRequest{ - ID: id, - Signal: uint32(signal), + ContainerID: id, + Signal: uint32(signal), PidOrAll: &execution.KillRequest_Pid{ Pid: uint32(pid), }, @@ -62,11 +62,11 @@ var killCommand = cli.Command{ } } - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } - _, err = containers.Kill(gocontext.Background(), killRequest) + _, err = tasks.Kill(gocontext.Background(), killRequest) if err != nil { return err } diff --git a/cmd/ctr/list.go b/cmd/ctr/list.go index 7cfd2a5bc..0aa66d68f 100644 --- a/cmd/ctr/list.go +++ b/cmd/ctr/list.go @@ -6,10 +6,16 @@ import ( "os" "text/tabwriter" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" + tasktypes "github.com/containerd/containerd/api/types/task" "github.com/urfave/cli" ) +var containersCommand = cli.Command{ + Name: "containers", +} + var listCommand = cli.Command{ Name: "list", Aliases: []string{"ls"}, @@ -22,11 +28,18 @@ var listCommand = cli.Command{ }, Action: func(context *cli.Context) error { quiet := context.Bool("quiet") - containers, err := getExecutionService(context) + + tasks, err := getTasksService(context) if err != nil { return err } - response, err := containers.List(gocontext.Background(), &execution.ListRequest{}) + + containers, err := getContainersService(context) + if err != nil { + return err + } + + response, err := containers.List(gocontext.Background(), &containersapi.ListContainersRequest{}) if err != nil { return err } @@ -36,13 +49,35 @@ var listCommand = cli.Command{ fmt.Println(c.ID) } } else { + + tasksResponse, err := tasks.List(gocontext.TODO(), &execution.ListRequest{}) + if err != nil { + return err + } + + // Join with tasks to get status. + tasksByContainerID := map[string]*tasktypes.Task{} + for _, task := range tasksResponse.Tasks { + task.Descriptor() + tasksByContainerID[task.ContainerID] = task + } + w := tabwriter.NewWriter(os.Stdout, 10, 1, 3, ' ', 0) - fmt.Fprintln(w, "ID\tPID\tSTATUS") + fmt.Fprintln(w, "ID\tIMAGE\tPID\tSTATUS") for _, c := range response.Containers { - if _, err := fmt.Fprintf(w, "%s\t%d\t%s\n", + var status string + task, ok := tasksByContainerID[c.ID] + if ok { + status = task.Status.String() + } else { + status = "STOPPED" // TODO(stevvooe): Is this assumption correct? + } + + if _, err := fmt.Fprintf(w, "%s\t%s\t%d\t%s\n", c.ID, - c.Pid, - c.Status.String(), + c.Image, + task.Pid, + status, ); err != nil { return err } diff --git a/cmd/ctr/pause.go b/cmd/ctr/pause.go index 8a45d2c85..422142396 100644 --- a/cmd/ctr/pause.go +++ b/cmd/ctr/pause.go @@ -13,7 +13,7 @@ var pauseCommand = cli.Command{ Usage: "pause an existing container", ArgsUsage: "CONTAINER", Action: func(context *cli.Context) error { - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } @@ -21,8 +21,8 @@ var pauseCommand = cli.Command{ if id == "" { return errors.New("container id must be provided") } - _, err = containers.Pause(gocontext.Background(), &execution.PauseRequest{ - ID: id, + _, err = tasks.Pause(gocontext.Background(), &execution.PauseRequest{ + ContainerID: id, }) return err }, diff --git a/cmd/ctr/ps.go b/cmd/ctr/ps.go index d8589da9d..c540d1e96 100644 --- a/cmd/ctr/ps.go +++ b/cmd/ctr/ps.go @@ -27,15 +27,15 @@ var psCommand = cli.Command{ } pr := &execution.ProcessesRequest{ - ID: id, + ContainerID: id, } - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } - resp, err := containers.Processes(gocontext.Background(), pr) + resp, err := tasks.Processes(gocontext.Background(), pr) if err != nil { return err } diff --git a/cmd/ctr/resume.go b/cmd/ctr/resume.go index af11b2d7a..e22d46d06 100644 --- a/cmd/ctr/resume.go +++ b/cmd/ctr/resume.go @@ -13,7 +13,7 @@ var resumeCommand = cli.Command{ Usage: "resume a paused container", ArgsUsage: "CONTAINER", Action: func(context *cli.Context) error { - containers, err := getExecutionService(context) + tasks, err := getTasksService(context) if err != nil { return err } @@ -21,8 +21,8 @@ var resumeCommand = cli.Command{ if id == "" { return errors.New("container id must be provided") } - _, err = containers.Resume(gocontext.Background(), &execution.ResumeRequest{ - ID: id, + _, err = tasks.Resume(gocontext.Background(), &execution.ResumeRequest{ + ContainerID: id, }) return err }, diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index 8574f827e..19b75df0f 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -80,7 +80,11 @@ var runCommand = cli.Command{ if id == "" { return errors.New("container id must be provided") } - containers, err := getExecutionService(context) + containers, err := getContainersService(context) + if err != nil { + return err + } + tasks, err := getTasksService(context) if err != nil { return err } @@ -89,7 +93,7 @@ var runCommand = cli.Command{ return err } defer os.RemoveAll(tmpDir) - events, err := containers.Events(ctx, &execution.EventsRequest{}) + events, err := tasks.Events(ctx, &execution.EventsRequest{}) if err != nil { return err } @@ -227,11 +231,22 @@ var runCommand = cli.Command{ return err } if len(spec) == 0 { - if spec, err = newSpec(context, &imageConfig.Config, ref); err != nil { + if spec, err = newContainerSpec(context, &imageConfig.Config, ref); err != nil { return err } } - create, err := newCreateRequest(context, id, tmpDir, checkpoint, mounts, spec) + + createContainer, err := newCreateContainerRequest(context, id, id, spec) + if err != nil { + return err + } + + _, err = containers.Create(ctx, createContainer) + if err != nil { + return err + } + + create, err := newCreateTaskRequest(context, id, tmpDir, checkpoint, mounts) if err != nil { return err } @@ -247,22 +262,22 @@ var runCommand = cli.Command{ if err != nil { return err } - response, err := containers.Create(ctx, create) + response, err := tasks.Create(ctx, create) if err != nil { return err } pid := response.Pid if create.Terminal { - if err := handleConsoleResize(ctx, containers, id, pid, con); err != nil { + if err := handleConsoleResize(ctx, tasks, id, pid, con); err != nil { logrus.WithError(err).Error("console resize") } } else { - sigc := forwardAllSignals(containers, id) + sigc := forwardAllSignals(tasks, id) defer stopCatch(sigc) } if checkpoint == nil { - if _, err := containers.Start(ctx, &execution.StartRequest{ - ID: id, + if _, err := tasks.Start(ctx, &execution.StartRequest{ + ContainerID: id, }); err != nil { return err } @@ -274,8 +289,8 @@ var runCommand = cli.Command{ if err != nil { return err } - if _, err := containers.Delete(ctx, &execution.DeleteRequest{ - ID: response.ID, + if _, err := tasks.Delete(ctx, &execution.DeleteRequest{ + ContainerID: response.ContainerID, }); err != nil { return err } diff --git a/cmd/ctr/run_unix.go b/cmd/ctr/run_unix.go index 55439f240..2b3db7f14 100644 --- a/cmd/ctr/run_unix.go +++ b/cmd/ctr/run_unix.go @@ -18,6 +18,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" + containersapi "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/api/types/mount" @@ -265,7 +266,7 @@ func getConfig(context *cli.Context, imageConfig *ocispec.ImageConfig, rootfs st return customSpec(config, rootfs) } -func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { +func newContainerSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { s, err := getConfig(context, config, context.String("rootfs")) if err != nil { return nil, err @@ -277,26 +278,31 @@ func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) return json.Marshal(s) } -func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []mountt.Mount, spec []byte) (*execution.CreateRequest, error) { - create := &execution.CreateRequest{ - ID: id, - Spec: &protobuf.Any{ - TypeUrl: specs.Version, - Value: spec, +func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) { + create := &containersapi.CreateContainerRequest{ + Container: containersapi.Container{ + ID: id, + Spec: &protobuf.Any{ + TypeUrl: specs.Version, + Value: spec, + }, + Runtime: context.String("runtime"), + RootFS: snapshot, }, - Runtime: context.String("runtime"), - Terminal: context.Bool("tty"), - Stdin: filepath.Join(tmpDir, "stdin"), - Stdout: filepath.Join(tmpDir, "stdout"), - Stderr: filepath.Join(tmpDir, "stderr"), } - if checkpoint != nil { - create.Checkpoint = &descriptor.Descriptor{ - MediaType: checkpoint.MediaType, - Size_: checkpoint.Size, - Digest: checkpoint.Digest, - } + + return create, nil +} + +func newCreateTaskRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []mountt.Mount) (*execution.CreateRequest, error) { + create := &execution.CreateRequest{ + ContainerID: id, + Terminal: context.Bool("tty"), + Stdin: filepath.Join(tmpDir, "stdin"), + Stdout: filepath.Join(tmpDir, "stdout"), + Stderr: filepath.Join(tmpDir, "stderr"), } + for _, m := range mounts { create.Rootfs = append(create.Rootfs, &mount.Mount{ Type: m.Type, @@ -304,20 +310,29 @@ func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocisp Options: m.Options, }) } + + if checkpoint != nil { + create.Checkpoint = &descriptor.Descriptor{ + MediaType: checkpoint.MediaType, + Size_: checkpoint.Size, + Digest: checkpoint.Digest, + } + } + return create, nil } -func handleConsoleResize(ctx context.Context, service execution.ContainerServiceClient, id string, pid uint32, con console.Console) error { +func handleConsoleResize(ctx context.Context, service execution.TasksClient, id string, pid uint32, con console.Console) error { // do an initial resize of the console size, err := con.Size() if err != nil { return err } if _, err := service.Pty(ctx, &execution.PtyRequest{ - ID: id, - Pid: pid, - Width: uint32(size.Width), - Height: uint32(size.Height), + ContainerID: id, + Pid: pid, + Width: uint32(size.Width), + Height: uint32(size.Height), }); err != nil { return err } @@ -331,10 +346,10 @@ func handleConsoleResize(ctx context.Context, service execution.ContainerService continue } if _, err := service.Pty(ctx, &execution.PtyRequest{ - ID: id, - Pid: pid, - Width: uint32(size.Width), - Height: uint32(size.Height), + ContainerID: id, + Pid: pid, + Width: uint32(size.Width), + Height: uint32(size.Height), }); err != nil { logrus.WithError(err).Error("resize pty") } diff --git a/cmd/ctr/run_windows.go b/cmd/ctr/run_windows.go index 326b13992..bf804ee5d 100644 --- a/cmd/ctr/run_windows.go +++ b/cmd/ctr/run_windows.go @@ -10,6 +10,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/log" "github.com/containerd/containerd/mount" @@ -117,7 +118,7 @@ func getConfig(context *cli.Context, imageConfig *ocispec.ImageConfig, rootfs st return s, nil } -func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { +func newContainerSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) ([]byte, error) { spec, err := getConfig(context, config, context.String("rootfs")) if err != nil { return nil, err @@ -136,17 +137,28 @@ func newSpec(context *cli.Context, config *ocispec.ImageConfig, imageRef string) return json.Marshal(rtSpec) } -func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []mount.Mount, spec []byte) (*execution.CreateRequest, error) { - create := &execution.CreateRequest{ - ID: id, - Spec: &protobuf.Any{ - TypeUrl: specs.Version, - Value: spec, +func newCreateContainerRequest(context *cli.Context, id, snapshot string, spec []byte) (*containersapi.CreateContainerRequest, error) { + create := &containersapi.CreateContainerRequest{ + Container: containersapi.Container{ + ID: id, + Spec: &protobuf.Any{ + TypeUrl: specs.Version, + Value: spec, + }, + Runtime: context.String("runtime"), + RootFS: snapshot, }, - Runtime: context.String("runtime"), - Terminal: context.Bool("tty"), - Stdin: fmt.Sprintf(`%s\ctr-%s-stdin`, pipeRoot, id), - Stdout: fmt.Sprintf(`%s\ctr-%s-stdout`, pipeRoot, id), + } + + return create, nil +} + +func newCreateTaskRequest(context *cli.Context, id, tmpDir string, checkpoint *ocispec.Descriptor, mounts []mount.Mount) (*execution.CreateRequest, error) { + create := &execution.CreateRequest{ + ContainerID: id, + Terminal: context.Bool("tty"), + Stdin: fmt.Sprintf(`%s\ctr-%s-stdin`, pipeRoot, id), + Stdout: fmt.Sprintf(`%s\ctr-%s-stdout`, pipeRoot, id), } if !create.Terminal { create.Stderr = fmt.Sprintf(`%s\ctr-%s-stderr`, pipeRoot, id) @@ -154,7 +166,7 @@ func newCreateRequest(context *cli.Context, id, tmpDir string, checkpoint *ocisp return create, nil } -func handleConsoleResize(ctx context.Context, service execution.ContainerServiceClient, id string, pid uint32, con console.Console) error { +func handleConsoleResize(ctx context.Context, service execution.TasksClient, id string, pid uint32, con console.Console) error { // do an initial resize of the console size, err := con.Size() if err != nil { @@ -173,10 +185,10 @@ func handleConsoleResize(ctx context.Context, service execution.ContainerService if size.Width != prevSize.Width || size.Height != prevSize.Height { if _, err := service.Pty(ctx, &execution.PtyRequest{ - ID: id, - Pid: pid, - Width: uint32(size.Width), - Height: uint32(size.Height), + ContainerID: id, + Pid: pid, + Width: uint32(size.Width), + Height: uint32(size.Height), }); err != nil { log.G(ctx).WithError(err).Error("resize pty") } diff --git a/cmd/ctr/utils.go b/cmd/ctr/utils.go index ebf135f79..3173ed496 100644 --- a/cmd/ctr/utils.go +++ b/cmd/ctr/utils.go @@ -13,13 +13,14 @@ import ( "syscall" "github.com/Sirupsen/logrus" + containersapi "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" snapshotapi "github.com/containerd/containerd/api/services/snapshot" versionservice "github.com/containerd/containerd/api/services/version" - "github.com/containerd/containerd/api/types/container" + "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" contentservice "github.com/containerd/containerd/services/content" @@ -34,12 +35,20 @@ import ( var grpcConn *grpc.ClientConn -func getExecutionService(context *cli.Context) (execution.ContainerServiceClient, error) { +func getContainersService(context *cli.Context) (containersapi.ContainersClient, error) { conn, err := getGRPCConnection(context) if err != nil { return nil, err } - return execution.NewContainerServiceClient(conn), nil + return containersapi.NewContainersClient(conn), nil +} + +func getTasksService(context *cli.Context) (execution.TasksClient, error) { + conn, err := getGRPCConnection(context) + if err != nil { + return nil, err + } + return execution.NewTasksClient(conn), nil } func getContentStore(context *cli.Context) (content.Store, error) { @@ -94,13 +103,13 @@ func getTempDir(id string) (string, error) { return tmpDir, nil } -func waitContainer(events execution.ContainerService_EventsClient, id string, pid uint32) (uint32, error) { +func waitContainer(events execution.Tasks_EventsClient, id string, pid uint32) (uint32, error) { for { e, err := events.Recv() if err != nil { return 255, err } - if e.Type != container.Event_EXIT { + if e.Type != task.Event_EXIT { continue } if e.ID == id && e.Pid == pid { @@ -109,7 +118,7 @@ func waitContainer(events execution.ContainerService_EventsClient, id string, pi } } -func forwardAllSignals(containers execution.ContainerServiceClient, id string) chan os.Signal { +func forwardAllSignals(containers execution.TasksClient, id string) chan os.Signal { sigc := make(chan os.Signal, 128) signal.Notify(sigc) @@ -117,8 +126,8 @@ func forwardAllSignals(containers execution.ContainerServiceClient, id string) c for s := range sigc { logrus.Debug("Forwarding signal ", s) killRequest := &execution.KillRequest{ - ID: id, - Signal: uint32(s.(syscall.Signal)), + ContainerID: id, + Signal: uint32(s.(syscall.Signal)), PidOrAll: &execution.KillRequest_All{ All: false, }, diff --git a/cmd/ctrd-protobuild/main.go b/cmd/ctrd-protobuild/main.go index f2a3d65e3..207e0d49b 100644 --- a/cmd/ctrd-protobuild/main.go +++ b/cmd/ctrd-protobuild/main.go @@ -43,6 +43,7 @@ var ( packageMap = map[string]string{ "google/protobuf/timestamp.proto": "github.com/gogo/protobuf/types", "google/protobuf/any.proto": "github.com/gogo/protobuf/types", + "google/protobuf/field_mask.proto": "github.com/gogo/protobuf/types", "google/protobuf/descriptor.proto": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor", "gogoproto/gogo.proto": "github.com/gogo/protobuf/gogoproto", } diff --git a/containers/containers.go b/containers/containers.go new file mode 100644 index 000000000..44d3128b0 --- /dev/null +++ b/containers/containers.go @@ -0,0 +1,24 @@ +package containers + +import "context" + +// 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 +} + +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/containers/storage.go b/containers/storage.go new file mode 100644 index 000000000..95fa2e086 --- /dev/null +++ b/containers/storage.go @@ -0,0 +1,57 @@ +package containers + +import ( + "context" + + "github.com/boltdb/bolt" + "github.com/pkg/errors" +) + +var ( + ErrExists = errors.New("images: exists") + ErrNotFound = errors.New("images: not found") +) + +// 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") + bucketKeyContainers = []byte("containers") +) + +type storage struct { + tx *bolt.Tx +} + +func NewStore(tx *bolt.Tx) Store { + return &storage{ + tx: tx, + } +} + +func (s *storage) Get(ctx context.Context, id string) (Container, error) { + panic("not implemented") +} + +func (s *storage) List(ctx context.Context, filter string) ([]Container, error) { + panic("not implemented") +} + +func (s *storage) Create(ctx context.Context, container Container) (Container, error) { + panic("not implemented") +} + +func (s *storage) Update(ctx context.Context, container Container) (Container, error) { + panic("not implemented") +} + +func (s *storage) Delete(ctx context.Context, id string) error { + panic("not implemented") +} diff --git a/images/storage.go b/images/storage.go index 9da9511e1..66b4e115a 100644 --- a/images/storage.go +++ b/images/storage.go @@ -55,7 +55,7 @@ func InitDB(db *bolt.DB) error { }) } -func NewImageStore(tx *bolt.Tx) Store { +func NewStore(tx *bolt.Tx) Store { return &storage{tx: tx} } diff --git a/linux/runtime.go b/linux/runtime.go index 68f92ce77..65220a613 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -14,8 +14,8 @@ import ( "time" "github.com/containerd/containerd/api/services/shim" - "github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/mount" + "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/log" "github.com/containerd/containerd/plugin" runc "github.com/containerd/go-runc" @@ -83,10 +83,10 @@ type Runtime struct { events chan *plugin.Event eventsContext context.Context eventsCancel func() - monitor plugin.ContainerMonitor + monitor plugin.TaskMonitor } -func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Container, error) { +func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Task, error) { path, err := r.newBundle(id, opts.Spec) if err != nil { return nil, err @@ -127,16 +127,16 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) os.RemoveAll(path) return nil, err } - c := newContainer(id, opts.Spec, s) - // after the container is created, add it to the monitor + c := newTask(id, opts.Spec, s) + // after the task is create add it to the monitor if err = r.monitor.Monitor(c); err != nil { return nil, err } return c, nil } -func (r *Runtime) Delete(ctx context.Context, c plugin.Container) (*plugin.Exit, error) { - lc, ok := c.(*Container) +func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, error) { + lc, ok := c.(*Task) if !ok { return nil, fmt.Errorf("container cannot be cast as *linux.Container") } @@ -153,15 +153,15 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Container) (*plugin.Exit, return &plugin.Exit{ Status: rsp.ExitStatus, Timestamp: rsp.ExitedAt, - }, r.deleteBundle(lc.id) + }, r.deleteBundle(lc.containerID) } -func (r *Runtime) Containers(ctx context.Context) ([]plugin.Container, error) { +func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) { dir, err := ioutil.ReadDir(r.root) if err != nil { return nil, err } - var o []plugin.Container + var o []plugin.Task for _, fi := range dir { if !fi.IsDir() { continue @@ -206,15 +206,15 @@ func (r *Runtime) forward(events shim.Shim_EventsClient) { } var et plugin.EventType switch e.Type { - case container.Event_CREATE: + case task.Event_CREATE: et = plugin.CreateEvent - case container.Event_EXEC_ADDED: + case task.Event_EXEC_ADDED: et = plugin.ExecAddEvent - case container.Event_EXIT: + case task.Event_EXIT: et = plugin.ExitEvent - case container.Event_OOM: + case task.Event_OOM: et = plugin.OOMEvent - case container.Event_START: + case task.Event_START: et = plugin.StartEvent } r.events <- &plugin.Event{ @@ -250,20 +250,22 @@ func (r *Runtime) deleteBundle(id string) error { return os.RemoveAll(filepath.Join(r.root, id)) } -func (r *Runtime) loadContainer(path string) (*Container, error) { +func (r *Runtime) loadContainer(path string) (*Task, error) { id := filepath.Base(path) s, err := loadShim(path, r.remote) if err != nil { return nil, err } + data, err := ioutil.ReadFile(filepath.Join(path, configFilename)) if err != nil { return nil, err } - return &Container{ - id: id, - shim: s, - spec: data, + + return &Task{ + containerID: id, + shim: s, + spec: data, }, nil } diff --git a/linux/shim/client.go b/linux/shim/client.go index ca746dfc1..ae27afa01 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -4,7 +4,7 @@ import ( "path/filepath" shimapi "github.com/containerd/containerd/api/services/shim" - "github.com/containerd/containerd/api/types/container" + "github.com/containerd/containerd/api/types/task" runc "github.com/containerd/go-runc" google_protobuf "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" @@ -104,11 +104,11 @@ func (c *client) Checkpoint(ctx context.Context, in *shimapi.CheckpointRequest, } type events struct { - c chan *container.Event + c chan *task.Event ctx context.Context } -func (e *events) Recv() (*container.Event, error) { +func (e *events) Recv() (*task.Event, error) { ev := <-e.c return ev, nil } diff --git a/linux/shim/service.go b/linux/shim/service.go index f6a21989d..be4a14a66 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -10,7 +10,7 @@ import ( "github.com/containerd/console" shimapi "github.com/containerd/containerd/api/services/shim" - "github.com/containerd/containerd/api/types/container" + "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/reaper" google_protobuf "github.com/golang/protobuf/ptypes/empty" "github.com/pkg/errors" @@ -25,7 +25,7 @@ func New(path string) *Service { return &Service{ path: path, processes: make(map[int]process), - events: make(chan *container.Event, 4096), + events: make(chan *task.Event, 4096), } } @@ -36,7 +36,7 @@ type Service struct { bundle string mu sync.Mutex processes map[int]process - events chan *container.Event + events chan *task.Event execID int } @@ -56,8 +56,9 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateRequest) (*shimap ExitCh: make(chan int, 1), } reaper.Default.Register(pid, cmd) - s.events <- &container.Event{ - Type: container.Event_CREATE, + go s.waitExit(process, pid, cmd) + s.events <- &task.Event{ + Type: task.Event_CREATE, ID: r.ID, Pid: uint32(pid), } @@ -71,8 +72,8 @@ func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*google_p if err := s.initProcess.Start(ctx); err != nil { return nil, err } - s.events <- &container.Event{ - Type: container.Event_START, + s.events <- &task.Event{ + Type: task.Event_START, ID: s.id, Pid: uint32(s.initProcess.Pid()), } @@ -114,8 +115,9 @@ func (s *Service) Exec(ctx context.Context, r *shimapi.ExecRequest) (*shimapi.Ex } reaper.Default.RegisterNL(pid, cmd) reaper.Default.Unlock() - s.events <- &container.Event{ - Type: container.Event_EXEC_ADDED, + go s.waitExit(process, pid, cmd) + s.events <- &task.Event{ + Type: task.Event_EXEC_ADDED, ID: s.id, Pid: uint32(pid), } @@ -159,35 +161,35 @@ func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi. if err != nil { return nil, err } - status := container.StatusUnknown + status := task.StatusUnknown switch st { case "created": - status = container.StatusCreated + status = task.StatusCreated case "running": - status = container.StatusRunning + status = task.StatusRunning case "stopped": - status = container.StatusStopped + status = task.StatusStopped case "paused": - status = container.StatusPaused + status = task.StatusPaused } o := &shimapi.StateResponse{ ID: s.id, Bundle: s.bundle, Pid: uint32(s.initProcess.Pid()), Status: status, - Processes: []*container.Process{}, + Processes: []*task.Process{}, } s.mu.Lock() defer s.mu.Unlock() for _, p := range s.processes { - status := container.StatusRunning + status := task.StatusRunning if err := unix.Kill(p.Pid(), 0); err != nil { if err != syscall.ESRCH { return nil, err } - status = container.StatusStopped + status = task.StatusStopped } - o.Processes = append(o.Processes, &container.Process{ + o.Processes = append(o.Processes, &task.Process{ Pid: uint32(p.Pid()), Status: status, }) @@ -255,9 +257,9 @@ func (s *Service) Processes(ctx context.Context, r *shimapi.ProcessesRequest) (* return nil, err } - ps := []*container.Process{} + ps := []*task.Process{} for _, pid := range pids { - ps = append(ps, &container.Process{ + ps = append(ps, &task.Process{ Pid: pid, }) } @@ -290,8 +292,8 @@ func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointRequest) func (s *Service) waitExit(p process, pid int, cmd *reaper.Cmd) { status := <-cmd.ExitCh p.Exited(status) - s.events <- &container.Event{ - Type: container.Event_EXIT, + s.events <- &task.Event{ + Type: task.Event_EXIT, ID: s.id, Pid: uint32(pid), ExitStatus: uint32(status), diff --git a/linux/container.go b/linux/task.go similarity index 68% rename from linux/container.go rename to linux/task.go index e31dc3dd7..bced436e5 100644 --- a/linux/container.go +++ b/linux/task.go @@ -6,7 +6,7 @@ import ( "context" "github.com/containerd/containerd/api/services/shim" - "github.com/containerd/containerd/api/types/container" + "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/plugin" protobuf "github.com/gogo/protobuf/types" specs "github.com/opencontainers/runtime-spec/specs-go" @@ -25,48 +25,47 @@ func (s State) Status() plugin.Status { return s.status } -func newContainer(id string, spec []byte, shim shim.ShimClient) *Container { - return &Container{ - id: id, - shim: shim, - spec: spec, +type Task struct { + containerID string + spec []byte + shim shim.ShimClient +} + +func newTask(id string, spec []byte, shim shim.ShimClient) *Task { + return &Task{ + containerID: id, + shim: shim, + spec: spec, } } -type Container struct { - id string - spec []byte - - shim shim.ShimClient -} - -func (c *Container) Info() plugin.ContainerInfo { - return plugin.ContainerInfo{ - ID: c.id, - Runtime: runtimeName, - Spec: c.spec, +func (c *Task) Info() plugin.TaskInfo { + return plugin.TaskInfo{ + ContainerID: c.containerID, + Runtime: runtimeName, + Spec: c.spec, } } -func (c *Container) Start(ctx context.Context) error { +func (c *Task) Start(ctx context.Context) error { _, err := c.shim.Start(ctx, &shim.StartRequest{}) return err } -func (c *Container) State(ctx context.Context) (plugin.State, error) { +func (c *Task) State(ctx context.Context) (plugin.State, error) { response, err := c.shim.State(ctx, &shim.StateRequest{}) if err != nil { return nil, err } var status plugin.Status switch response.Status { - case container.StatusCreated: + case task.StatusCreated: status = plugin.CreatedStatus - case container.StatusRunning: + case task.StatusRunning: status = plugin.RunningStatus - case container.StatusStopped: + case task.StatusStopped: status = plugin.StoppedStatus - case container.StatusPaused: + case task.StatusPaused: status = plugin.PausedStatus // TODO: containerd.DeletedStatus } @@ -76,17 +75,17 @@ func (c *Container) State(ctx context.Context) (plugin.State, error) { }, nil } -func (c *Container) Pause(ctx context.Context) error { +func (c *Task) Pause(ctx context.Context) error { _, err := c.shim.Pause(ctx, &shim.PauseRequest{}) return err } -func (c *Container) Resume(ctx context.Context) error { +func (c *Task) Resume(ctx context.Context) error { _, err := c.shim.Resume(ctx, &shim.ResumeRequest{}) return err } -func (c *Container) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error { +func (c *Task) Kill(ctx context.Context, signal uint32, pid uint32, all bool) error { _, err := c.shim.Kill(ctx, &shim.KillRequest{ Signal: signal, Pid: pid, @@ -95,7 +94,7 @@ func (c *Container) Kill(ctx context.Context, signal uint32, pid uint32, all boo return err } -func (c *Container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, error) { +func (c *Task) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Process, error) { request := &shim.ExecRequest{ Stdin: opts.IO.Stdin, Stdout: opts.IO.Stdout, @@ -117,9 +116,9 @@ func (c *Container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Proc }, nil } -func (c *Container) Processes(ctx context.Context) ([]uint32, error) { +func (c *Task) Processes(ctx context.Context) ([]uint32, error) { resp, err := c.shim.Processes(ctx, &shim.ProcessesRequest{ - ID: c.id, + ID: c.containerID, }) if err != nil { @@ -135,7 +134,7 @@ func (c *Container) Processes(ctx context.Context) ([]uint32, error) { return pids, nil } -func (c *Container) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { +func (c *Task) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize) error { _, err := c.shim.Pty(ctx, &shim.PtyRequest{ Pid: pid, Width: size.Width, @@ -144,14 +143,14 @@ func (c *Container) Pty(ctx context.Context, pid uint32, size plugin.ConsoleSize return err } -func (c *Container) CloseStdin(ctx context.Context, pid uint32) error { +func (c *Task) CloseStdin(ctx context.Context, pid uint32) error { _, err := c.shim.CloseStdin(ctx, &shim.CloseStdinRequest{ Pid: pid, }) return err } -func (c *Container) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error { +func (c *Task) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error { _, err := c.shim.Checkpoint(ctx, &shim.CheckpointRequest{ Exit: opts.Exit, AllowTcp: opts.AllowTCP, @@ -166,7 +165,7 @@ func (c *Container) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) type Process struct { pid int - c *Container + c *Task } func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index c0aa8d647..708caf1de 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -14,7 +14,7 @@ const name = "cgroups" func init() { plugin.Register(name, &plugin.Registration{ - Type: plugin.ContainerMonitorPlugin, + Type: plugin.TaskMonitorPlugin, Init: New, }) } @@ -43,7 +43,7 @@ type cgroupsMonitor struct { events chan<- *plugin.Event } -func (m *cgroupsMonitor) Monitor(c plugin.Container) error { +func (m *cgroupsMonitor) Monitor(c plugin.Task) error { id := c.Info().ID state, err := c.State(m.context) if err != nil { @@ -59,7 +59,7 @@ func (m *cgroupsMonitor) Monitor(c plugin.Container) error { return m.oom.Add(id, cg, m.trigger) } -func (m *cgroupsMonitor) Stop(c plugin.Container) error { +func (m *cgroupsMonitor) Stop(c plugin.Task) error { m.collector.Remove(c.Info().ID) return nil } diff --git a/plugin/container.go b/plugin/container.go index bb109d286..2d2145a5a 100644 --- a/plugin/container.go +++ b/plugin/container.go @@ -2,15 +2,16 @@ package plugin import "context" -type ContainerInfo struct { - ID string - Runtime string - Spec []byte +type TaskInfo struct { + ID string + ContainerID string + Runtime string + Spec []byte } -type Container interface { +type Task interface { // Information of the container - Info() ContainerInfo + Info() TaskInfo // Start the container's user defined process Start(context.Context) error // State returns the container's state diff --git a/plugin/monitor.go b/plugin/monitor.go index 09600e3cb..12b4115b2 100644 --- a/plugin/monitor.go +++ b/plugin/monitor.go @@ -1,44 +1,44 @@ package plugin -// ContainerMonitor provides an interface for monitoring of containers within containerd -type ContainerMonitor interface { +// TaskMonitor provides an interface for monitoring of containers within containerd +type TaskMonitor interface { // Monitor adds the provided container to the monitor - Monitor(Container) error + Monitor(Task) error // Stop stops and removes the provided container from the monitor - Stop(Container) error + Stop(Task) error // Events emits events from the monitor Events(chan<- *Event) } -func NewMultiContainerMonitor(monitors ...ContainerMonitor) ContainerMonitor { - return &multiContainerMonitor{ +func NewMultiTaskMonitor(monitors ...TaskMonitor) TaskMonitor { + return &multiTaskMonitor{ monitors: monitors, } } -func NewNoopMonitor() ContainerMonitor { - return &noopContainerMonitor{} +func NewNoopMonitor() TaskMonitor { + return &noopTaskMonitor{} } -type noopContainerMonitor struct { +type noopTaskMonitor struct { } -func (mm *noopContainerMonitor) Monitor(c Container) error { +func (mm *noopTaskMonitor) Monitor(c Task) error { return nil } -func (mm *noopContainerMonitor) Stop(c Container) error { +func (mm *noopTaskMonitor) Stop(c Task) error { return nil } -func (mm *noopContainerMonitor) Events(events chan<- *Event) { +func (mm *noopTaskMonitor) Events(events chan<- *Event) { } -type multiContainerMonitor struct { - monitors []ContainerMonitor +type multiTaskMonitor struct { + monitors []TaskMonitor } -func (mm *multiContainerMonitor) Monitor(c Container) error { +func (mm *multiTaskMonitor) Monitor(c Task) error { for _, m := range mm.monitors { if err := m.Monitor(c); err != nil { return err @@ -47,7 +47,7 @@ func (mm *multiContainerMonitor) Monitor(c Container) error { return nil } -func (mm *multiContainerMonitor) Stop(c Container) error { +func (mm *multiTaskMonitor) Stop(c Task) error { for _, m := range mm.monitors { if err := m.Stop(c); err != nil { return err @@ -56,7 +56,7 @@ func (mm *multiContainerMonitor) Stop(c Container) error { return nil } -func (mm *multiContainerMonitor) Events(events chan<- *Event) { +func (mm *multiTaskMonitor) Events(events chan<- *Event) { for _, m := range mm.monitors { m.Events(events) } diff --git a/plugin/plugin.go b/plugin/plugin.go index c4bbd8a13..6310e9019 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -18,7 +18,7 @@ const ( RuntimePlugin PluginType = iota + 1 GRPCPlugin SnapshotPlugin - ContainerMonitorPlugin + TaskMonitorPlugin ) type Registration struct { @@ -37,7 +37,7 @@ type InitContext struct { Snapshotter snapshot.Snapshotter Config interface{} Context context.Context - Monitor ContainerMonitor + Monitor TaskMonitor } type Service interface { diff --git a/plugin/runtime.go b/plugin/runtime.go index 7103e25d4..5babc2cd7 100644 --- a/plugin/runtime.go +++ b/plugin/runtime.go @@ -33,11 +33,11 @@ type Exit struct { // arch, or custom usage. type Runtime interface { // Create creates a container with the provided id and options - Create(ctx context.Context, id string, opts CreateOpts) (Container, error) + Create(ctx context.Context, id string, opts CreateOpts) (Task, error) // Containers returns all the current containers for the runtime - Containers(context.Context) ([]Container, error) + Tasks(context.Context) ([]Task, error) // Delete removes the container in the runtime - Delete(context.Context, Container) (*Exit, error) + 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/services/containers/helpers.go b/services/containers/helpers.go new file mode 100644 index 000000000..42321e2f0 --- /dev/null +++ b/services/containers/helpers.go @@ -0,0 +1,56 @@ +package containers + +import ( + api "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/containers" + "github.com/gogo/protobuf/types" + specs "github.com/opencontainers/runtime-spec/specs-go" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +func containersToProto(containers []containers.Container) []api.Container { + var containerspb []api.Container + + for _, image := range containers { + containerspb = append(containerspb, containerToProto(&image)) + } + + return containerspb +} + +func containerToProto(container *containers.Container) api.Container { + return api.Container{ + ID: container.ID, + Labels: container.Labels, + Image: container.Image, + Runtime: container.Runtime, + Spec: &types.Any{ + TypeUrl: specs.Version, + Value: container.Spec, + }, + RootFS: container.RootFS, + } +} + +func containerFromProto(containerpb *api.Container) containers.Container { + return containers.Container{ + ID: containerpb.ID, + Labels: containerpb.Labels, + Image: containerpb.Image, + Runtime: containerpb.Runtime, + Spec: containerpb.Spec.Value, + RootFS: containerpb.RootFS, + } +} + +func mapGRPCError(err error, id string) error { + switch { + case containers.IsNotFound(err): + return grpc.Errorf(codes.NotFound, "container %v not found", id) + case containers.IsExists(err): + return grpc.Errorf(codes.AlreadyExists, "container %v already exists", id) + } + + return err +} diff --git a/services/containers/service.go b/services/containers/service.go new file mode 100644 index 000000000..b6b82a86b --- /dev/null +++ b/services/containers/service.go @@ -0,0 +1,148 @@ +package containers + +import ( + "github.com/boltdb/bolt" + api "github.com/containerd/containerd/api/services/containers" + "github.com/containerd/containerd/containers" + "github.com/containerd/containerd/plugin" + "github.com/golang/protobuf/ptypes/empty" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" +) + +func init() { + plugin.Register("containers-grpc", &plugin.Registration{ + Type: plugin.GRPCPlugin, + Init: func(ic *plugin.InitContext) (interface{}, error) { + return NewService(ic.Meta), nil + }, + }) +} + +type Service struct { + db *bolt.DB +} + +func NewService(db *bolt.DB) api.ContainersServer { + return &Service{db: db} +} + +func (s *Service) Register(server *grpc.Server) error { + api.RegisterContainersServer(server, s) + return nil +} + +func (s *Service) Get(ctx context.Context, req *api.GetContainerRequest) (*api.GetContainerResponse, error) { + var resp api.GetContainerResponse + + return &resp, s.withStoreView(ctx, func(ctx context.Context, store containers.Store) error { + container, err := store.Get(ctx, req.ID) + if err != nil { + return mapGRPCError(err, req.ID) + } + containerpb := containerToProto(&container) + resp.Container = containerpb + return nil + }) +} + +func (s *Service) List(ctx context.Context, req *api.ListContainersRequest) (*api.ListContainersResponse, error) { + var resp api.ListContainersResponse + + return &resp, s.withStoreView(ctx, func(ctx context.Context, store containers.Store) error { + containers, err := store.List(ctx, req.Filter) + if err != nil { + return mapGRPCError(err, "") + } + + resp.Containers = containersToProto(containers) + return nil + }) + +} + +func (s *Service) Create(ctx context.Context, req *api.CreateContainerRequest) (*api.CreateContainerResponse, error) { + var resp api.CreateContainerResponse + + return &resp, s.withStoreUpdate(ctx, func(ctx context.Context, store containers.Store) error { + container := containerFromProto(&req.Container) + + created, err := store.Create(ctx, container) + if err != nil { + return mapGRPCError(err, req.Container.ID) + } + + resp.Container = containerToProto(&created) + return nil + }) +} + +func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) (*api.UpdateContainerResponse, error) { + var resp api.UpdateContainerResponse + + return &resp, s.withStoreUpdate(ctx, func(ctx context.Context, store containers.Store) error { + container := containerFromProto(&req.Container) + + current, err := store.Get(ctx, container.ID) + if err != nil { + return mapGRPCError(err, container.ID) + } + + if current.ID != container.ID { + return grpc.Errorf(codes.InvalidArgument, "container ids must match: %v != %v", current.ID, container.ID) + } + + // apply the field mask. If you update this code, you better follow the + // field mask rules in field_mask.proto. If you don't know what this + // is, do not update this code. + if req.UpdateMask != nil && len(req.UpdateMask.Paths) > 0 { + for _, path := range req.UpdateMask.Paths { + switch path { + case "labels": + current.Labels = container.Labels + case "image": + current.Image = container.Image + case "runtime": + // TODO(stevvooe): Should this actually be allowed? + current.Runtime = container.Runtime + case "spec": + current.Spec = container.Spec + case "rootfs": + current.RootFS = container.RootFS + default: + return grpc.Errorf(codes.InvalidArgument, "cannot update %q field", path) + } + } + } else { + // no field mask present, just replace everything + current = container + } + + created, err := store.Update(ctx, container) + if err != nil { + return mapGRPCError(err, req.Container.ID) + } + + resp.Container = containerToProto(&created) + return nil + }) +} + +func (s *Service) Delete(ctx context.Context, req *api.DeleteContainerRequest) (*empty.Empty, error) { + return &empty.Empty{}, s.withStoreUpdate(ctx, func(ctx context.Context, store containers.Store) error { + return mapGRPCError(store.Delete(ctx, req.ID), req.ID) + }) +} + +func (s *Service) withStore(ctx context.Context, fn func(ctx context.Context, store containers.Store) error) func(tx *bolt.Tx) error { + return func(tx *bolt.Tx) error { return fn(ctx, containers.NewStore(tx)) } +} + +func (s *Service) withStoreView(ctx context.Context, fn func(ctx context.Context, store containers.Store) error) error { + return s.db.View(s.withStore(ctx, fn)) +} + +func (s *Service) withStoreUpdate(ctx context.Context, fn func(ctx context.Context, store containers.Store) error) error { + return s.db.Update(s.withStore(ctx, fn)) +} diff --git a/services/execution/service.go b/services/execution/service.go index eceff06f6..ae68d9cb1 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -9,10 +9,12 @@ import ( "path/filepath" "sync" + "github.com/boltdb/bolt" api "github.com/containerd/containerd/api/services/execution" - "github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/descriptor" + "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/archive" + "github.com/containerd/containerd/containers" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" @@ -23,15 +25,16 @@ import ( specs "github.com/opencontainers/image-spec/specs-go" "golang.org/x/net/context" "google.golang.org/grpc" + "google.golang.org/grpc/codes" ) var ( - _ = (api.ContainerServiceServer)(&Service{}) + _ = (api.TasksServer)(&Service{}) empty = &google_protobuf.Empty{} ) func init() { - plugin.Register("runtime-grpc", &plugin.Registration{ + plugin.Register("tasks-grpc", &plugin.Registration{ Type: plugin.GRPCPlugin, Init: New, }) @@ -43,32 +46,34 @@ func New(ic *plugin.InitContext) (interface{}, error) { return nil, err } return &Service{ - runtimes: ic.Runtimes, - containers: make(map[string]plugin.Container), - collector: c, - store: ic.Content, + runtimes: ic.Runtimes, + tasks: make(map[string]plugin.Task), + db: ic.Meta, + collector: c, + store: ic.Content, }, nil } type Service struct { mu sync.Mutex - runtimes map[string]plugin.Runtime - containers map[string]plugin.Container - collector *collector - store content.Store + runtimes map[string]plugin.Runtime + tasks map[string]plugin.Task + db *bolt.DB + collector *collector + store content.Store } func (s *Service) Register(server *grpc.Server) error { - api.RegisterContainerServiceServer(server, s) - // load all containers + api.RegisterTasksServer(server, s) + // load all tasks for _, r := range s.runtimes { - containers, err := r.Containers(context.Background()) + tasks, err := r.Tasks(context.Background()) if err != nil { return err } - for _, c := range containers { - s.containers[c.Info().ID] = c + for _, c := range tasks { + s.tasks[c.Info().ContainerID] = c } } return nil @@ -80,7 +85,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create err error ) if r.Checkpoint != nil { - checkpointPath, err = ioutil.TempDir("", "ctd-checkpoint") + checkpointPath, err = ioutil.TempDir("", "ctrd-checkpoint") if err != nil { return nil, err } @@ -97,8 +102,26 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create return nil, err } } + + var container containers.Container + if err := s.db.View(func(tx *bolt.Tx) error { + store := containers.NewStore(tx) + var err error + container, err = store.Get(ctx, r.ContainerID) + return err + }); err != nil { + switch { + case containers.IsNotFound(err): + return nil, grpc.Errorf(codes.NotFound, "container %v not found", r.ContainerID) + case containers.IsExists(err): + return nil, grpc.Errorf(codes.AlreadyExists, "container %v already exists", r.ContainerID) + } + + return nil, err + } + opts := plugin.CreateOpts{ - Spec: r.Spec.Value, + Spec: container.Spec, IO: plugin.IO{ Stdin: r.Stdin, Stdout: r.Stdout, @@ -114,38 +137,38 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create Options: m.Options, }) } - runtime, err := s.getRuntime(r.Runtime) + runtime, err := s.getRuntime(container.Runtime) if err != nil { return nil, err } s.mu.Lock() - if _, ok := s.containers[r.ID]; ok { + if _, ok := s.tasks[r.ContainerID]; ok { s.mu.Unlock() return nil, plugin.ErrContainerExists } - c, err := runtime.Create(ctx, r.ID, opts) + c, err := runtime.Create(ctx, r.ContainerID, opts) if err != nil { s.mu.Unlock() return nil, err } - s.containers[r.ID] = c + s.tasks[r.ContainerID] = c s.mu.Unlock() state, err := c.State(ctx) if err != nil { s.mu.Lock() - delete(s.containers, r.ID) + delete(s.tasks, r.ContainerID) runtime.Delete(ctx, c) s.mu.Unlock() return nil, err } return &api.CreateResponse{ - ID: r.ID, - Pid: state.Pid(), + ContainerID: r.ContainerID, + Pid: state.Pid(), }, nil } func (s *Service) Start(ctx context.Context, r *api.StartRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -156,7 +179,7 @@ func (s *Service) Start(ctx context.Context, r *api.StartRequest) (*google_proto } func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*api.DeleteResponse, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -169,7 +192,7 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*api.Delete return nil, err } - delete(s.containers, r.ID) + delete(s.tasks, r.ContainerID) return &api.DeleteResponse{ ExitStatus: exit.Status, @@ -177,26 +200,26 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*api.Delete }, nil } -func containerFromContainerd(ctx context.Context, c plugin.Container) (*container.Container, error) { +func taskFromContainerd(ctx context.Context, c plugin.Task) (*task.Task, error) { state, err := c.State(ctx) if err != nil { return nil, err } - var status container.Status + var status task.Status switch state.Status() { case plugin.CreatedStatus: - status = container.StatusCreated + status = task.StatusCreated case plugin.RunningStatus: - status = container.StatusRunning + status = task.StatusRunning case plugin.StoppedStatus: - status = container.StatusStopped + status = task.StatusStopped case plugin.PausedStatus: - status = container.StatusPaused + status = task.StatusPaused default: log.G(ctx).WithField("status", state.Status()).Warn("unknown status") } - return &container.Container{ + return &task.Task{ ID: c.Info().ID, Pid: state.Pid(), Status: status, @@ -207,30 +230,36 @@ func containerFromContainerd(ctx context.Context, c plugin.Container) (*containe }, nil } -func (s *Service) Info(ctx context.Context, r *api.InfoRequest) (*container.Container, error) { - c, err := s.getContainer(r.ID) +func (s *Service) Info(ctx context.Context, r *api.InfoRequest) (*api.InfoResponse, error) { + task, err := s.getTask(r.ContainerID) if err != nil { return nil, err } - return containerFromContainerd(ctx, c) + t, err := taskFromContainerd(ctx, task) + if err != nil { + return nil, err + } + return &api.InfoResponse{ + Task: t, + }, nil } func (s *Service) List(ctx context.Context, r *api.ListRequest) (*api.ListResponse, error) { resp := &api.ListResponse{} s.mu.Lock() defer s.mu.Unlock() - for _, cd := range s.containers { - c, err := containerFromContainerd(ctx, cd) + for _, cd := range s.tasks { + c, err := taskFromContainerd(ctx, cd) if err != nil { return nil, err } - resp.Containers = append(resp.Containers, c) + resp.Tasks = append(resp.Tasks, c) } return resp, nil } func (s *Service) Pause(ctx context.Context, r *api.PauseRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -242,7 +271,7 @@ func (s *Service) Pause(ctx context.Context, r *api.PauseRequest) (*google_proto } func (s *Service) Resume(ctx context.Context, r *api.ResumeRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -254,7 +283,7 @@ func (s *Service) Resume(ctx context.Context, r *api.ResumeRequest) (*google_pro } func (s *Service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -275,7 +304,7 @@ func (s *Service) Kill(ctx context.Context, r *api.KillRequest) (*google_protobu } func (s *Service) Processes(ctx context.Context, r *api.ProcessesRequest) (*api.ProcessesResponse, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -285,9 +314,9 @@ func (s *Service) Processes(ctx context.Context, r *api.ProcessesRequest) (*api. return nil, err } - ps := []*container.Process{} + ps := []*task.Process{} for _, pid := range pids { - ps = append(ps, &container.Process{ + ps = append(ps, &task.Process{ Pid: pid, }) } @@ -299,7 +328,7 @@ func (s *Service) Processes(ctx context.Context, r *api.ProcessesRequest) (*api. return resp, nil } -func (s *Service) Events(r *api.EventsRequest, server api.ContainerService_EventsServer) error { +func (s *Service) Events(r *api.EventsRequest, server api.Tasks_EventsServer) error { w := &grpcEventWriter{ server: server, } @@ -307,7 +336,7 @@ func (s *Service) Events(r *api.EventsRequest, server api.ContainerService_Event } func (s *Service) Exec(ctx context.Context, r *api.ExecRequest) (*api.ExecResponse, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -333,7 +362,7 @@ func (s *Service) Exec(ctx context.Context, r *api.ExecRequest) (*api.ExecRespon } func (s *Service) Pty(ctx context.Context, r *api.PtyRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -347,7 +376,7 @@ func (s *Service) Pty(ctx context.Context, r *api.PtyRequest) (*google_protobuf. } func (s *Service) CloseStdin(ctx context.Context, r *api.CloseStdinRequest) (*google_protobuf.Empty, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -358,7 +387,7 @@ func (s *Service) CloseStdin(ctx context.Context, r *api.CloseStdinRequest) (*go } func (s *Service) Checkpoint(ctx context.Context, r *api.CheckpointRequest) (*api.CheckpointResponse, error) { - c, err := s.getContainer(r.ID) + c, err := s.getTask(r.ContainerID) if err != nil { return nil, err } @@ -423,9 +452,9 @@ func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io. }, nil } -func (s *Service) getContainer(id string) (plugin.Container, error) { +func (s *Service) getTask(id string) (plugin.Task, error) { s.mu.Lock() - c, ok := s.containers[id] + c, ok := s.tasks[id] s.mu.Unlock() if !ok { return nil, plugin.ErrContainerNotExist @@ -442,26 +471,26 @@ func (s *Service) getRuntime(name string) (plugin.Runtime, error) { } type grpcEventWriter struct { - server api.ContainerService_EventsServer + server api.Tasks_EventsServer } func (g *grpcEventWriter) Write(e *plugin.Event) error { - var t container.Event_EventType + var t task.Event_EventType switch e.Type { case plugin.ExitEvent: - t = container.Event_EXIT + t = task.Event_EXIT case plugin.ExecAddEvent: - t = container.Event_EXEC_ADDED + t = task.Event_EXEC_ADDED case plugin.PausedEvent: - t = container.Event_PAUSED + t = task.Event_PAUSED case plugin.CreateEvent: - t = container.Event_CREATE + t = task.Event_CREATE case plugin.StartEvent: - t = container.Event_START + t = task.Event_START case plugin.OOMEvent: - t = container.Event_OOM + t = task.Event_OOM } - return g.server.Send(&container.Event{ + return g.server.Send(&task.Event{ Type: t, ID: e.ID, Pid: e.Pid, diff --git a/services/images/service.go b/services/images/service.go index 0863c2301..2310db4e3 100644 --- a/services/images/service.go +++ b/services/images/service.go @@ -73,7 +73,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.NewImageStore(tx)) } + return func(tx *bolt.Tx) error { return fn(ctx, images.NewStore(tx)) } } func (s *Service) withStoreView(ctx context.Context, fn func(ctx context.Context, store images.Store) error) error { diff --git a/windows/container.go b/windows/container.go index 60b57119f..0afed30e0 100644 --- a/windows/container.go +++ b/windows/container.go @@ -68,8 +68,8 @@ type container struct { sendEvent eventCallback } -func (c *container) Info() plugin.ContainerInfo { - return plugin.ContainerInfo{ +func (c *container) Info() plugin.TaskInfo { + return plugin.TaskInfo{ ID: c.ctr.ID(), Runtime: runtimeName, } diff --git a/windows/runtime.go b/windows/runtime.go index 2953d7a0b..e28d00e3e 100644 --- a/windows/runtime.go +++ b/windows/runtime.go @@ -100,7 +100,7 @@ type RuntimeSpec struct { hcs.Configuration } -func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Container, error) { +func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) (plugin.Task, error) { var rtSpec RuntimeSpec if err := json.Unmarshal(opts.Spec, &rtSpec); err != nil { return nil, errors.Wrap(err, "failed to unmarshal oci spec") @@ -118,7 +118,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) return ctr, nil } -func (r *Runtime) Delete(ctx context.Context, c plugin.Container) (*plugin.Exit, error) { +func (r *Runtime) Delete(ctx context.Context, c plugin.Task) (*plugin.Exit, error) { wc, ok := c.(*container) if !ok { return nil, fmt.Errorf("container cannot be cast as *windows.container") @@ -140,10 +140,10 @@ func (r *Runtime) Delete(ctx context.Context, c plugin.Container) (*plugin.Exit, }, nil } -func (r *Runtime) Containers(ctx context.Context) ([]plugin.Container, error) { +func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) { r.Lock() defer r.Unlock() - list := make([]plugin.Container, len(r.containers)) + list := make([]plugin.Task, len(r.containers)) for _, c := range r.containers { select { case <-ctx.Done(): From e1ed4a2ea469fa0dea78f1d0d7ce5a5c128221ef Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 23 May 2017 13:00:30 -0700 Subject: [PATCH 2/2] Add json storage for container storage This is just a temporary storage solution to get containers running on the new code. Signed-off-by: Derek McGowan --- cmd/ctr/delete.go | 9 +++- cmd/ctr/list.go | 9 +++- cmd/ctr/run.go | 6 +++ containers/storage.go | 99 +++++++++++++++++++++++++++++++++-- linux/runtime.go | 2 +- services/execution/service.go | 4 +- 6 files changed, 118 insertions(+), 11 deletions(-) diff --git a/cmd/ctr/delete.go b/cmd/ctr/delete.go index 64075e139..2d9500578 100644 --- a/cmd/ctr/delete.go +++ b/cmd/ctr/delete.go @@ -3,6 +3,9 @@ package main import ( gocontext "context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/pkg/errors" @@ -43,7 +46,11 @@ var deleteCommand = cli.Command{ ContainerID: id, }) if err != nil { - return errors.Wrap(err, "failed to delete container") + // Ignore error if task has already been removed, task is + // removed by default after run + if grpc.Code(errors.Cause(err)) != codes.NotFound { + return errors.Wrap(err, "failed to task container") + } } if err := snapshotter.Remove(ctx, id); err != nil { diff --git a/cmd/ctr/list.go b/cmd/ctr/list.go index 0aa66d68f..16e52c5df 100644 --- a/cmd/ctr/list.go +++ b/cmd/ctr/list.go @@ -65,18 +65,23 @@ var listCommand = cli.Command{ w := tabwriter.NewWriter(os.Stdout, 10, 1, 3, ' ', 0) fmt.Fprintln(w, "ID\tIMAGE\tPID\tSTATUS") for _, c := range response.Containers { - var status string + var ( + status string + pid uint32 + ) task, ok := tasksByContainerID[c.ID] if ok { status = task.Status.String() + pid = task.Pid } else { status = "STOPPED" // TODO(stevvooe): Is this assumption correct? + pid = 0 } if _, err := fmt.Fprintf(w, "%s\t%s\t%d\t%s\n", c.ID, c.Image, - task.Pid, + pid, status, ); err != nil { return err diff --git a/cmd/ctr/run.go b/cmd/ctr/run.go index 19b75df0f..cacd83e27 100644 --- a/cmd/ctr/run.go +++ b/cmd/ctr/run.go @@ -10,6 +10,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containerd/console" + containersapi "github.com/containerd/containerd/api/services/containers" "github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/images" "github.com/containerd/containerd/mount" @@ -294,6 +295,11 @@ var runCommand = cli.Command{ }); err != nil { return err } + if context.Bool("rm") { + if _, err := containers.Delete(ctx, &containersapi.DeleteContainerRequest{ID: id}); err != nil { + return err + } + } if status != 0 { return cli.NewExitError("", int(status)) } diff --git a/containers/storage.go b/containers/storage.go index 95fa2e086..f780c301d 100644 --- a/containers/storage.go +++ b/containers/storage.go @@ -2,6 +2,7 @@ package containers import ( "context" + "encoding/json" "github.com/boltdb/bolt" "github.com/pkg/errors" @@ -37,21 +38,109 @@ func NewStore(tx *bolt.Tx) Store { } func (s *storage) Get(ctx context.Context, id string) (Container, error) { - panic("not implemented") + bkt := s.bucket() + if bkt == nil { + return Container{}, errors.Wrap(ErrNotFound, "bucket does not exist") + } + + cb := bkt.Get([]byte(id)) + if len(cb) == 0 { + return Container{}, errors.Wrap(ErrNotFound, "no content for id") + } + + var container Container + if err := json.Unmarshal(cb, &container); err != nil { + return Container{}, errors.Wrap(err, "failed to unmarshal container") + } + + return container, nil } func (s *storage) List(ctx context.Context, filter string) ([]Container, error) { - panic("not implemented") + containers := []Container{} + bkt := s.bucket() + if bkt == nil { + return containers, nil + } + err := bkt.ForEach(func(k, v []byte) error { + container := Container{ID: string(k)} + if err := json.Unmarshal(v, &container); err != nil { + return errors.Wrap(err, "failed to unmarshal container") + } + containers = append(containers, container) + return nil + }) + if err != nil { + return nil, err + } + + return containers, nil } func (s *storage) Create(ctx context.Context, container Container) (Container, error) { - panic("not implemented") + bkt, err := s.createBucket() + if err != nil { + return Container{}, err + } + + b := bkt.Get([]byte(container.ID)) + if len(b) > 0 { + return Container{}, errors.Wrap(ErrExists, "content for id already exists") + } + + b, err = json.Marshal(container) + if err != nil { + return Container{}, err + } + + return container, bkt.Put([]byte(container.ID), b) } func (s *storage) Update(ctx context.Context, container Container) (Container, error) { - panic("not implemented") + bkt, err := s.createBucket() + if err != nil { + return Container{}, err + } + + b := bkt.Get([]byte(container.ID)) + if len(b) == 0 { + return Container{}, errors.Wrap(ErrNotFound, "no content for id") + } + + b, err = json.Marshal(container) + if err != nil { + return Container{}, err + } + + return container, bkt.Put([]byte(container.ID), b) } func (s *storage) Delete(ctx context.Context, id string) error { - panic("not implemented") + bkt, err := s.createBucket() + if err != nil { + return err + } + + b := bkt.Get([]byte(id)) + if len(b) == 0 { + return errors.Wrap(ErrNotFound, "no content for id") + } + + return bkt.Delete([]byte(id)) +} + +func (s *storage) bucket() *bolt.Bucket { + bkt := s.tx.Bucket(bucketKeyStorageVersion) + if bkt == nil { + return nil + } + return bkt.Bucket(bucketKeyContainers) +} + +func (s *storage) createBucket() (*bolt.Bucket, error) { + bkt, err := s.tx.CreateBucketIfNotExists(bucketKeyStorageVersion) + if err != nil { + return nil, err + } + return bkt.CreateBucketIfNotExists(bucketKeyContainers) } diff --git a/linux/runtime.go b/linux/runtime.go index 65220a613..cf1094ab4 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -128,7 +128,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts) return nil, err } c := newTask(id, opts.Spec, s) - // after the task is create add it to the monitor + // after the task is created, add it to the monitor if err = r.monitor.Monitor(c); err != nil { return nil, err } diff --git a/services/execution/service.go b/services/execution/service.go index ae68d9cb1..4a4483501 100644 --- a/services/execution/service.go +++ b/services/execution/service.go @@ -144,7 +144,7 @@ func (s *Service) Create(ctx context.Context, r *api.CreateRequest) (*api.Create s.mu.Lock() if _, ok := s.tasks[r.ContainerID]; ok { s.mu.Unlock() - return nil, plugin.ErrContainerExists + return nil, grpc.Errorf(codes.AlreadyExists, "task %v already exists", r.ContainerID) } c, err := runtime.Create(ctx, r.ContainerID, opts) if err != nil { @@ -457,7 +457,7 @@ func (s *Service) getTask(id string) (plugin.Task, error) { c, ok := s.tasks[id] s.mu.Unlock() if !ok { - return nil, plugin.ErrContainerNotExist + return nil, grpc.Errorf(codes.NotFound, "task %v not found", id) } return c, nil }