diff --git a/api/next.pb.txt b/api/next.pb.txt index 4e8b3041c..43cbe6c82 100644 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -928,6 +928,13 @@ file { } json_name: "extensions" } + field { + name: "sandbox" + number: 11 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandbox" + } nested_type { name: "LabelsEntry" field { @@ -2929,6 +2936,494 @@ file { } syntax: "proto3" } +file { + name: "github.com/containerd/containerd/api/types/sandbox.proto" + package: "containerd.types" + dependency: "gogoproto/gogo.proto" + dependency: "google/protobuf/any.proto" + dependency: "google/protobuf/timestamp.proto" + message_type { + name: "Sandbox" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "runtime" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.Runtime" + options { + 65001: 0 + } + json_name: "runtime" + } + field { + name: "spec" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "spec" + } + field { + name: "labels" + number: 4 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.LabelsEntry" + options { + 65001: 0 + } + json_name: "labels" + } + field { + name: "created_at" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "createdAt" + } + field { + name: "updated_at" + number: 6 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "updatedAt" + } + field { + name: "extensions" + number: 7 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox.ExtensionsEntry" + options { + 65001: 0 + } + json_name: "extensions" + } + nested_type { + name: "Runtime" + field { + name: "name" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "name" + } + field { + name: "options" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "options" + } + } + nested_type { + name: "LabelsEntry" + field { + name: "key" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "key" + } + field { + name: "value" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "value" + } + options { + map_entry: true + } + } + nested_type { + name: "ExtensionsEntry" + field { + name: "key" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "key" + } + field { + name: "value" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "value" + } + options { + map_entry: true + } + } + } + options { + go_package: "github.com/containerd/containerd/api/types;types" + } + weak_dependency: 0 + syntax: "proto3" +} +file { + name: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto" + package: "containerd.services.sandbox.v1" + dependency: "google/protobuf/any.proto" + dependency: "google/protobuf/timestamp.proto" + dependency: "gogoproto/gogo.proto" + dependency: "github.com/containerd/containerd/api/types/sandbox.proto" + dependency: "github.com/containerd/containerd/api/types/mount.proto" + message_type { + name: "StoreCreateRequest" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreCreateResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreUpdateRequest" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + field { + name: "fields" + number: 2 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "fields" + } + } + message_type { + name: "StoreUpdateResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "sandbox" + } + } + message_type { + name: "StoreDeleteRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "StoreDeleteResponse" + } + message_type { + name: "StoreListRequest" + field { + name: "filters" + number: 1 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "filters" + } + } + message_type { + name: "StoreListResponse" + field { + name: "list" + number: 1 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + options { + 65001: 0 + } + json_name: "list" + } + } + message_type { + name: "StoreGetRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "StoreGetResponse" + field { + name: "sandbox" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".containerd.types.Sandbox" + json_name: "sandbox" + } + } + message_type { + name: "ControllerStartRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "rootfs" + number: 2 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Mount" + json_name: "rootfs" + } + field { + name: "options" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "options" + } + } + message_type { + name: "ControllerStartResponse" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "pid" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "pid" + } + } + message_type { + name: "ControllerShutdownRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + field { + name: "timeout_secs" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "timeoutSecs" + } + } + message_type { + name: "ControllerShutdownResponse" + } + message_type { + name: "ControllerWaitRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerWaitResponse" + field { + name: "exit_status" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "exitStatus" + } + field { + name: "exited_at" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "exitedAt" + } + } + message_type { + name: "ControllerStatusRequest" + field { + name: "sandbox_id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "sandboxId" + } + } + message_type { + name: "ControllerStatusResponse" + field { + name: "id" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "id" + } + field { + name: "pid" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "pid" + } + field { + name: "state" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "state" + } + field { + name: "exit_status" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_UINT32 + json_name: "exitStatus" + } + field { + name: "exited_at" + number: 5 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "exitedAt" + } + field { + name: "extra" + number: 6 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "extra" + } + } + service { + name: "Store" + method { + name: "Create" + input_type: ".containerd.services.sandbox.v1.StoreCreateRequest" + output_type: ".containerd.services.sandbox.v1.StoreCreateResponse" + } + method { + name: "Update" + input_type: ".containerd.services.sandbox.v1.StoreUpdateRequest" + output_type: ".containerd.services.sandbox.v1.StoreUpdateResponse" + } + method { + name: "Delete" + input_type: ".containerd.services.sandbox.v1.StoreDeleteRequest" + output_type: ".containerd.services.sandbox.v1.StoreDeleteResponse" + } + method { + name: "List" + input_type: ".containerd.services.sandbox.v1.StoreListRequest" + output_type: ".containerd.services.sandbox.v1.StoreListResponse" + } + method { + name: "Get" + input_type: ".containerd.services.sandbox.v1.StoreGetRequest" + output_type: ".containerd.services.sandbox.v1.StoreGetResponse" + } + } + service { + name: "Controller" + method { + name: "Start" + input_type: ".containerd.services.sandbox.v1.ControllerStartRequest" + output_type: ".containerd.services.sandbox.v1.ControllerStartResponse" + } + method { + name: "Shutdown" + input_type: ".containerd.services.sandbox.v1.ControllerShutdownRequest" + output_type: ".containerd.services.sandbox.v1.ControllerShutdownResponse" + } + method { + name: "Wait" + input_type: ".containerd.services.sandbox.v1.ControllerWaitRequest" + output_type: ".containerd.services.sandbox.v1.ControllerWaitResponse" + } + method { + name: "Status" + input_type: ".containerd.services.sandbox.v1.ControllerStatusRequest" + output_type: ".containerd.services.sandbox.v1.ControllerStatusResponse" + } + } + options { + go_package: "github.com/containerd/containerd/api/services/sandbox/v1;sandbox" + } + weak_dependency: 2 + syntax: "proto3" +} file { name: "github.com/containerd/containerd/api/services/snapshots/v1/snapshots.proto" package: "containerd.services.snapshots.v1" diff --git a/api/services/containers/v1/containers.pb.go b/api/services/containers/v1/containers.pb.go index e2319a66a..909aa795e 100644 --- a/api/services/containers/v1/containers.pb.go +++ b/api/services/containers/v1/containers.pb.go @@ -81,10 +81,12 @@ type Container struct { // that should be unique against other extensions. When updating extension // data, one should only update the specified extension using field paths // to select a specific map key. - Extensions map[string]types.Any `protobuf:"bytes,10,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Extensions map[string]types.Any `protobuf:"bytes,10,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // Sandbox ID this container belongs to. + Sandbox string `protobuf:"bytes,11,opt,name=sandbox,proto3" json:"sandbox,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Container) Reset() { *m = Container{} } @@ -594,58 +596,59 @@ func init() { } var fileDescriptor_311afb8e15951042 = []byte{ - // 815 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x72, 0x12, 0x4d, - 0x14, 0xce, 0x00, 0x19, 0xc2, 0xe1, 0xaf, 0xfa, 0xff, 0xea, 0x1f, 0x71, 0x1c, 0xab, 0x80, 0xb0, - 0xa2, 0x2c, 0x1d, 0x12, 0xb4, 0xcc, 0xcd, 0x4d, 0xc8, 0xad, 0xd4, 0xc4, 0x4a, 0x4d, 0x74, 0xa3, - 0x8b, 0x38, 0x40, 0x87, 0x8c, 0xcc, 0xcd, 0xe9, 0x86, 0x92, 0x72, 0x11, 0x7d, 0x03, 0x77, 0x3e, - 0x82, 0xaf, 0x92, 0xa5, 0x4b, 0x57, 0xd1, 0x50, 0x3e, 0x88, 0x35, 0x3d, 0x3d, 0xcc, 0x84, 0x8b, - 0x42, 0x62, 0x76, 0x7d, 0xe8, 0xf3, 0x9d, 0xf3, 0xf5, 0x77, 0xfa, 0x6b, 0x06, 0x76, 0x9b, 0x3a, - 0x3d, 0x6e, 0xd7, 0x94, 0xba, 0x6d, 0x96, 0xeb, 0xb6, 0x45, 0x35, 0xdd, 0xc2, 0x6e, 0x23, 0xba, - 0xd4, 0x1c, 0xbd, 0x4c, 0xb0, 0xdb, 0xd1, 0xeb, 0x98, 0x84, 0xbf, 0x93, 0x72, 0x67, 0x31, 0x12, - 0x29, 0x8e, 0x6b, 0x53, 0x1b, 0xcd, 0x87, 0x38, 0x25, 0xc0, 0x28, 0x91, 0xac, 0xce, 0xa2, 0x9c, - 0x69, 0xda, 0x4d, 0x9b, 0x65, 0x97, 0xbd, 0x95, 0x0f, 0x94, 0x6f, 0x35, 0x6d, 0xbb, 0x69, 0xe0, - 0x32, 0x8b, 0x6a, 0xed, 0xa3, 0xb2, 0x66, 0x75, 0xf9, 0xd6, 0xed, 0xc1, 0x2d, 0x6c, 0x3a, 0x34, - 0xd8, 0x2c, 0x0c, 0x6e, 0x1e, 0xe9, 0xd8, 0x68, 0x1c, 0x9a, 0x1a, 0x69, 0xf1, 0x8c, 0xfc, 0x60, - 0x06, 0xd5, 0x4d, 0x4c, 0xa8, 0x66, 0x3a, 0x7e, 0x42, 0xf1, 0xb3, 0x08, 0xa9, 0x8d, 0x80, 0x22, - 0xca, 0x42, 0x4c, 0x6f, 0x48, 0x42, 0x41, 0x28, 0xa5, 0xaa, 0x62, 0xef, 0x2c, 0x1f, 0x7b, 0xbc, - 0xa9, 0xc6, 0xf4, 0x06, 0xda, 0x07, 0xd1, 0xd0, 0x6a, 0xd8, 0x20, 0x52, 0xac, 0x10, 0x2f, 0xa5, - 0x2b, 0xcb, 0xca, 0x1f, 0x8f, 0xaa, 0xf4, 0xab, 0x2a, 0xbb, 0x0c, 0xba, 0x65, 0x51, 0xb7, 0xab, - 0xf2, 0x3a, 0x28, 0x03, 0xb3, 0xba, 0xa9, 0x35, 0xb1, 0x14, 0xf7, 0x9a, 0xa9, 0x7e, 0x80, 0x9e, - 0x41, 0xd2, 0x6d, 0x5b, 0x1e, 0x47, 0x29, 0x51, 0x10, 0x4a, 0xe9, 0xca, 0x83, 0xa9, 0x1a, 0xa9, - 0x3e, 0x56, 0x0d, 0x8a, 0xa0, 0x12, 0x24, 0x88, 0x83, 0xeb, 0xd2, 0x2c, 0x2b, 0x96, 0x51, 0x7c, - 0x35, 0x94, 0x40, 0x0d, 0x65, 0xdd, 0xea, 0xaa, 0x2c, 0x03, 0x15, 0x20, 0x4d, 0x2c, 0xcd, 0x21, - 0xc7, 0x36, 0xa5, 0xd8, 0x95, 0x44, 0xc6, 0x2a, 0xfa, 0x13, 0x9a, 0x87, 0x7f, 0x82, 0xf0, 0xb0, - 0x85, 0xbb, 0x52, 0xf2, 0x62, 0xca, 0x53, 0xdc, 0x45, 0x1b, 0x00, 0x75, 0x17, 0x6b, 0x14, 0x37, - 0x0e, 0x35, 0x2a, 0xcd, 0xb1, 0xa6, 0xf2, 0x50, 0xd3, 0xe7, 0xc1, 0x08, 0xaa, 0x73, 0xa7, 0x67, - 0xf9, 0x99, 0x4f, 0xdf, 0xf3, 0x82, 0x9a, 0xe2, 0xb8, 0x75, 0xea, 0x15, 0x69, 0x3b, 0x8d, 0xa0, - 0x48, 0x6a, 0x9a, 0x22, 0x1c, 0xb7, 0x4e, 0x51, 0x0d, 0x00, 0xbf, 0xa3, 0xd8, 0x22, 0xba, 0x6d, - 0x11, 0x09, 0xd8, 0xd0, 0x1e, 0x4d, 0xa5, 0xe5, 0x56, 0x1f, 0xce, 0x06, 0x57, 0x4d, 0x78, 0x6d, - 0xd4, 0x48, 0x55, 0x79, 0x05, 0xd2, 0x91, 0xc9, 0xa2, 0xff, 0x20, 0xee, 0xc9, 0xc2, 0x2e, 0x8f, - 0xea, 0x2d, 0xbd, 0x19, 0x77, 0x34, 0xa3, 0x8d, 0xa5, 0x98, 0x3f, 0x63, 0x16, 0xac, 0xc6, 0x96, - 0x05, 0x79, 0x0f, 0x92, 0x7c, 0x56, 0x08, 0x41, 0xc2, 0xd2, 0x4c, 0xcc, 0x71, 0x6c, 0x8d, 0x14, - 0x48, 0xda, 0x0e, 0x65, 0xd4, 0x63, 0xbf, 0x99, 0x5c, 0x90, 0x24, 0x1f, 0xc0, 0xbf, 0x03, 0x74, - 0x47, 0xb0, 0xb9, 0x13, 0x65, 0x33, 0xae, 0x64, 0xc8, 0xb1, 0x78, 0x0f, 0xfe, 0xdf, 0xc1, 0xb4, - 0x2f, 0x88, 0x8a, 0xdf, 0xb6, 0x31, 0xa1, 0xe3, 0x2c, 0x52, 0x3c, 0x86, 0xcc, 0xc5, 0x74, 0xe2, - 0xd8, 0x16, 0xc1, 0x68, 0x1f, 0x52, 0x7d, 0x89, 0x19, 0x2c, 0x5d, 0xb9, 0x3b, 0xcd, 0x20, 0xb8, - 0xf0, 0x61, 0x91, 0xe2, 0x22, 0xdc, 0xd8, 0xd5, 0x49, 0xd8, 0x8a, 0x04, 0xd4, 0x24, 0x48, 0x1e, - 0xe9, 0x06, 0xc5, 0x2e, 0x91, 0x84, 0x42, 0xbc, 0x94, 0x52, 0x83, 0xb0, 0x68, 0x40, 0x76, 0x10, - 0xc2, 0xe9, 0xa9, 0x00, 0x61, 0x63, 0x06, 0xbb, 0x1c, 0xbf, 0x48, 0x95, 0xe2, 0x1b, 0xc8, 0x6e, - 0xb0, 0xeb, 0x3c, 0x24, 0xde, 0xdf, 0x17, 0xa3, 0x05, 0x37, 0x87, 0x7a, 0x5d, 0x9b, 0xf2, 0x5f, - 0x04, 0xc8, 0xbe, 0x60, 0x1e, 0xbb, 0xfe, 0x93, 0xa1, 0x35, 0x48, 0xfb, 0x7e, 0x66, 0xef, 0x39, - 0xbf, 0xb5, 0xc3, 0x0f, 0xc1, 0xb6, 0xf7, 0xe4, 0xef, 0x69, 0xa4, 0xa5, 0xf2, 0x67, 0xc3, 0x5b, - 0x7b, 0xb2, 0x0c, 0x11, 0xbd, 0x36, 0x59, 0x16, 0x20, 0xbb, 0x89, 0x0d, 0x3c, 0x42, 0x95, 0x71, - 0x66, 0xa9, 0x41, 0xe6, 0xc2, 0x7d, 0xdc, 0xc3, 0x84, 0x78, 0xef, 0xff, 0x93, 0x2b, 0x72, 0x8b, - 0xb0, 0xaa, 0xfc, 0x9c, 0x05, 0x08, 0x2f, 0x3c, 0xea, 0x40, 0x7c, 0x07, 0x53, 0xf4, 0x70, 0x82, - 0x72, 0x23, 0x6c, 0x2f, 0x2f, 0x4d, 0x8d, 0xe3, 0x72, 0xbf, 0x87, 0x84, 0x77, 0x54, 0x34, 0xc9, - 0x5f, 0xe6, 0x48, 0x5b, 0xcb, 0x2b, 0x97, 0x40, 0xf2, 0xe6, 0x1f, 0x05, 0x00, 0x6f, 0xeb, 0x80, - 0xba, 0x58, 0x33, 0xaf, 0xc0, 0x61, 0x69, 0x5a, 0x24, 0x9f, 0xe8, 0x82, 0x80, 0x4e, 0x40, 0xf4, - 0x1d, 0x8a, 0x26, 0x39, 0xc8, 0xe8, 0x87, 0x43, 0x5e, 0xbd, 0x0c, 0x94, 0x8b, 0x70, 0x02, 0xa2, - 0xef, 0x85, 0x89, 0x08, 0x8c, 0xf6, 0xf7, 0x44, 0x04, 0xc6, 0x39, 0xee, 0x15, 0x88, 0xbe, 0x3f, - 0x26, 0x22, 0x30, 0xda, 0x4a, 0x72, 0x76, 0xc8, 0xf9, 0x5b, 0xde, 0x97, 0x60, 0xf5, 0xf5, 0xe9, - 0x79, 0x6e, 0xe6, 0xdb, 0x79, 0x6e, 0xe6, 0x43, 0x2f, 0x27, 0x9c, 0xf6, 0x72, 0xc2, 0xd7, 0x5e, - 0x4e, 0xf8, 0xd1, 0xcb, 0x09, 0x2f, 0xb7, 0xaf, 0xf0, 0x71, 0xbb, 0x16, 0x46, 0x35, 0x91, 0x75, - 0xbc, 0xff, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x77, 0xc8, 0x5c, 0x78, 0x2d, 0x0b, 0x00, 0x00, + // 832 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x72, 0x1a, 0x47, + 0x14, 0xd5, 0x00, 0x1a, 0xc4, 0x25, 0x55, 0x49, 0x75, 0x08, 0x99, 0x4c, 0xaa, 0x00, 0xb1, 0xa2, + 0x52, 0xc9, 0x20, 0x91, 0x54, 0xf4, 0xca, 0x46, 0xe8, 0x55, 0x49, 0xa4, 0x94, 0x6a, 0x94, 0x6c, + 0xe2, 0x85, 0x3c, 0x40, 0x0b, 0x8d, 0x99, 0x97, 0xa7, 0x1b, 0x4a, 0x94, 0x17, 0xb2, 0xff, 0xc0, + 0x7f, 0xe1, 0xb5, 0xff, 0x42, 0x4b, 0x2f, 0xbd, 0x92, 0x2d, 0xca, 0x1f, 0xe2, 0xea, 0x9e, 0x1e, + 0x66, 0xc4, 0xc3, 0x06, 0xc9, 0xda, 0xf5, 0xa5, 0xef, 0xb9, 0xf7, 0xf4, 0xb9, 0x7d, 0x7a, 0x80, + 0xc3, 0xb6, 0x49, 0xcf, 0xbb, 0x0d, 0xad, 0xe9, 0xda, 0xd5, 0xa6, 0xeb, 0x50, 0xc3, 0x74, 0xb0, + 0xdf, 0x8a, 0x2f, 0x0d, 0xcf, 0xac, 0x12, 0xec, 0xf7, 0xcc, 0x26, 0x26, 0xd1, 0xef, 0xa4, 0xda, + 0x5b, 0x8d, 0x45, 0x9a, 0xe7, 0xbb, 0xd4, 0x45, 0xcb, 0x11, 0x4e, 0x0b, 0x31, 0x5a, 0x2c, 0xab, + 0xb7, 0xaa, 0xe6, 0xda, 0x6e, 0xdb, 0xe5, 0xd9, 0x55, 0xb6, 0x0a, 0x80, 0xea, 0x0f, 0x6d, 0xd7, + 0x6d, 0x5b, 0xb8, 0xca, 0xa3, 0x46, 0xf7, 0xac, 0x6a, 0x38, 0x7d, 0xb1, 0xf5, 0xe3, 0xe8, 0x16, + 0xb6, 0x3d, 0x1a, 0x6e, 0x96, 0x46, 0x37, 0xcf, 0x4c, 0x6c, 0xb5, 0x4e, 0x6d, 0x83, 0x74, 0x44, + 0x46, 0x71, 0x34, 0x83, 0x9a, 0x36, 0x26, 0xd4, 0xb0, 0xbd, 0x20, 0xa1, 0xfc, 0x5a, 0x86, 0xcc, + 0x4e, 0x48, 0x11, 0xe5, 0x21, 0x61, 0xb6, 0x14, 0xa9, 0x24, 0x55, 0x32, 0x75, 0x79, 0x70, 0x5d, + 0x4c, 0xfc, 0xb9, 0xab, 0x27, 0xcc, 0x16, 0x3a, 0x06, 0xd9, 0x32, 0x1a, 0xd8, 0x22, 0x4a, 0xa2, + 0x94, 0xac, 0x64, 0x6b, 0xeb, 0xda, 0x67, 0x8f, 0xaa, 0x0d, 0xab, 0x6a, 0x87, 0x1c, 0xba, 0xe7, + 0x50, 0xbf, 0xaf, 0x8b, 0x3a, 0x28, 0x07, 0x8b, 0xa6, 0x6d, 0xb4, 0xb1, 0x92, 0x64, 0xcd, 0xf4, + 0x20, 0x40, 0xff, 0x40, 0xda, 0xef, 0x3a, 0x8c, 0xa3, 0x92, 0x2a, 0x49, 0x95, 0x6c, 0xed, 0xb7, + 0xb9, 0x1a, 0xe9, 0x01, 0x56, 0x0f, 0x8b, 0xa0, 0x0a, 0xa4, 0x88, 0x87, 0x9b, 0xca, 0x22, 0x2f, + 0x96, 0xd3, 0x02, 0x35, 0xb4, 0x50, 0x0d, 0x6d, 0xdb, 0xe9, 0xeb, 0x3c, 0x03, 0x95, 0x20, 0x4b, + 0x1c, 0xc3, 0x23, 0xe7, 0x2e, 0xa5, 0xd8, 0x57, 0x64, 0xce, 0x2a, 0xfe, 0x13, 0x5a, 0x86, 0xaf, + 0xc2, 0xf0, 0xb4, 0x83, 0xfb, 0x4a, 0xfa, 0x76, 0xca, 0xdf, 0xb8, 0x8f, 0x76, 0x00, 0x9a, 0x3e, + 0x36, 0x28, 0x6e, 0x9d, 0x1a, 0x54, 0x59, 0xe2, 0x4d, 0xd5, 0xb1, 0xa6, 0xff, 0x86, 0x23, 0xa8, + 0x2f, 0x5d, 0x5d, 0x17, 0x17, 0x5e, 0xbe, 0x2b, 0x4a, 0x7a, 0x46, 0xe0, 0xb6, 0x29, 0x2b, 0xd2, + 0xf5, 0x5a, 0x61, 0x91, 0xcc, 0x3c, 0x45, 0x04, 0x6e, 0x9b, 0xa2, 0x06, 0x00, 0xbe, 0xa0, 0xd8, + 0x21, 0xa6, 0xeb, 0x10, 0x05, 0xf8, 0xd0, 0xfe, 0x98, 0x4b, 0xcb, 0xbd, 0x21, 0x9c, 0x0f, 0xae, + 0x9e, 0x62, 0x6d, 0xf4, 0x58, 0x55, 0xa4, 0x40, 0x9a, 0x18, 0x4e, 0xab, 0xe1, 0x5e, 0x28, 0x59, + 0xae, 0x45, 0x18, 0xaa, 0x1b, 0x90, 0x8d, 0xcd, 0x1c, 0x7d, 0x03, 0x49, 0x26, 0x18, 0xbf, 0x56, + 0x3a, 0x5b, 0xb2, 0xe9, 0xf7, 0x0c, 0xab, 0x8b, 0x95, 0x44, 0x30, 0x7d, 0x1e, 0x6c, 0x26, 0xd6, + 0x25, 0xf5, 0x08, 0xd2, 0x62, 0x8a, 0x08, 0x41, 0xca, 0x31, 0x6c, 0x2c, 0x70, 0x7c, 0x8d, 0x34, + 0x48, 0xbb, 0x1e, 0xe5, 0x87, 0x4a, 0x7c, 0x62, 0xa6, 0x61, 0x92, 0x7a, 0x02, 0x5f, 0x8f, 0x1c, + 0x64, 0x02, 0x9b, 0x9f, 0xe2, 0x6c, 0xa6, 0x95, 0x8c, 0x38, 0x96, 0x7f, 0x81, 0x6f, 0x0f, 0x30, + 0x1d, 0x4a, 0xa5, 0xe3, 0xa7, 0x5d, 0x4c, 0xe8, 0x34, 0xf3, 0x94, 0xcf, 0x21, 0x77, 0x3b, 0x9d, + 0x78, 0xae, 0x43, 0x30, 0x3a, 0x86, 0xcc, 0x50, 0x7c, 0x0e, 0xcb, 0xd6, 0x7e, 0x9e, 0x67, 0x44, + 0x62, 0x24, 0x51, 0x91, 0xf2, 0x2a, 0x7c, 0x77, 0x68, 0x92, 0xa8, 0x15, 0x09, 0xa9, 0x29, 0x90, + 0x3e, 0x33, 0x2d, 0x8a, 0x7d, 0xa2, 0x48, 0xa5, 0x24, 0x1b, 0x95, 0x08, 0xcb, 0x16, 0xe4, 0x47, + 0x21, 0x82, 0x9e, 0x0e, 0x10, 0x35, 0xe6, 0xb0, 0xbb, 0xf1, 0x8b, 0x55, 0x29, 0x3f, 0x81, 0xfc, + 0x0e, 0xbf, 0xe8, 0x63, 0xe2, 0x7d, 0x79, 0x31, 0x3a, 0xf0, 0xfd, 0x58, 0xaf, 0x07, 0x53, 0xfe, + 0x95, 0x04, 0xf9, 0xff, 0xb8, 0xfb, 0x1e, 0xfe, 0x64, 0x68, 0x0b, 0xb2, 0x81, 0xd3, 0xf9, 0x4b, + 0x2f, 0x6e, 0xed, 0xf8, 0x13, 0xb1, 0xcf, 0x3e, 0x06, 0x47, 0x06, 0xe9, 0xe8, 0xe2, 0x41, 0x61, + 0x6b, 0x26, 0xcb, 0x18, 0xd1, 0x07, 0x93, 0x65, 0x05, 0xf2, 0xbb, 0xd8, 0xc2, 0x13, 0x54, 0x99, + 0x66, 0x96, 0x06, 0xe4, 0x6e, 0xdd, 0xc7, 0x23, 0x4c, 0x08, 0xfb, 0x32, 0xfc, 0x75, 0x4f, 0x6e, + 0x31, 0x56, 0xb5, 0x0f, 0x8b, 0x00, 0xd1, 0x85, 0x47, 0x3d, 0x48, 0x1e, 0x60, 0x8a, 0x7e, 0x9f, + 0xa1, 0xdc, 0x04, 0xdb, 0xab, 0x6b, 0x73, 0xe3, 0x84, 0xdc, 0xcf, 0x20, 0xc5, 0x8e, 0x8a, 0x66, + 0xf9, 0x98, 0x4e, 0xb4, 0xb5, 0xba, 0x71, 0x07, 0xa4, 0x68, 0xfe, 0x42, 0x02, 0x60, 0x5b, 0x27, + 0xd4, 0xc7, 0x86, 0x7d, 0x0f, 0x0e, 0x6b, 0xf3, 0x22, 0xc5, 0x44, 0x57, 0x24, 0x74, 0x09, 0x72, + 0xe0, 0x50, 0x34, 0xcb, 0x41, 0x26, 0x3f, 0x1c, 0xea, 0xe6, 0x5d, 0xa0, 0x42, 0x84, 0x4b, 0x90, + 0x03, 0x2f, 0xcc, 0x44, 0x60, 0xb2, 0xbf, 0x67, 0x22, 0x30, 0xcd, 0x71, 0x8f, 0x40, 0x0e, 0xfc, + 0x31, 0x13, 0x81, 0xc9, 0x56, 0x52, 0xf3, 0x63, 0xce, 0xdf, 0x63, 0xff, 0x11, 0xeb, 0x8f, 0xaf, + 0x6e, 0x0a, 0x0b, 0x6f, 0x6f, 0x0a, 0x0b, 0xcf, 0x07, 0x05, 0xe9, 0x6a, 0x50, 0x90, 0xde, 0x0c, + 0x0a, 0xd2, 0xfb, 0x41, 0x41, 0xfa, 0x7f, 0xff, 0x1e, 0x7f, 0x7b, 0xb7, 0xa2, 0xa8, 0x21, 0xf3, + 0x8e, 0xbf, 0x7e, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xef, 0xe7, 0xe1, 0xb7, 0x47, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -960,6 +963,13 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.Sandbox) > 0 { + i -= len(m.Sandbox) + copy(dAtA[i:], m.Sandbox) + i = encodeVarintContainers(dAtA, i, uint64(len(m.Sandbox))) + i-- + dAtA[i] = 0x5a + } if len(m.Extensions) > 0 { for k := range m.Extensions { v := m.Extensions[k] @@ -1563,6 +1573,10 @@ func (m *Container) Size() (n int) { n += mapEntrySize + 1 + sovContainers(uint64(mapEntrySize)) } } + l = len(m.Sandbox) + if l > 0 { + n += 1 + l + sovContainers(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1788,6 +1802,7 @@ func (this *Container) String() string { `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, `Extensions:` + mapStringForExtensions + `,`, + `Sandbox:` + fmt.Sprintf("%v", this.Sandbox) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2480,6 +2495,38 @@ func (m *Container) Unmarshal(dAtA []byte) error { } m.Extensions[mapkey] = *mapvalue iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", 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 < 0 { + return ErrInvalidLengthContainers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sandbox = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipContainers(dAtA[iNdEx:]) diff --git a/api/services/containers/v1/containers.proto b/api/services/containers/v1/containers.proto index 8b51e3393..28bc5628d 100644 --- a/api/services/containers/v1/containers.proto +++ b/api/services/containers/v1/containers.proto @@ -114,6 +114,9 @@ message Container { // data, one should only update the specified extension using field paths // to select a specific map key. map extensions = 10 [(gogoproto.nullable) = false]; + + // Sandbox ID this container belongs to. + string sandbox = 11; } message GetContainerRequest { diff --git a/api/services/sandbox/v1/doc.go b/api/services/sandbox/v1/doc.go new file mode 100644 index 000000000..f960350c1 --- /dev/null +++ b/api/services/sandbox/v1/doc.go @@ -0,0 +1,17 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox diff --git a/api/services/sandbox/v1/sandbox.pb.go b/api/services/sandbox/v1/sandbox.pb.go new file mode 100644 index 000000000..94403a005 --- /dev/null +++ b/api/services/sandbox/v1/sandbox.pb.go @@ -0,0 +1,4333 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto + +// Sandbox is a v2 runtime extension that allows more complex execution environments for containers. +// This adds a notion of groups of containers that share same lifecycle and/or resources. +// A few good fits for sandbox can be: +// - A "pause" container in k8s, that acts as a parent process for child containers to hold network namespace. +// - (micro)VMs that launch a VM process and executes containers inside guest OS. +// containerd in this case remains implementation agnostic and delegates sandbox handling to runtimes. +// See proposal and discussion here: https://github.com/containerd/containerd/issues/4131 + +package sandbox + +import ( + context "context" + fmt "fmt" + types "github.com/containerd/containerd/api/types" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types1 "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type StoreCreateRequest struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreCreateRequest) Reset() { *m = StoreCreateRequest{} } +func (*StoreCreateRequest) ProtoMessage() {} +func (*StoreCreateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{0} +} +func (m *StoreCreateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreCreateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreCreateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreCreateRequest.Merge(m, src) +} +func (m *StoreCreateRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreCreateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreCreateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreCreateRequest proto.InternalMessageInfo + +type StoreCreateResponse struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreCreateResponse) Reset() { *m = StoreCreateResponse{} } +func (*StoreCreateResponse) ProtoMessage() {} +func (*StoreCreateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{1} +} +func (m *StoreCreateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreCreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreCreateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreCreateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreCreateResponse.Merge(m, src) +} +func (m *StoreCreateResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreCreateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreCreateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreCreateResponse proto.InternalMessageInfo + +type StoreUpdateRequest struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + Fields []string `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreUpdateRequest) Reset() { *m = StoreUpdateRequest{} } +func (*StoreUpdateRequest) ProtoMessage() {} +func (*StoreUpdateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{2} +} +func (m *StoreUpdateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreUpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreUpdateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreUpdateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreUpdateRequest.Merge(m, src) +} +func (m *StoreUpdateRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreUpdateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreUpdateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreUpdateRequest proto.InternalMessageInfo + +type StoreUpdateResponse struct { + Sandbox types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreUpdateResponse) Reset() { *m = StoreUpdateResponse{} } +func (*StoreUpdateResponse) ProtoMessage() {} +func (*StoreUpdateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{3} +} +func (m *StoreUpdateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreUpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreUpdateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreUpdateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreUpdateResponse.Merge(m, src) +} +func (m *StoreUpdateResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreUpdateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreUpdateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreUpdateResponse proto.InternalMessageInfo + +type StoreDeleteRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreDeleteRequest) Reset() { *m = StoreDeleteRequest{} } +func (*StoreDeleteRequest) ProtoMessage() {} +func (*StoreDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{4} +} +func (m *StoreDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreDeleteRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreDeleteRequest.Merge(m, src) +} +func (m *StoreDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreDeleteRequest proto.InternalMessageInfo + +type StoreDeleteResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreDeleteResponse) Reset() { *m = StoreDeleteResponse{} } +func (*StoreDeleteResponse) ProtoMessage() {} +func (*StoreDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{5} +} +func (m *StoreDeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreDeleteResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreDeleteResponse.Merge(m, src) +} +func (m *StoreDeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreDeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreDeleteResponse proto.InternalMessageInfo + +type StoreListRequest struct { + Filters []string `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreListRequest) Reset() { *m = StoreListRequest{} } +func (*StoreListRequest) ProtoMessage() {} +func (*StoreListRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{6} +} +func (m *StoreListRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreListRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreListRequest.Merge(m, src) +} +func (m *StoreListRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreListRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreListRequest proto.InternalMessageInfo + +type StoreListResponse struct { + List []types.Sandbox `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreListResponse) Reset() { *m = StoreListResponse{} } +func (*StoreListResponse) ProtoMessage() {} +func (*StoreListResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{7} +} +func (m *StoreListResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreListResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreListResponse.Merge(m, src) +} +func (m *StoreListResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreListResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreListResponse proto.InternalMessageInfo + +type StoreGetRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreGetRequest) Reset() { *m = StoreGetRequest{} } +func (*StoreGetRequest) ProtoMessage() {} +func (*StoreGetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{8} +} +func (m *StoreGetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreGetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreGetRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreGetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreGetRequest.Merge(m, src) +} +func (m *StoreGetRequest) XXX_Size() int { + return m.Size() +} +func (m *StoreGetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StoreGetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreGetRequest proto.InternalMessageInfo + +type StoreGetResponse struct { + Sandbox *types.Sandbox `protobuf:"bytes,1,opt,name=sandbox,proto3" json:"sandbox,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StoreGetResponse) Reset() { *m = StoreGetResponse{} } +func (*StoreGetResponse) ProtoMessage() {} +func (*StoreGetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{9} +} +func (m *StoreGetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreGetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreGetResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StoreGetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreGetResponse.Merge(m, src) +} +func (m *StoreGetResponse) XXX_Size() int { + return m.Size() +} +func (m *StoreGetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StoreGetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreGetResponse proto.InternalMessageInfo + +type ControllerStartRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + Rootfs []*types.Mount `protobuf:"bytes,2,rep,name=rootfs,proto3" json:"rootfs,omitempty"` + Options *types1.Any `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStartRequest) Reset() { *m = ControllerStartRequest{} } +func (*ControllerStartRequest) ProtoMessage() {} +func (*ControllerStartRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{10} +} +func (m *ControllerStartRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStartRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerStartRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStartRequest.Merge(m, src) +} +func (m *ControllerStartRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerStartRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStartRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStartRequest proto.InternalMessageInfo + +type ControllerStartResponse struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStartResponse) Reset() { *m = ControllerStartResponse{} } +func (*ControllerStartResponse) ProtoMessage() {} +func (*ControllerStartResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{11} +} +func (m *ControllerStartResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStartResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStartResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerStartResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStartResponse.Merge(m, src) +} +func (m *ControllerStartResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerStartResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStartResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStartResponse proto.InternalMessageInfo + +type ControllerShutdownRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + TimeoutSecs uint32 `protobuf:"varint,2,opt,name=timeout_secs,json=timeoutSecs,proto3" json:"timeout_secs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerShutdownRequest) Reset() { *m = ControllerShutdownRequest{} } +func (*ControllerShutdownRequest) ProtoMessage() {} +func (*ControllerShutdownRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{12} +} +func (m *ControllerShutdownRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerShutdownRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerShutdownRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerShutdownRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerShutdownRequest.Merge(m, src) +} +func (m *ControllerShutdownRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerShutdownRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerShutdownRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerShutdownRequest proto.InternalMessageInfo + +type ControllerShutdownResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerShutdownResponse) Reset() { *m = ControllerShutdownResponse{} } +func (*ControllerShutdownResponse) ProtoMessage() {} +func (*ControllerShutdownResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{13} +} +func (m *ControllerShutdownResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerShutdownResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerShutdownResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerShutdownResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerShutdownResponse.Merge(m, src) +} +func (m *ControllerShutdownResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerShutdownResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerShutdownResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerShutdownResponse proto.InternalMessageInfo + +type ControllerWaitRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerWaitRequest) Reset() { *m = ControllerWaitRequest{} } +func (*ControllerWaitRequest) ProtoMessage() {} +func (*ControllerWaitRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{14} +} +func (m *ControllerWaitRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerWaitRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerWaitRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerWaitRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerWaitRequest.Merge(m, src) +} +func (m *ControllerWaitRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerWaitRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerWaitRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerWaitRequest proto.InternalMessageInfo + +type ControllerWaitResponse struct { + ExitStatus uint32 `protobuf:"varint,1,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,2,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerWaitResponse) Reset() { *m = ControllerWaitResponse{} } +func (*ControllerWaitResponse) ProtoMessage() {} +func (*ControllerWaitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{15} +} +func (m *ControllerWaitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerWaitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerWaitResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerWaitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerWaitResponse.Merge(m, src) +} +func (m *ControllerWaitResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerWaitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerWaitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerWaitResponse proto.InternalMessageInfo + +type ControllerStatusRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStatusRequest) Reset() { *m = ControllerStatusRequest{} } +func (*ControllerStatusRequest) ProtoMessage() {} +func (*ControllerStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{16} +} +func (m *ControllerStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStatusRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStatusRequest.Merge(m, src) +} +func (m *ControllerStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *ControllerStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStatusRequest proto.InternalMessageInfo + +type ControllerStatusResponse 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"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + Extra *types1.Any `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ControllerStatusResponse) Reset() { *m = ControllerStatusResponse{} } +func (*ControllerStatusResponse) ProtoMessage() {} +func (*ControllerStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d6eb1ebcbc2879f1, []int{17} +} +func (m *ControllerStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ControllerStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ControllerStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ControllerStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ControllerStatusResponse.Merge(m, src) +} +func (m *ControllerStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *ControllerStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ControllerStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ControllerStatusResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*StoreCreateRequest)(nil), "containerd.services.sandbox.v1.StoreCreateRequest") + proto.RegisterType((*StoreCreateResponse)(nil), "containerd.services.sandbox.v1.StoreCreateResponse") + proto.RegisterType((*StoreUpdateRequest)(nil), "containerd.services.sandbox.v1.StoreUpdateRequest") + proto.RegisterType((*StoreUpdateResponse)(nil), "containerd.services.sandbox.v1.StoreUpdateResponse") + proto.RegisterType((*StoreDeleteRequest)(nil), "containerd.services.sandbox.v1.StoreDeleteRequest") + proto.RegisterType((*StoreDeleteResponse)(nil), "containerd.services.sandbox.v1.StoreDeleteResponse") + proto.RegisterType((*StoreListRequest)(nil), "containerd.services.sandbox.v1.StoreListRequest") + proto.RegisterType((*StoreListResponse)(nil), "containerd.services.sandbox.v1.StoreListResponse") + proto.RegisterType((*StoreGetRequest)(nil), "containerd.services.sandbox.v1.StoreGetRequest") + proto.RegisterType((*StoreGetResponse)(nil), "containerd.services.sandbox.v1.StoreGetResponse") + proto.RegisterType((*ControllerStartRequest)(nil), "containerd.services.sandbox.v1.ControllerStartRequest") + proto.RegisterType((*ControllerStartResponse)(nil), "containerd.services.sandbox.v1.ControllerStartResponse") + proto.RegisterType((*ControllerShutdownRequest)(nil), "containerd.services.sandbox.v1.ControllerShutdownRequest") + proto.RegisterType((*ControllerShutdownResponse)(nil), "containerd.services.sandbox.v1.ControllerShutdownResponse") + proto.RegisterType((*ControllerWaitRequest)(nil), "containerd.services.sandbox.v1.ControllerWaitRequest") + proto.RegisterType((*ControllerWaitResponse)(nil), "containerd.services.sandbox.v1.ControllerWaitResponse") + proto.RegisterType((*ControllerStatusRequest)(nil), "containerd.services.sandbox.v1.ControllerStatusRequest") + proto.RegisterType((*ControllerStatusResponse)(nil), "containerd.services.sandbox.v1.ControllerStatusResponse") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", fileDescriptor_d6eb1ebcbc2879f1) +} + +var fileDescriptor_d6eb1ebcbc2879f1 = []byte{ + // 859 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0xae, 0xf3, 0xe3, 0x36, 0x27, 0x54, 0x5c, 0x86, 0xde, 0x5e, 0xd7, 0x42, 0x49, 0xf1, 0xaa, + 0x42, 0x57, 0xf6, 0x6d, 0x2a, 0xca, 0x2d, 0x2c, 0xa0, 0x69, 0x21, 0x54, 0x02, 0x81, 0x1c, 0x10, + 0xd0, 0x4d, 0xe4, 0xc4, 0x93, 0xd4, 0xc2, 0xf1, 0x38, 0x9e, 0x71, 0x49, 0x05, 0x0b, 0x78, 0x03, + 0xde, 0x82, 0x47, 0xe0, 0x15, 0xba, 0x64, 0xc9, 0xaa, 0xd0, 0x2c, 0x79, 0x08, 0x84, 0x3c, 0x1e, + 0xd7, 0xf9, 0xa9, 0x8a, 0xed, 0xde, 0xdd, 0x78, 0x72, 0xbe, 0xef, 0x7c, 0xe7, 0xcc, 0xcc, 0x77, + 0x02, 0x9f, 0x8c, 0x1c, 0x76, 0x11, 0xf6, 0xf5, 0x01, 0x19, 0x1b, 0x03, 0xe2, 0x31, 0xcb, 0xf1, + 0x70, 0x60, 0xcf, 0x2f, 0x2d, 0xdf, 0x31, 0x28, 0x0e, 0x2e, 0x9d, 0x01, 0xa6, 0x06, 0xb5, 0x3c, + 0xbb, 0x4f, 0xa6, 0xc6, 0xe5, 0x7e, 0xb2, 0xd4, 0xfd, 0x80, 0x30, 0x82, 0x1a, 0x29, 0x42, 0x4f, + 0xa2, 0xf5, 0x24, 0xe4, 0x72, 0x5f, 0xdd, 0x19, 0x11, 0x32, 0x72, 0xb1, 0xc1, 0xa3, 0xfb, 0xe1, + 0xd0, 0xb0, 0xbc, 0xab, 0x18, 0xaa, 0x36, 0x97, 0x7f, 0x62, 0xce, 0x18, 0x53, 0x66, 0x8d, 0x7d, + 0x11, 0xb0, 0x35, 0x22, 0x23, 0xc2, 0x97, 0x46, 0xb4, 0x12, 0xbb, 0x2f, 0x33, 0x29, 0x67, 0x57, + 0x7e, 0x2a, 0x5b, 0x20, 0x0f, 0x73, 0x20, 0xc7, 0x24, 0xf4, 0x58, 0x8c, 0xd3, 0xbe, 0x00, 0xd4, + 0x65, 0x24, 0xc0, 0x27, 0x01, 0xb6, 0x18, 0x36, 0xf1, 0x24, 0xc4, 0x94, 0xa1, 0x23, 0x58, 0x17, + 0xf4, 0x8a, 0xb4, 0x2b, 0xed, 0xd5, 0x5b, 0x3b, 0xfa, 0x5c, 0x2f, 0x38, 0x8b, 0xde, 0x8d, 0x03, + 0xda, 0x95, 0xeb, 0x9b, 0xe6, 0x9a, 0x99, 0xc4, 0x6b, 0x5f, 0xc2, 0x9b, 0x0b, 0x84, 0xd4, 0x27, + 0x1e, 0xc5, 0x8f, 0x61, 0x1c, 0x09, 0x89, 0x5f, 0xfb, 0xf6, 0x2b, 0x91, 0x88, 0xb6, 0x41, 0x1e, + 0x3a, 0xd8, 0xb5, 0xa9, 0x52, 0xda, 0x2d, 0xef, 0xd5, 0x4c, 0xf1, 0x75, 0x27, 0x3d, 0x49, 0xf4, + 0x78, 0xe9, 0x6d, 0x21, 0xfd, 0x14, 0xbb, 0x38, 0x95, 0xfe, 0x1c, 0x40, 0x04, 0xf4, 0x1c, 0x9b, + 0x73, 0xd6, 0xda, 0x9b, 0xb3, 0x9b, 0x66, 0x4d, 0xb0, 0x9c, 0x9d, 0x9a, 0x35, 0x11, 0x70, 0x66, + 0x6b, 0x4f, 0x85, 0xaa, 0x84, 0x23, 0x56, 0xa5, 0x3d, 0x87, 0x27, 0x7c, 0xfb, 0x33, 0x87, 0xb2, + 0x84, 0x58, 0x81, 0xf5, 0xa1, 0xe3, 0x32, 0x1c, 0x50, 0x45, 0xe2, 0x95, 0x25, 0x9f, 0xda, 0xa7, + 0xf0, 0xc6, 0x5c, 0xb4, 0x28, 0xec, 0x00, 0x2a, 0xae, 0x43, 0x19, 0x8f, 0xcd, 0x50, 0x15, 0x0f, + 0xd6, 0x3e, 0x84, 0xd7, 0x39, 0x53, 0x07, 0xb3, 0x62, 0xf5, 0x74, 0x84, 0x70, 0x4e, 0x70, 0xa7, + 0x24, 0x73, 0x8b, 0xd3, 0xe6, 0xfe, 0x26, 0xc1, 0xf6, 0x09, 0xf1, 0x58, 0x40, 0x5c, 0x17, 0x07, + 0x5d, 0x66, 0x05, 0xc5, 0x14, 0x21, 0x03, 0xe4, 0x80, 0x10, 0x36, 0x8c, 0xef, 0x43, 0xbd, 0xf5, + 0x6c, 0x35, 0xf9, 0xe7, 0xd1, 0x93, 0x31, 0x45, 0x18, 0xd2, 0x61, 0x9d, 0xf8, 0xcc, 0x21, 0x1e, + 0x55, 0xca, 0x5c, 0xee, 0x96, 0x1e, 0xbf, 0x77, 0x3d, 0x79, 0xef, 0xfa, 0xb1, 0x77, 0x65, 0x26, + 0x41, 0xda, 0x77, 0xf0, 0x6c, 0x45, 0xa8, 0xa8, 0x3c, 0x9f, 0xd2, 0x27, 0x50, 0xf6, 0x1d, 0x5b, + 0x29, 0xed, 0x4a, 0x7b, 0x9b, 0x66, 0xb4, 0xd4, 0x5c, 0xd8, 0x99, 0xa3, 0xbe, 0x08, 0x99, 0x4d, + 0x7e, 0xf0, 0x8a, 0xb5, 0xe1, 0x6d, 0x78, 0x2d, 0x72, 0x29, 0x12, 0xb2, 0x1e, 0xc5, 0x03, 0x2a, + 0xb2, 0xd4, 0xc5, 0x5e, 0x17, 0x0f, 0xa8, 0xf6, 0x16, 0xa8, 0xf7, 0x65, 0x13, 0x57, 0xf2, 0x63, + 0x78, 0x9a, 0xfe, 0xfa, 0x8d, 0xe5, 0x14, 0xbc, 0x20, 0x3f, 0xcd, 0x1f, 0x6b, 0x4c, 0x23, 0x9a, + 0xd5, 0x84, 0x3a, 0x9e, 0x3a, 0xac, 0x47, 0x99, 0xc5, 0x42, 0xca, 0x89, 0x36, 0x4d, 0x88, 0xb6, + 0xba, 0x7c, 0x07, 0x1d, 0x43, 0x2d, 0xfa, 0xc2, 0x76, 0xcf, 0x62, 0x5c, 0x7f, 0xbd, 0xa5, 0xae, + 0x1c, 0xcd, 0x57, 0x89, 0x15, 0xb7, 0x37, 0xa2, 0x7b, 0xfd, 0xeb, 0x5f, 0x4d, 0xc9, 0xdc, 0x88, + 0x61, 0xc7, 0x4c, 0xeb, 0x2c, 0x9d, 0x15, 0x0b, 0x69, 0xb1, 0x32, 0xfe, 0x91, 0x40, 0x59, 0x65, + 0x12, 0x95, 0x6c, 0x43, 0xe9, 0x8e, 0x42, 0x9e, 0xdd, 0x34, 0x4b, 0x67, 0xa7, 0x66, 0xc9, 0xb9, + 0xe7, 0x80, 0xd1, 0x16, 0x54, 0xa3, 0x72, 0x31, 0xbf, 0x69, 0x35, 0x33, 0xfe, 0x58, 0xee, 0x44, + 0xe5, 0xe1, 0x4e, 0x54, 0x8b, 0x74, 0x02, 0xbd, 0x03, 0x55, 0x3c, 0x65, 0x81, 0xa5, 0xc8, 0x0f, + 0xdc, 0xf1, 0x38, 0xa4, 0xf5, 0x7b, 0x05, 0xaa, 0xfc, 0x55, 0xa3, 0x09, 0xc8, 0xb1, 0xf5, 0xa3, + 0x96, 0xfe, 0xf0, 0xfc, 0xd4, 0x57, 0x07, 0x8f, 0x7a, 0x90, 0x0b, 0x23, 0x9a, 0x39, 0x01, 0x39, + 0xb6, 0xec, 0x8c, 0x29, 0x17, 0x06, 0x49, 0xc6, 0x94, 0x4b, 0x33, 0x61, 0x02, 0x72, 0xec, 0xc7, + 0x19, 0x53, 0x2e, 0x0c, 0x80, 0x8c, 0x29, 0x17, 0x0d, 0x1f, 0x7d, 0x0f, 0x95, 0xc8, 0xbd, 0xd1, + 0x8b, 0x4c, 0xe0, 0xb9, 0xb1, 0xa0, 0xee, 0xe7, 0x40, 0x88, 0x64, 0x17, 0x50, 0xee, 0x60, 0x86, + 0x8c, 0x4c, 0xc8, 0x74, 0x14, 0xa8, 0x2f, 0xb2, 0x03, 0xe2, 0x4c, 0xad, 0x7f, 0xcb, 0x00, 0xe9, + 0x33, 0x41, 0xd3, 0xe8, 0x1e, 0x59, 0x01, 0x43, 0x87, 0xff, 0xc7, 0x74, 0xbf, 0xf5, 0xab, 0xef, + 0xe5, 0xc6, 0x89, 0x92, 0x7f, 0x91, 0x60, 0x23, 0xb1, 0x34, 0x74, 0x94, 0x83, 0x65, 0xd1, 0x74, + 0xd5, 0xf7, 0x8b, 0x40, 0x85, 0x86, 0x10, 0x2a, 0x91, 0xe1, 0xa1, 0x77, 0xb3, 0x73, 0xcc, 0xf9, + 0xac, 0x7a, 0x98, 0x17, 0x26, 0xd2, 0xfe, 0x08, 0xb2, 0xb0, 0x8d, 0x7c, 0xdd, 0x4b, 0xbd, 0x51, + 0x7d, 0x99, 0x1f, 0x18, 0x27, 0x6f, 0x9f, 0x5f, 0xdf, 0x36, 0xd6, 0xfe, 0xbc, 0x6d, 0xac, 0xfd, + 0x3c, 0x6b, 0x48, 0xd7, 0xb3, 0x86, 0xf4, 0xc7, 0xac, 0x21, 0xfd, 0x3d, 0x6b, 0x48, 0xe7, 0x1f, + 0x15, 0xfd, 0x1f, 0xff, 0x81, 0x58, 0x7e, 0x5b, 0xea, 0xcb, 0xdc, 0xad, 0x0e, 0xfe, 0x0b, 0x00, + 0x00, 0xff, 0xff, 0x36, 0x7e, 0xfa, 0xf8, 0x14, 0x0c, 0x00, 0x00, +} + +// 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 + +// StoreClient is the client API for Store service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type StoreClient interface { + Create(ctx context.Context, in *StoreCreateRequest, opts ...grpc.CallOption) (*StoreCreateResponse, error) + Update(ctx context.Context, in *StoreUpdateRequest, opts ...grpc.CallOption) (*StoreUpdateResponse, error) + Delete(ctx context.Context, in *StoreDeleteRequest, opts ...grpc.CallOption) (*StoreDeleteResponse, error) + List(ctx context.Context, in *StoreListRequest, opts ...grpc.CallOption) (*StoreListResponse, error) + Get(ctx context.Context, in *StoreGetRequest, opts ...grpc.CallOption) (*StoreGetResponse, error) +} + +type storeClient struct { + cc *grpc.ClientConn +} + +func NewStoreClient(cc *grpc.ClientConn) StoreClient { + return &storeClient{cc} +} + +func (c *storeClient) Create(ctx context.Context, in *StoreCreateRequest, opts ...grpc.CallOption) (*StoreCreateResponse, error) { + out := new(StoreCreateResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Create", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Update(ctx context.Context, in *StoreUpdateRequest, opts ...grpc.CallOption) (*StoreUpdateResponse, error) { + out := new(StoreUpdateResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Update", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Delete(ctx context.Context, in *StoreDeleteRequest, opts ...grpc.CallOption) (*StoreDeleteResponse, error) { + out := new(StoreDeleteResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Delete", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) List(ctx context.Context, in *StoreListRequest, opts ...grpc.CallOption) (*StoreListResponse, error) { + out := new(StoreListResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/List", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeClient) Get(ctx context.Context, in *StoreGetRequest, opts ...grpc.CallOption) (*StoreGetResponse, error) { + out := new(StoreGetResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Store/Get", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StoreServer is the server API for Store service. +type StoreServer interface { + Create(context.Context, *StoreCreateRequest) (*StoreCreateResponse, error) + Update(context.Context, *StoreUpdateRequest) (*StoreUpdateResponse, error) + Delete(context.Context, *StoreDeleteRequest) (*StoreDeleteResponse, error) + List(context.Context, *StoreListRequest) (*StoreListResponse, error) + Get(context.Context, *StoreGetRequest) (*StoreGetResponse, error) +} + +// UnimplementedStoreServer can be embedded to have forward compatible implementations. +type UnimplementedStoreServer struct { +} + +func (*UnimplementedStoreServer) Create(ctx context.Context, req *StoreCreateRequest) (*StoreCreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (*UnimplementedStoreServer) Update(ctx context.Context, req *StoreUpdateRequest) (*StoreUpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (*UnimplementedStoreServer) Delete(ctx context.Context, req *StoreDeleteRequest) (*StoreDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (*UnimplementedStoreServer) List(ctx context.Context, req *StoreListRequest) (*StoreListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (*UnimplementedStoreServer) Get(ctx context.Context, req *StoreGetRequest) (*StoreGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} + +func RegisterStoreServer(s *grpc.Server, srv StoreServer) { + s.RegisterService(&_Store_serviceDesc, srv) +} + +func _Store_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Create", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Create(ctx, req.(*StoreCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Update", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Update(ctx, req.(*StoreUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Delete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Delete(ctx, req.(*StoreDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/List", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).List(ctx, req.(*StoreListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Store_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Store/Get", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreServer).Get(ctx, req.(*StoreGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Store_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.sandbox.v1.Store", + HandlerType: (*StoreServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _Store_Create_Handler, + }, + { + MethodName: "Update", + Handler: _Store_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _Store_Delete_Handler, + }, + { + MethodName: "List", + Handler: _Store_List_Handler, + }, + { + MethodName: "Get", + Handler: _Store_Get_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", +} + +// ControllerClient is the client API for Controller service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ControllerClient interface { + Start(ctx context.Context, in *ControllerStartRequest, opts ...grpc.CallOption) (*ControllerStartResponse, error) + Shutdown(ctx context.Context, in *ControllerShutdownRequest, opts ...grpc.CallOption) (*ControllerShutdownResponse, error) + Wait(ctx context.Context, in *ControllerWaitRequest, opts ...grpc.CallOption) (*ControllerWaitResponse, error) + Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) +} + +type controllerClient struct { + cc *grpc.ClientConn +} + +func NewControllerClient(cc *grpc.ClientConn) ControllerClient { + return &controllerClient{cc} +} + +func (c *controllerClient) Start(ctx context.Context, in *ControllerStartRequest, opts ...grpc.CallOption) (*ControllerStartResponse, error) { + out := new(ControllerStartResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Start", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Shutdown(ctx context.Context, in *ControllerShutdownRequest, opts ...grpc.CallOption) (*ControllerShutdownResponse, error) { + out := new(ControllerShutdownResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Shutdown", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Wait(ctx context.Context, in *ControllerWaitRequest, opts ...grpc.CallOption) (*ControllerWaitResponse, error) { + out := new(ControllerWaitResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Wait", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerClient) Status(ctx context.Context, in *ControllerStatusRequest, opts ...grpc.CallOption) (*ControllerStatusResponse, error) { + out := new(ControllerStatusResponse) + err := c.cc.Invoke(ctx, "/containerd.services.sandbox.v1.Controller/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ControllerServer is the server API for Controller service. +type ControllerServer interface { + Start(context.Context, *ControllerStartRequest) (*ControllerStartResponse, error) + Shutdown(context.Context, *ControllerShutdownRequest) (*ControllerShutdownResponse, error) + Wait(context.Context, *ControllerWaitRequest) (*ControllerWaitResponse, error) + Status(context.Context, *ControllerStatusRequest) (*ControllerStatusResponse, error) +} + +// UnimplementedControllerServer can be embedded to have forward compatible implementations. +type UnimplementedControllerServer struct { +} + +func (*UnimplementedControllerServer) Start(ctx context.Context, req *ControllerStartRequest) (*ControllerStartResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") +} +func (*UnimplementedControllerServer) Shutdown(ctx context.Context, req *ControllerShutdownRequest) (*ControllerShutdownResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented") +} +func (*UnimplementedControllerServer) Wait(ctx context.Context, req *ControllerWaitRequest) (*ControllerWaitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Wait not implemented") +} +func (*UnimplementedControllerServer) Status(ctx context.Context, req *ControllerStatusRequest) (*ControllerStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} + +func RegisterControllerServer(s *grpc.Server, srv ControllerServer) { + s.RegisterService(&_Controller_serviceDesc, srv) +} + +func _Controller_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerStartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Start(ctx, req.(*ControllerStartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerShutdownRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Shutdown(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Shutdown", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Shutdown(ctx, req.(*ControllerShutdownRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Wait_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerWaitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Wait(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Wait", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Wait(ctx, req.(*ControllerWaitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Controller_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ControllerStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.sandbox.v1.Controller/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerServer).Status(ctx, req.(*ControllerStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Controller_serviceDesc = grpc.ServiceDesc{ + ServiceName: "containerd.services.sandbox.v1.Controller", + HandlerType: (*ControllerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _Controller_Start_Handler, + }, + { + MethodName: "Shutdown", + Handler: _Controller_Shutdown_Handler, + }, + { + MethodName: "Wait", + Handler: _Controller_Wait_Handler, + }, + { + MethodName: "Status", + Handler: _Controller_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/containerd/containerd/api/services/sandbox/v1/sandbox.proto", +} + +func (m *StoreCreateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreCreateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreCreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreCreateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreCreateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreCreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreUpdateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreUpdateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Fields) > 0 { + for iNdEx := len(m.Fields) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Fields[iNdEx]) + copy(dAtA[i:], m.Fields[iNdEx]) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Fields[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreUpdateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreUpdateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StoreDeleteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreDeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StoreDeleteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreDeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *StoreListRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreListRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Filters[iNdEx]) + copy(dAtA[i:], m.Filters[iNdEx]) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Filters[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StoreListResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreListResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *StoreGetRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreGetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreGetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StoreGetResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoreGetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreGetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Sandbox != nil { + { + size, err := m.Sandbox.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerStartRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerStartRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStartRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Options != nil { + { + size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Rootfs) > 0 { + for iNdEx := len(m.Rootfs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rootfs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerStartResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerStartResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStartResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerShutdownRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerShutdownRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerShutdownRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TimeoutSecs != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.TimeoutSecs)) + i-- + dAtA[i] = 0x10 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerShutdownResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerShutdownResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerShutdownResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *ControllerWaitRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerWaitRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerWaitRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerWaitResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerWaitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerWaitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintSandbox(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x12 + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ControllerStatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ControllerStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ControllerStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ControllerStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Extra != nil { + { + size, err := m.Extra.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintSandbox(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x2a + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x20 + } + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x1a + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StoreCreateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreCreateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreUpdateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if len(m.Fields) > 0 { + for _, s := range m.Fields { + l = len(s) + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreUpdateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreDeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreDeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreListRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + l = len(s) + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreListResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreGetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StoreGetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sandbox != nil { + l = m.Sandbox.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStartRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Rootfs) > 0 { + for _, e := range m.Rootfs { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStartResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerShutdownRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.TimeoutSecs != 0 { + n += 1 + sovSandbox(uint64(m.TimeoutSecs)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerShutdownResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerWaitRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerWaitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStatusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ControllerStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.Extra != nil { + l = m.Extra.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StoreCreateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreCreateRequest{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreCreateResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreCreateResponse{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreUpdateRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreUpdateRequest{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `Fields:` + fmt.Sprintf("%v", this.Fields) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreUpdateResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreUpdateResponse{`, + `Sandbox:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreDeleteRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreDeleteRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreDeleteResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreDeleteResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreListRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreListRequest{`, + `Filters:` + fmt.Sprintf("%v", this.Filters) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreListResponse) String() string { + if this == nil { + return "nil" + } + repeatedStringForList := "[]Sandbox{" + for _, f := range this.List { + repeatedStringForList += fmt.Sprintf("%v", f) + "," + } + repeatedStringForList += "}" + s := strings.Join([]string{`&StoreListResponse{`, + `List:` + repeatedStringForList + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreGetRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreGetRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StoreGetResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StoreGetResponse{`, + `Sandbox:` + strings.Replace(fmt.Sprintf("%v", this.Sandbox), "Sandbox", "types.Sandbox", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStartRequest) String() string { + if this == nil { + return "nil" + } + repeatedStringForRootfs := "[]*Mount{" + for _, f := range this.Rootfs { + repeatedStringForRootfs += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + "," + } + repeatedStringForRootfs += "}" + s := strings.Join([]string{`&ControllerStartRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Rootfs:` + repeatedStringForRootfs + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStartResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStartResponse{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerShutdownRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerShutdownRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `TimeoutSecs:` + fmt.Sprintf("%v", this.TimeoutSecs) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerShutdownResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerShutdownResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerWaitRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerWaitRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerWaitResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerWaitResponse{`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStatusRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ControllerStatusResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ControllerStatusResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `State:` + fmt.Sprintf("%v", this.State) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `Extra:` + strings.Replace(fmt.Sprintf("%v", this.Extra), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *StoreCreateRequest) 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 ErrIntOverflowSandbox + } + 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: StoreCreateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreCreateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreCreateResponse) 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 ErrIntOverflowSandbox + } + 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: StoreCreateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreCreateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreUpdateRequest) 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 ErrIntOverflowSandbox + } + 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: StoreUpdateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Fields = append(m.Fields, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreUpdateResponse) 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 ErrIntOverflowSandbox + } + 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: StoreUpdateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreDeleteRequest) 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 ErrIntOverflowSandbox + } + 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: StoreDeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreDeleteResponse) 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 ErrIntOverflowSandbox + } + 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: StoreDeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreListRequest) 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 ErrIntOverflowSandbox + } + 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: StoreListRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreListRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreListResponse) 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 ErrIntOverflowSandbox + } + 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: StoreListResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreListResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.List = append(m.List, types.Sandbox{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreGetRequest) 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 ErrIntOverflowSandbox + } + 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: StoreGetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreGetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreGetResponse) 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 ErrIntOverflowSandbox + } + 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: StoreGetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreGetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sandbox", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Sandbox == nil { + m.Sandbox = &types.Sandbox{} + } + if err := m.Sandbox.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerStartRequest) 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 ErrIntOverflowSandbox + } + 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: ControllerStartRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStartRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rootfs = append(m.Rootfs, &types.Mount{}) + if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &types1.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerStartResponse) 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 ErrIntOverflowSandbox + } + 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: ControllerStartResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStartResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerShutdownRequest) 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 ErrIntOverflowSandbox + } + 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: ControllerShutdownRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerShutdownRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSecs", wireType) + } + m.TimeoutSecs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutSecs |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerShutdownResponse) 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 ErrIntOverflowSandbox + } + 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: ControllerShutdownResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerShutdownResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerWaitRequest) 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 ErrIntOverflowSandbox + } + 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: ControllerWaitRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerWaitRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerWaitResponse) 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 ErrIntOverflowSandbox + } + 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: ControllerWaitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerWaitResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerStatusRequest) 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 ErrIntOverflowSandbox + } + 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: ControllerStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ControllerStatusResponse) 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 ErrIntOverflowSandbox + } + 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: ControllerStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ControllerStatusResponse: 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 ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extra == nil { + m.Extra = &types1.Any{} + } + if err := m.Extra.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + 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, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/api/services/sandbox/v1/sandbox.proto b/api/services/sandbox/v1/sandbox.proto new file mode 100644 index 000000000..a3e5d9753 --- /dev/null +++ b/api/services/sandbox/v1/sandbox.proto @@ -0,0 +1,133 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +// Sandbox is a v2 runtime extension that allows more complex execution environments for containers. +// This adds a notion of groups of containers that share same lifecycle and/or resources. +// A few good fits for sandbox can be: +// - A "pause" container in k8s, that acts as a parent process for child containers to hold network namespace. +// - (micro)VMs that launch a VM process and executes containers inside guest OS. +// containerd in this case remains implementation agnostic and delegates sandbox handling to runtimes. +// See proposal and discussion here: https://github.com/containerd/containerd/issues/4131 +package containerd.services.sandbox.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import weak "gogoproto/gogo.proto"; + +import "github.com/containerd/containerd/api/types/sandbox.proto"; +import "github.com/containerd/containerd/api/types/mount.proto"; + +option go_package = "github.com/containerd/containerd/api/services/sandbox/v1;sandbox"; + +// Store provides a metadata storage interface for sandboxes. Similarly to `Containers`, +// sandbox object includes info required to start a new instance, but no runtime state. +// When running a new sandbox instance, store objects are used as base type to create from. +service Store { + rpc Create(StoreCreateRequest) returns (StoreCreateResponse); + rpc Update(StoreUpdateRequest) returns (StoreUpdateResponse); + rpc Delete(StoreDeleteRequest) returns (StoreDeleteResponse); + rpc List(StoreListRequest) returns (StoreListResponse); + rpc Get(StoreGetRequest) returns (StoreGetResponse); +} + +message StoreCreateRequest { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreCreateResponse { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreUpdateRequest { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; + repeated string fields = 2; +} + +message StoreUpdateResponse { + containerd.types.Sandbox sandbox = 1 [(gogoproto.nullable) = false]; +} + +message StoreDeleteRequest { + string sandbox_id = 1; +} + +message StoreDeleteResponse {} + +message StoreListRequest { + repeated string filters = 1; +} + +message StoreListResponse { + repeated containerd.types.Sandbox list = 1 [(gogoproto.nullable) = false]; +} + +message StoreGetRequest { + string sandbox_id = 1; +} + +message StoreGetResponse { + containerd.types.Sandbox sandbox = 1; +} + +// Controller is an interface to manage runtime sandbox instances. +service Controller { + rpc Start(ControllerStartRequest) returns (ControllerStartResponse); + rpc Shutdown(ControllerShutdownRequest) returns (ControllerShutdownResponse); + rpc Wait(ControllerWaitRequest) returns (ControllerWaitResponse); + rpc Status(ControllerStatusRequest) returns (ControllerStatusResponse); +} + +message ControllerStartRequest { + string sandbox_id = 1; + repeated containerd.types.Mount rootfs = 2; + google.protobuf.Any options = 3; +} + +message ControllerStartResponse { + string sandbox_id = 1; + uint32 pid = 2; +} + +message ControllerShutdownRequest { + string sandbox_id = 1; + uint32 timeout_secs = 2; +} + +message ControllerShutdownResponse {} + +message ControllerWaitRequest { + string sandbox_id = 1; +} + +message ControllerWaitResponse { + uint32 exit_status = 1; + google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + +message ControllerStatusRequest { + string sandbox_id = 1; +} + +message ControllerStatusResponse { + string id = 1; + uint32 pid = 2; + string state = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Any extra = 6; +} diff --git a/api/types/sandbox.pb.go b/api/types/sandbox.pb.go new file mode 100644 index 000000000..5bd7b8e7e --- /dev/null +++ b/api/types/sandbox.pb.go @@ -0,0 +1,1148 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/api/types/sandbox.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. +type Sandbox struct { + // SandboxID is a unique instance identifier within namespace + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + // Runtime specifies which runtime to use for executing this container. + Runtime Sandbox_Runtime `protobuf:"bytes,2,opt,name=runtime,proto3" json:"runtime"` + // Spec is sandbox configuration (kin of OCI runtime spec), spec's data will be written to a config.json file in the + // bundle directory (similary to OCI spec). + Spec *types.Any `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` + // Labels provides an area to include arbitrary data on containers. + Labels map[string]string `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // CreatedAt is the time the container was first created. + CreatedAt time.Time `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at"` + // UpdatedAt is the last time the container was mutated. + UpdatedAt time.Time `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3,stdtime" json:"updated_at"` + // Extensions allow clients to provide optional blobs that can be handled by runtime. + Extensions map[string]types.Any `protobuf:"bytes,7,rep,name=extensions,proto3" json:"extensions" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox) Reset() { *m = Sandbox{} } +func (*Sandbox) ProtoMessage() {} +func (*Sandbox) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0} +} +func (m *Sandbox) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Sandbox) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox.Merge(m, src) +} +func (m *Sandbox) XXX_Size() int { + return m.Size() +} +func (m *Sandbox) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox proto.InternalMessageInfo + +type Sandbox_Runtime struct { + // Name is the name of the runtime. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Options specify additional runtime initialization options for the shim (this data will be available in StartShim). + // Typically this data expected to be runtime shim implementation specific. + Options *types.Any `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Sandbox_Runtime) Reset() { *m = Sandbox_Runtime{} } +func (*Sandbox_Runtime) ProtoMessage() {} +func (*Sandbox_Runtime) Descriptor() ([]byte, []int) { + return fileDescriptor_f2257af6cf851f1c, []int{0, 0} +} +func (m *Sandbox_Runtime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sandbox_Runtime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sandbox_Runtime.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Sandbox_Runtime) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sandbox_Runtime.Merge(m, src) +} +func (m *Sandbox_Runtime) XXX_Size() int { + return m.Size() +} +func (m *Sandbox_Runtime) XXX_DiscardUnknown() { + xxx_messageInfo_Sandbox_Runtime.DiscardUnknown(m) +} + +var xxx_messageInfo_Sandbox_Runtime proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Sandbox)(nil), "containerd.types.Sandbox") + proto.RegisterMapType((map[string]types.Any)(nil), "containerd.types.Sandbox.ExtensionsEntry") + proto.RegisterMapType((map[string]string)(nil), "containerd.types.Sandbox.LabelsEntry") + proto.RegisterType((*Sandbox_Runtime)(nil), "containerd.types.Sandbox.Runtime") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/sandbox.proto", fileDescriptor_f2257af6cf851f1c) +} + +var fileDescriptor_f2257af6cf851f1c = []byte{ + // 454 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x4f, 0x8b, 0xd3, 0x40, + 0x14, 0xef, 0xf4, 0x5f, 0xcc, 0x2b, 0xe2, 0x32, 0xf4, 0x10, 0x73, 0x48, 0xab, 0x20, 0x54, 0x91, + 0x89, 0xac, 0x97, 0x55, 0x4f, 0xed, 0xba, 0x87, 0x15, 0x45, 0xc8, 0x7a, 0x10, 0x2f, 0xcb, 0xa4, + 0x19, 0x63, 0xb0, 0x9d, 0x09, 0xc9, 0x44, 0x36, 0x37, 0x3f, 0x82, 0xdf, 0xc1, 0x2f, 0xd3, 0xa3, + 0x47, 0x4f, 0xab, 0x9b, 0x4f, 0x22, 0x99, 0x99, 0xd8, 0x50, 0xad, 0xb8, 0x97, 0xf0, 0x86, 0xf7, + 0xfb, 0xf7, 0xde, 0x23, 0x70, 0x14, 0x27, 0xf2, 0x43, 0x11, 0x92, 0xa5, 0x58, 0xfb, 0x4b, 0xc1, + 0x25, 0x4d, 0x38, 0xcb, 0xa2, 0x76, 0x49, 0xd3, 0xc4, 0x97, 0x65, 0xca, 0x72, 0x3f, 0xa7, 0x3c, + 0x0a, 0xc5, 0x05, 0x49, 0x33, 0x21, 0x05, 0x3e, 0xd8, 0x62, 0x88, 0xea, 0xbb, 0xe3, 0x58, 0xc4, + 0x42, 0x35, 0xfd, 0xba, 0xd2, 0x38, 0xf7, 0x76, 0x2c, 0x44, 0xbc, 0x62, 0xbe, 0x7a, 0x85, 0xc5, + 0x7b, 0x9f, 0xf2, 0xd2, 0xb4, 0x26, 0xbb, 0x2d, 0x99, 0xac, 0x59, 0x2e, 0xe9, 0x3a, 0xd5, 0x80, + 0xbb, 0x5f, 0x07, 0x60, 0x9d, 0x69, 0x57, 0xfc, 0x10, 0xc0, 0x04, 0x38, 0x4f, 0x22, 0x07, 0x4d, + 0xd1, 0xcc, 0x5e, 0xdc, 0xac, 0x2e, 0x27, 0xb6, 0x01, 0x9c, 0x3e, 0x0f, 0x6c, 0x03, 0x38, 0x8d, + 0xf0, 0x1c, 0xac, 0xac, 0xe0, 0xb5, 0x9e, 0xd3, 0x9d, 0xa2, 0xd9, 0xe8, 0xf0, 0x0e, 0xd9, 0xcd, + 0x4b, 0x0c, 0x91, 0x04, 0x1a, 0xb8, 0xe8, 0x6f, 0x2e, 0x27, 0x9d, 0xa0, 0xe1, 0xe1, 0x19, 0xf4, + 0xf3, 0x94, 0x2d, 0x9d, 0x9e, 0xe2, 0x8f, 0x89, 0x0e, 0x4b, 0x9a, 0xb0, 0x64, 0xce, 0xcb, 0x40, + 0x21, 0xf0, 0x31, 0x0c, 0x57, 0x34, 0x64, 0xab, 0xdc, 0xe9, 0x4f, 0x7b, 0xb3, 0xd1, 0xe1, 0xbd, + 0xfd, 0x5e, 0x2f, 0x15, 0xee, 0x84, 0xcb, 0xac, 0x34, 0x7e, 0x86, 0x8a, 0x8f, 0x01, 0x96, 0x19, + 0xa3, 0x92, 0x45, 0xe7, 0x54, 0x3a, 0x03, 0x65, 0xea, 0xfe, 0x61, 0xfa, 0xa6, 0xd9, 0xd0, 0xe2, + 0x46, 0xcd, 0xfe, 0xf2, 0x63, 0x82, 0x02, 0xdb, 0xf0, 0xe6, 0xb2, 0x16, 0x29, 0xd2, 0xa8, 0x11, + 0x19, 0x5e, 0x47, 0xc4, 0xf0, 0xe6, 0x12, 0xbf, 0x06, 0x60, 0x17, 0x92, 0xf1, 0x3c, 0x11, 0x3c, + 0x77, 0x2c, 0x35, 0xd2, 0xfd, 0xfd, 0x23, 0x9d, 0xfc, 0xc6, 0xb6, 0xc7, 0x6a, 0x49, 0xb8, 0xaf, + 0xc0, 0x32, 0x3b, 0xc6, 0x18, 0xfa, 0x9c, 0xae, 0x99, 0xbe, 0x5f, 0xa0, 0x6a, 0x4c, 0xc0, 0x12, + 0xa9, 0x54, 0x66, 0xdd, 0x7f, 0xec, 0xba, 0x01, 0xb9, 0x4f, 0x60, 0xd4, 0x5a, 0x23, 0x3e, 0x80, + 0xde, 0x47, 0x56, 0x1a, 0xc5, 0xba, 0xc4, 0x63, 0x18, 0x7c, 0xa2, 0xab, 0x42, 0x9f, 0xde, 0x0e, + 0xf4, 0xe3, 0x69, 0xf7, 0x08, 0xb9, 0x67, 0x70, 0x6b, 0x27, 0xee, 0x5f, 0xe8, 0x0f, 0xda, 0xf4, + 0x7d, 0x69, 0xb6, 0xa2, 0x8b, 0x17, 0x9b, 0x2b, 0xaf, 0xf3, 0xfd, 0xca, 0xeb, 0x7c, 0xae, 0x3c, + 0xb4, 0xa9, 0x3c, 0xf4, 0xad, 0xf2, 0xd0, 0xcf, 0xca, 0x43, 0xef, 0x1e, 0xfd, 0xff, 0xdf, 0xf5, + 0x4c, 0x7d, 0xdf, 0x76, 0xc2, 0xa1, 0xb2, 0x79, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x90, 0x58, + 0x3c, 0xe1, 0x9a, 0x03, 0x00, 0x00, +} + +func (m *Sandbox) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Sandbox) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Extensions) > 0 { + for k := range m.Extensions { + v := m.Extensions[k] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x3a + } + } + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintSandbox(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x32 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintSandbox(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x2a + if len(m.Labels) > 0 { + for k := range m.Labels { + v := m.Labels[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSandbox(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if m.Spec != nil { + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Runtime.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Sandbox_Runtime) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Sandbox_Runtime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sandbox_Runtime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Options != nil { + { + size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Sandbox) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + l = m.Runtime.Size() + n += 1 + l + sovSandbox(uint64(l)) + if m.Spec != nil { + l = m.Spec.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Labels) > 0 { + for k, v := range m.Labels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovSandbox(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdatedAt) + n += 1 + l + sovSandbox(uint64(l)) + if len(m.Extensions) > 0 { + for k, v := range m.Extensions { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + l + sovSandbox(uint64(l)) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Sandbox_Runtime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Sandbox) 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 += "}" + keysForExtensions := make([]string, 0, len(this.Extensions)) + for k, _ := range this.Extensions { + keysForExtensions = append(keysForExtensions, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForExtensions) + mapStringForExtensions := "map[string]types.Any{" + for _, k := range keysForExtensions { + mapStringForExtensions += fmt.Sprintf("%v: %v,", k, this.Extensions[k]) + } + mapStringForExtensions += "}" + s := strings.Join([]string{`&Sandbox{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Runtime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Runtime), "Sandbox_Runtime", "Sandbox_Runtime", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "types.Any", 1) + `,`, + `Labels:` + mapStringForLabels + `,`, + `CreatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CreatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `UpdatedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.UpdatedAt), "Timestamp", "types.Timestamp", 1), `&`, ``, 1) + `,`, + `Extensions:` + mapStringForExtensions + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *Sandbox_Runtime) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Sandbox_Runtime{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Sandbox) 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 ErrIntOverflowSandbox + } + 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: Sandbox: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sandbox: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Runtime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + 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 ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Spec == nil { + m.Spec = &types.Any{} + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + 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 ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Labels == nil { + m.Labels = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Labels[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extensions == nil { + m.Extensions = make(map[string]types.Any) + } + var mapkey string + mapvalue := &types.Any{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthSandbox + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthSandbox + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &types.Any{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Extensions[mapkey] = *mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sandbox_Runtime) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Runtime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Runtime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &types.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + 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, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/api/types/sandbox.proto b/api/types/sandbox.proto new file mode 100644 index 000000000..0a2cf7a5b --- /dev/null +++ b/api/types/sandbox.proto @@ -0,0 +1,52 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +package containerd.types; + +import weak "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/containerd/containerd/api/types;types"; + +// Sandbox represents a sandbox metadata object that keeps all info required by controller to +// work with a particular instance. +message Sandbox { + // SandboxID is a unique instance identifier within namespace + string sandbox_id = 1; + message Runtime { + // Name is the name of the runtime. + string name = 1; + // Options specify additional runtime initialization options for the shim (this data will be available in StartShim). + // Typically this data expected to be runtime shim implementation specific. + google.protobuf.Any options = 2; + } + // Runtime specifies which runtime to use for executing this container. + Runtime runtime = 2 [(gogoproto.nullable) = false]; + // Spec is sandbox configuration (kin of OCI runtime spec), spec's data will be written to a config.json file in the + // bundle directory (similary to OCI spec). + google.protobuf.Any spec = 3; + // Labels provides an area to include arbitrary data on containers. + map labels = 4 [(gogoproto.nullable) = false]; + // CreatedAt is the time the container was first created. + google.protobuf.Timestamp created_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // UpdatedAt is the last time the container was mutated. + google.protobuf.Timestamp updated_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + // Extensions allow clients to provide optional blobs that can be handled by runtime. + map extensions = 7 [(gogoproto.nullable) = false]; +} diff --git a/client.go b/client.go index 1c2202e1e..defcc35f7 100644 --- a/client.go +++ b/client.go @@ -35,6 +35,7 @@ import ( introspectionapi "github.com/containerd/containerd/api/services/introspection/v1" leasesapi "github.com/containerd/containerd/api/services/leases/v1" namespacesapi "github.com/containerd/containerd/api/services/namespaces/v1" + sandboxsapi "github.com/containerd/containerd/api/services/sandbox/v1" snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1" "github.com/containerd/containerd/api/services/tasks/v1" versionservice "github.com/containerd/containerd/api/services/version/v1" @@ -54,13 +55,14 @@ import ( "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes/docker" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services/introspection" "github.com/containerd/containerd/snapshots" snproxy "github.com/containerd/containerd/snapshots/proxy" "github.com/containerd/typeurl" ptypes "github.com/gogo/protobuf/types" ocispec "github.com/opencontainers/image-spec/specs-go/v1" - specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/opencontainers/runtime-spec/specs-go" "golang.org/x/sync/semaphore" "google.golang.org/grpc" "google.golang.org/grpc/backoff" @@ -688,6 +690,26 @@ func (c *Client) EventService() EventService { return NewEventServiceFromClient(eventsapi.NewEventsClient(c.conn)) } +// SandboxStore returns the underlying sandbox store client +func (c *Client) SandboxStore() sandbox.Store { + if c.sandboxStore != nil { + return c.sandboxStore + } + c.connMu.Lock() + defer c.connMu.Unlock() + return NewRemoteSandboxStore(sandboxsapi.NewStoreClient(c.conn)) +} + +// SandboxController returns the underlying sandbox controller client +func (c *Client) SandboxController() sandbox.Controller { + if c.sandboxController != nil { + return c.sandboxController + } + c.connMu.Lock() + defer c.connMu.Unlock() + return NewSandboxRemoteController(sandboxsapi.NewControllerClient(c.conn)) +} + // VersionService returns the underlying VersionClient func (c *Client) VersionService() versionservice.VersionClient { c.connMu.Lock() diff --git a/cmd/containerd-shim-runc-v2/main.go b/cmd/containerd-shim-runc-v2/main.go index c94942e3a..c5454bba3 100644 --- a/cmd/containerd-shim-runc-v2/main.go +++ b/cmd/containerd-shim-runc-v2/main.go @@ -23,6 +23,7 @@ import ( "context" "github.com/containerd/containerd/runtime/v2/runc/manager" + _ "github.com/containerd/containerd/runtime/v2/runc/pause" _ "github.com/containerd/containerd/runtime/v2/runc/task/plugin" "github.com/containerd/containerd/runtime/v2/shim" ) diff --git a/cmd/containerd/builtins.go b/cmd/containerd/builtins.go index e61b4b1c5..95c2ee88f 100644 --- a/cmd/containerd/builtins.go +++ b/cmd/containerd/builtins.go @@ -34,6 +34,7 @@ import ( _ "github.com/containerd/containerd/services/leases" _ "github.com/containerd/containerd/services/namespaces" _ "github.com/containerd/containerd/services/opt" + _ "github.com/containerd/containerd/services/sandbox" _ "github.com/containerd/containerd/services/snapshots" _ "github.com/containerd/containerd/services/tasks" _ "github.com/containerd/containerd/services/version" diff --git a/cmd/ctr/app/main.go b/cmd/ctr/app/main.go index 4beb24ba1..f2a352f1a 100644 --- a/cmd/ctr/app/main.go +++ b/cmd/ctr/app/main.go @@ -31,6 +31,7 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands/plugins" "github.com/containerd/containerd/cmd/ctr/commands/pprof" "github.com/containerd/containerd/cmd/ctr/commands/run" + "github.com/containerd/containerd/cmd/ctr/commands/sandboxes" "github.com/containerd/containerd/cmd/ctr/commands/snapshots" "github.com/containerd/containerd/cmd/ctr/commands/tasks" versionCmd "github.com/containerd/containerd/cmd/ctr/commands/version" @@ -114,6 +115,7 @@ containerd CLI tasks.Command, install.Command, ociCmd.Command, + sandboxes.Command, }, extraCmds...) app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") { diff --git a/cmd/ctr/commands/sandboxes/sandboxes.go b/cmd/ctr/commands/sandboxes/sandboxes.go new file mode 100644 index 000000000..7e639afb2 --- /dev/null +++ b/cmd/ctr/commands/sandboxes/sandboxes.go @@ -0,0 +1,178 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandboxes + +import ( + "fmt" + "os" + "text/tabwriter" + + "github.com/containerd/containerd" + "github.com/containerd/containerd/cmd/ctr/commands" + "github.com/containerd/containerd/defaults" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/oci" + "github.com/urfave/cli" +) + +// Command is a set of subcommands to manage runtimes with sandbox support +var Command = cli.Command{ + Name: "sandboxes", + Aliases: []string{"sandbox", "sb", "s"}, + Usage: "manage sandboxes", + Subcommands: cli.Commands{ + runCommand, + listCommand, + removeCommand, + }, +} + +var runCommand = cli.Command{ + Name: "run", + Aliases: []string{"create", "c", "r"}, + Usage: "run a new sandbox", + ArgsUsage: "[flags] ", + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "runtime", + Usage: "runtime name", + Value: defaults.DefaultRuntime, + }, + }, + Action: func(context *cli.Context) error { + var ( + id = context.Args().Get(0) + runtime = context.String("runtime") + ) + + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + sandbox, err := client.NewSandbox(ctx, id, + containerd.WithSandboxRuntime(runtime, nil), + containerd.WithSandboxSpec(&oci.Spec{}), + ) + if err != nil { + return fmt.Errorf("failed to create new sandbox: %w", err) + } + + err = sandbox.Start(ctx) + if err != nil { + return fmt.Errorf("failed to start: %w", err) + } + + fmt.Println(sandbox.ID()) + return nil + }, +} + +var listCommand = cli.Command{ + Name: "list", + Aliases: []string{"ls"}, + Usage: "list sandboxes", + Flags: []cli.Flag{ + cli.StringSliceFlag{ + Name: "filters", + Usage: "the list of filters to apply when querying sandboxes from the store", + }, + }, + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + var ( + writer = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0) + filters = context.StringSlice("filters") + ) + + defer func() { + _ = writer.Flush() + }() + + list, err := client.SandboxStore().List(ctx, filters...) + if err != nil { + return fmt.Errorf("failed to list sandboxes: %w", err) + } + + if _, err := fmt.Fprintln(writer, "ID\tCREATED\tRUNTIME\t"); err != nil { + return err + } + + for _, sandbox := range list { + _, err := fmt.Fprintf(writer, "%s\t%s\t%s\t\n", sandbox.ID, sandbox.CreatedAt, sandbox.Runtime.Name) + if err != nil { + return err + } + } + + return nil + }, +} + +var removeCommand = cli.Command{ + Name: "remove", + Aliases: []string{"rm"}, + ArgsUsage: " [, ...]", + Usage: "remove sandboxes", + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "force, f", + Usage: "ignore shutdown errors when removing sandbox", + }, + }, + Action: func(context *cli.Context) error { + client, ctx, cancel, err := commands.NewClient(context) + if err != nil { + return err + } + defer cancel() + + force := context.Bool("force") + + for _, id := range context.Args() { + sandbox, err := client.LoadSandbox(ctx, id) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to load sandbox %s", id) + continue + } + + err = sandbox.Stop(ctx) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to stop sandbox %s", id) + if !force { + continue + } + } + + err = sandbox.Delete(ctx) + if err != nil { + log.G(ctx).WithError(err).Errorf("failed to shutdown sandbox %s", id) + continue + } + + log.G(ctx).Infof("deleted: %s", id) + } + + return nil + }, +} diff --git a/container_opts.go b/container_opts.go index f005fe1c7..76a9b9616 100644 --- a/container_opts.go +++ b/container_opts.go @@ -74,6 +74,15 @@ func WithRuntime(name string, options interface{}) NewContainerOpts { } } +// WithSandbox joins the container to a container group (aka sandbox) from the given ID +// Note: shim runtime must support sandboxes environments. +func WithSandbox(sandboxID string) NewContainerOpts { + return func(ctx context.Context, client *Client, c *containers.Container) error { + c.SandboxID = sandboxID + return nil + } +} + // WithImage sets the provided image as the base for the container func WithImage(i Image) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { diff --git a/containers/containers.go b/containers/containers.go index 275f8069e..9aa0ba0d4 100644 --- a/containers/containers.go +++ b/containers/containers.go @@ -76,6 +76,11 @@ type Container struct { // Extensions stores client-specified metadata Extensions map[string]typeurl.Any + + // SandboxID is an identifier of sandbox this container belongs to. + // + // This property is optional, but can't be changed after creation. + SandboxID string } // RuntimeInfo holds runtime specific information diff --git a/containerstore.go b/containerstore.go index 2a154e265..a9a82a2f5 100644 --- a/containerstore.go +++ b/containerstore.go @@ -166,6 +166,7 @@ func containerToProto(container *containers.Container) containersapi.Container { Snapshotter: container.Snapshotter, SnapshotKey: container.SnapshotKey, Extensions: extensions, + Sandbox: container.SandboxID, } } @@ -193,6 +194,7 @@ func containerFromProto(containerpb *containersapi.Container) containers.Contain CreatedAt: containerpb.CreatedAt, UpdatedAt: containerpb.UpdatedAt, Extensions: extensions, + SandboxID: containerpb.Sandbox, } } diff --git a/go.mod b/go.mod index 05838cc80..5228df705 100644 --- a/go.mod +++ b/go.mod @@ -48,6 +48,7 @@ require ( github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 github.com/opencontainers/selinux v1.10.0 github.com/pelletier/go-toml v1.9.3 + github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 @@ -103,7 +104,6 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/opencontainers/runtime-tools v0.0.0-20190417131837-cd1349b7c47e // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.30.0 // indirect diff --git a/metadata/adaptors.go b/metadata/adaptors.go index c5d576f84..dbff7bacd 100644 --- a/metadata/adaptors.go +++ b/metadata/adaptors.go @@ -24,6 +24,7 @@ import ( "github.com/containerd/containerd/filters" "github.com/containerd/containerd/images" "github.com/containerd/containerd/leases" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/snapshots" ) @@ -149,6 +150,23 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor { }) } +func adaptSandbox(instance *sandbox.Sandbox) filters.Adaptor { + return filters.AdapterFunc(func(fieldpath []string) (string, bool) { + if len(fieldpath) == 0 { + return "", false + } + + switch fieldpath[0] { + case "id": + return instance.ID, true + case "labels": + return checkMap(fieldpath[1:], instance.Labels) + default: + return "", false + } + }) +} + func checkMap(fieldpath []string, m map[string]string) (string, bool) { if len(m) == 0 { return "", false diff --git a/metadata/boltutil/helpers.go b/metadata/boltutil/helpers.go index 2b2b0ad1e..73d546ced 100644 --- a/metadata/boltutil/helpers.go +++ b/metadata/boltutil/helpers.go @@ -213,11 +213,11 @@ func WriteAny(bkt *bolt.Bucket, name []byte, any typeurl.Any) error { data, err := proto.Marshal(pbany) if err != nil { - return err + return fmt.Errorf("failed to marshal: %w", err) } if err := bkt.Put(name, data); err != nil { - return err + return fmt.Errorf("put failed: %w", err) } return nil diff --git a/metadata/buckets.go b/metadata/buckets.go index d23be84fe..af3318306 100644 --- a/metadata/buckets.go +++ b/metadata/buckets.go @@ -130,6 +130,7 @@ var ( bucketKeyObjectBlob = []byte("blob") // stores content links bucketKeyObjectIngests = []byte("ingests") // stores ingest objects bucketKeyObjectLeases = []byte("leases") // stores leases + bucketKeyObjectSandboxes = []byte("sandboxes") // stores sandboxes bucketKeyDigest = []byte("digest") bucketKeyMediaType = []byte("mediatype") @@ -149,6 +150,7 @@ var ( bucketKeyExpected = []byte("expected") bucketKeyRef = []byte("ref") bucketKeyExpireAt = []byte("expireat") + bucketKeySandboxID = []byte("sandboxid") deprecatedBucketKeyObjectIngest = []byte("ingest") // stores ingest links, deprecated in v1.2 ) @@ -270,3 +272,19 @@ func createIngestBucket(tx *bolt.Tx, namespace, ref string) (*bolt.Bucket, error func getIngestBucket(tx *bolt.Tx, namespace, ref string) *bolt.Bucket { return getBucket(tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectContent, bucketKeyObjectIngests, []byte(ref)) } + +func createSandboxBucket(tx *bolt.Tx, namespace string) (*bolt.Bucket, error) { + return createBucketIfNotExists( + tx, + []byte(namespace), + bucketKeyObjectSandboxes, + ) +} + +func getSandboxBucket(tx *bolt.Tx, namespace string) *bolt.Bucket { + return getBucket( + tx, + []byte(namespace), + bucketKeyObjectSandboxes, + ) +} diff --git a/metadata/containers.go b/metadata/containers.go index b27dc0f87..d6517ce47 100644 --- a/metadata/containers.go +++ b/metadata/containers.go @@ -359,6 +359,8 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error { } container.Extensions = extensions + case string(bucketKeySandboxID): + container.SandboxID = string(v) } return nil @@ -407,5 +409,9 @@ func writeContainer(bkt *bolt.Bucket, container *containers.Container) error { return err } + if err := bkt.Put(bucketKeySandboxID, []byte(container.SandboxID)); err != nil { + return err + } + return boltutil.WriteLabels(bkt, container.Labels) } diff --git a/metadata/sandbox.go b/metadata/sandbox.go new file mode 100644 index 000000000..82cf239b0 --- /dev/null +++ b/metadata/sandbox.go @@ -0,0 +1,377 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package metadata + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/filters" + "github.com/containerd/containerd/identifiers" + "github.com/containerd/containerd/metadata/boltutil" + "github.com/containerd/containerd/namespaces" + api "github.com/containerd/containerd/sandbox" + "github.com/containerd/typeurl" + "github.com/pkg/errors" + "go.etcd.io/bbolt" +) + +type sandboxStore struct { + db *DB +} + +var _ api.Store = (*sandboxStore)(nil) + +// NewSandboxStore creates a datababase client for sandboxes +func NewSandboxStore(db *DB) api.Store { + return &sandboxStore{db: db} +} + +// Create a sandbox record in the store +func (s *sandboxStore) Create(ctx context.Context, sandbox api.Sandbox) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + sandbox.CreatedAt = time.Now().UTC() + sandbox.UpdatedAt = sandbox.CreatedAt + + if err := s.validate(&sandbox); err != nil { + return api.Sandbox{}, errors.Wrap(err, "failed to validate sandbox") + } + + if err := s.db.Update(func(tx *bbolt.Tx) error { + parent, err := createSandboxBucket(tx, ns) + if err != nil { + return fmt.Errorf("create error: %w", err) + } + + if err := s.write(parent, &sandbox, false); err != nil { + return fmt.Errorf("write error: %w", err) + } + + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return sandbox, nil +} + +// Update the sandbox with the provided sandbox object and fields +func (s *sandboxStore) Update(ctx context.Context, sandbox api.Sandbox, fieldpaths ...string) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + ret := api.Sandbox{} + if err := update(ctx, s.db, func(tx *bbolt.Tx) error { + parent := getSandboxBucket(tx, ns) + if parent == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + updated, err := s.read(parent, []byte(sandbox.ID)) + if err != nil { + return err + } + + if len(fieldpaths) == 0 { + fieldpaths = []string{"labels", "extensions", "spec", "runtime"} + + if updated.Runtime.Name != sandbox.Runtime.Name { + return errors.Wrapf(errdefs.ErrInvalidArgument, "sandbox.Runtime.Name field is immutable") + } + } + + for _, path := range fieldpaths { + if strings.HasPrefix(path, "labels.") { + if updated.Labels == nil { + updated.Labels = map[string]string{} + } + + key := strings.TrimPrefix(path, "labels.") + updated.Labels[key] = sandbox.Labels[key] + continue + } else if strings.HasPrefix(path, "extensions.") { + if updated.Extensions == nil { + updated.Extensions = map[string]typeurl.Any{} + } + + key := strings.TrimPrefix(path, "extensions.") + updated.Extensions[key] = sandbox.Extensions[key] + continue + } + + switch path { + case "labels": + updated.Labels = sandbox.Labels + case "extensions": + updated.Extensions = sandbox.Extensions + case "runtime": + updated.Runtime = sandbox.Runtime + case "spec": + updated.Spec = sandbox.Spec + default: + return errors.Wrapf(errdefs.ErrInvalidArgument, "cannot update %q field on sandbox %q", path, sandbox.ID) + } + } + + updated.UpdatedAt = time.Now().UTC() + + if err := s.validate(&updated); err != nil { + return err + } + + if err := s.write(parent, &updated, true); err != nil { + return err + } + + ret = updated + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return ret, nil +} + +// Get sandbox metadata using the id +func (s *sandboxStore) Get(ctx context.Context, id string) (api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return api.Sandbox{}, err + } + + ret := api.Sandbox{} + if err := view(ctx, s.db, func(tx *bbolt.Tx) error { + bucket := getSandboxBucket(tx, ns) + if bucket == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + out, err := s.read(bucket, []byte(id)) + if err != nil { + return err + } + + ret = out + return nil + }); err != nil { + return api.Sandbox{}, err + } + + return ret, nil +} + +// List returns sandboxes that match one or more of the provided filters +func (s *sandboxStore) List(ctx context.Context, fields ...string) ([]api.Sandbox, error) { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return nil, err + } + + filter, err := filters.ParseAll(fields...) + if err != nil { + return nil, errors.Wrap(errdefs.ErrInvalidArgument, err.Error()) + } + + var ( + list []api.Sandbox + ) + + if err := view(ctx, s.db, func(tx *bbolt.Tx) error { + bucket := getSandboxBucket(tx, ns) + if bucket == nil { + // We haven't created any sandboxes yet, just return empty list + return nil + } + + if err := bucket.ForEach(func(k, v []byte) error { + info, err := s.read(bucket, k) + if err != nil { + return errors.Wrapf(err, "failed to read bucket %q", string(k)) + } + + if filter.Match(adaptSandbox(&info)) { + list = append(list, info) + } + + return nil + }); err != nil { + return err + } + + return nil + }); err != nil { + return nil, err + } + + return list, nil +} + +// Delete a sandbox from metadata store using the id +func (s *sandboxStore) Delete(ctx context.Context, id string) error { + ns, err := namespaces.NamespaceRequired(ctx) + if err != nil { + return err + } + + if err := update(ctx, s.db, func(tx *bbolt.Tx) error { + buckets := getSandboxBucket(tx, ns) + if buckets == nil { + return errors.Wrap(errdefs.ErrNotFound, "no sandbox buckets") + } + + if err := buckets.DeleteBucket([]byte(id)); err != nil { + return errors.Wrapf(err, "failed to delete sandbox %q", id) + } + + return nil + }); err != nil { + return err + } + + return nil +} + +func (s *sandboxStore) write(parent *bbolt.Bucket, instance *api.Sandbox, overwrite bool) error { + var ( + bucket *bbolt.Bucket + err error + id = []byte(instance.ID) + ) + + if overwrite { + bucket, err = parent.CreateBucketIfNotExists(id) + if err != nil { + return err + } + } else { + bucket = parent.Bucket(id) + if bucket != nil { + return errors.Wrapf(errdefs.ErrAlreadyExists, "sandbox bucket %q already exists", instance.ID) + } + + bucket, err = parent.CreateBucket(id) + if err != nil { + return err + } + } + + if err := boltutil.WriteTimestamps(bucket, instance.CreatedAt, instance.UpdatedAt); err != nil { + return err + } + + if err := boltutil.WriteLabels(bucket, instance.Labels); err != nil { + return err + } + + if err := boltutil.WriteExtensions(bucket, instance.Extensions); err != nil { + return err + } + + if err := boltutil.WriteAny(bucket, bucketKeySpec, instance.Spec); err != nil { + return err + } + + runtimeBucket, err := bucket.CreateBucketIfNotExists(bucketKeyRuntime) + if err != nil { + return err + } + + if err := runtimeBucket.Put(bucketKeyName, []byte(instance.Runtime.Name)); err != nil { + return err + } + + if err := boltutil.WriteAny(runtimeBucket, bucketKeyOptions, instance.Runtime.Options); err != nil { + return err + } + + return nil +} + +func (s *sandboxStore) read(parent *bbolt.Bucket, id []byte) (api.Sandbox, error) { + var ( + inst api.Sandbox + err error + ) + + bucket := parent.Bucket(id) + if bucket == nil { + return api.Sandbox{}, errors.Wrapf(errdefs.ErrNotFound, "bucket %q not found", id) + } + + inst.ID = string(id) + + inst.Labels, err = boltutil.ReadLabels(bucket) + if err != nil { + return api.Sandbox{}, err + } + + if err := boltutil.ReadTimestamps(bucket, &inst.CreatedAt, &inst.UpdatedAt); err != nil { + return api.Sandbox{}, err + } + + inst.Spec, err = boltutil.ReadAny(bucket, bucketKeySpec) + if err != nil { + return api.Sandbox{}, err + } + + runtimeBucket := bucket.Bucket(bucketKeyRuntime) + if runtimeBucket == nil { + return api.Sandbox{}, errors.New("no runtime bucket") + } + + inst.Runtime.Name = string(runtimeBucket.Get(bucketKeyName)) + inst.Runtime.Options, err = boltutil.ReadAny(runtimeBucket, bucketKeyOptions) + if err != nil { + return api.Sandbox{}, err + } + + inst.Extensions, err = boltutil.ReadExtensions(bucket) + if err != nil { + return api.Sandbox{}, err + } + + return inst, nil +} + +func (s *sandboxStore) validate(new *api.Sandbox) error { + if err := identifiers.Validate(new.ID); err != nil { + return errors.Wrap(err, "invalid sandbox ID") + } + + if new.CreatedAt.IsZero() { + return errors.Wrap(errdefs.ErrInvalidArgument, "creation date must not be zero") + } + + if new.UpdatedAt.IsZero() { + return errors.Wrap(errdefs.ErrInvalidArgument, "updated date must not be zero") + } + + if new.Runtime.Name == "" { + return errors.Wrapf(errdefs.ErrInvalidArgument, "sandbox.Runtime.Name must be set") + } + + return nil +} diff --git a/metadata/sandbox_test.go b/metadata/sandbox_test.go new file mode 100644 index 000000000..0147de780 --- /dev/null +++ b/metadata/sandbox_test.go @@ -0,0 +1,292 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package metadata + +import ( + "reflect" + "testing" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/protobuf" + api "github.com/containerd/containerd/sandbox" + "github.com/containerd/typeurl" + "github.com/gogo/protobuf/types" +) + +func TestSandboxCreate(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "1", + Labels: map[string]string{"a": "1", "b": "2"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url/1", Value: []byte{1, 2, 3}}, + "ext2": &types.Any{TypeUrl: "url/2", Value: []byte{3, 2, 1}}, + }, + Runtime: api.RuntimeOpts{ + Name: "test", + Options: &types.Any{TypeUrl: "url/3", Value: []byte{4, 5, 6}}, + }, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + out, err := store.Get(ctx, "1") + if err != nil { + t.Fatal(err) + } + + assertEqualInstances(t, in, out) +} + +func TestSandboxCreateDup(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "1", + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + _, err = store.Create(ctx, in) + if !errdefs.IsAlreadyExists(err) { + t.Fatalf("expected %+v, got %+v", errdefs.ErrAlreadyExists, err) + } +} + +func TestSandboxUpdate(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + if _, err := store.Create(ctx, api.Sandbox{ + ID: "2", + Labels: map[string]string{"lbl1": "existing"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1}}, // will replace + Extensions: map[string]typeurl.Any{ + "ext2": &types.Any{TypeUrl: "url2", Value: []byte{4, 5, 6}}, // will append `ext1` + }, + Runtime: api.RuntimeOpts{Name: "test"}, // no change + }); err != nil { + t.Fatal(err) + } + + expectedSpec := types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}} + + out, err := store.Update(ctx, api.Sandbox{ + ID: "2", + Labels: map[string]string{"lbl1": "new"}, + Spec: &expectedSpec, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url1", Value: []byte{1, 2}}, + }, + }, "labels.lbl1", "extensions.ext1", "spec") + if err != nil { + t.Fatal(err) + } + + expected := api.Sandbox{ + ID: "2", + Spec: &expectedSpec, + Labels: map[string]string{ + "lbl1": "new", + }, + Extensions: map[string]typeurl.Any{ + "ext1": &types.Any{TypeUrl: "url1", Value: []byte{1, 2}}, + "ext2": &types.Any{TypeUrl: "url2", Value: []byte{4, 5, 6}}, + }, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + assertEqualInstances(t, out, expected) +} + +func TestSandboxGetInvalid(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + _, err := store.Get(ctx, "invalid_id") + if err == nil { + t.Fatalf("expected %+v error for invalid ID", errdefs.ErrNotFound) + } else if !errdefs.IsNotFound(err) { + t.Fatalf("unexpected error %T type", err) + } +} + +func TestSandboxList(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := []api.Sandbox{ + { + ID: "1", + Labels: map[string]string{"test": "1"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{}}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + { + ID: "2", + Labels: map[string]string{"test": "2"}, + Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{ + TypeUrl: "test", + Value: []byte{9}, + }}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + } + + for _, inst := range in { + _, err := store.Create(ctx, inst) + if err != nil { + t.Fatal(err) + } + } + + out, err := store.List(ctx) + if err != nil { + t.Fatal(err) + } + + if len(in) != len(out) { + t.Fatalf("expected list size: %d != %d", len(in), len(out)) + } + + for i := range out { + assertEqualInstances(t, out[i], in[i]) + } +} + +func TestSandboxListWithFilter(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := []api.Sandbox{ + { + ID: "1", + Labels: map[string]string{"test": "1"}, + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{}}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + { + ID: "2", + Labels: map[string]string{"test": "2"}, + Spec: &types.Any{TypeUrl: "2", Value: []byte{3, 2, 1}}, + Extensions: map[string]typeurl.Any{"ext": &types.Any{ + TypeUrl: "test", + Value: []byte{9}, + }}, + Runtime: api.RuntimeOpts{Name: "test"}, + }, + } + + for _, inst := range in { + _, err := store.Create(ctx, inst) + if err != nil { + t.Fatal(err) + } + } + + out, err := store.List(ctx, "id==1") + if err != nil { + t.Fatal(err) + } + + if len(out) != 1 { + t.Fatalf("expected list to contain 1 element, got %d", len(out)) + } + + assertEqualInstances(t, out[0], in[0]) +} + +func TestSandboxDelete(t *testing.T) { + ctx, db, done := testDB(t) + defer done() + + store := NewSandboxStore(db) + + in := api.Sandbox{ + ID: "2", + Spec: &types.Any{TypeUrl: "1", Value: []byte{1, 2, 3}}, + Runtime: api.RuntimeOpts{Name: "test"}, + } + + _, err := store.Create(ctx, in) + if err != nil { + t.Fatal(err) + } + + err = store.Delete(ctx, "2") + if err != nil { + t.Fatalf("deleted failed %+v", err) + } + + _, err = store.Get(ctx, "2") + if !errdefs.IsNotFound(err) { + t.Fatalf("unexpected err result: %+v != %+v", err, errdefs.ErrNotFound) + } +} + +func assertEqualInstances(t *testing.T, x, y api.Sandbox) { + if x.ID != y.ID { + t.Fatalf("ids are not equal: %q != %q", x.ID, y.ID) + } + + if !reflect.DeepEqual(x.Labels, y.Labels) { + t.Fatalf("labels are not equal: %+v != %+v", x.Labels, y.Labels) + } + + if !reflect.DeepEqual(x.Spec, y.Spec) { + t.Fatalf("specs are not equal: %+v != %+v", x.Spec, y.Spec) + } + + if !reflect.DeepEqual(x.Extensions, y.Extensions) { + t.Fatalf("extensions are not equal: %+v != %+v", x.Extensions, y.Extensions) + } + + if x.Runtime.Name != y.Runtime.Name { + t.Fatalf("runtime names are not equal: %q != %q", x.Runtime.Name, y.Runtime.Name) + } + + if !reflect.DeepEqual(protobuf.FromAny(x.Runtime.Options), protobuf.FromAny(y.Runtime.Options)) { + t.Fatalf("runtime options are not equal: %+v != %+v", x.Runtime.Options, y.Runtime.Options) + } +} diff --git a/runtime/runtime.go b/runtime/runtime.go index 1ca22ee2b..65c276c80 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -49,6 +49,8 @@ type CreateOpts struct { // Runtime name to use (e.g. `io.containerd.NAME.VERSION`). // As an alternative full abs path to binary may be specified instead. Runtime string + // SandboxID is an optional ID of sandbox this container belongs to + SandboxID string } // Exit information for a process diff --git a/runtime/v2/bundle.go b/runtime/v2/bundle.go index 8152a5277..8282d540b 100644 --- a/runtime/v2/bundle.go +++ b/runtime/v2/bundle.go @@ -25,6 +25,8 @@ import ( "github.com/containerd/containerd/identifiers" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/namespaces" + "github.com/containerd/typeurl" + "github.com/opencontainers/runtime-spec/specs-go" ) const configFilename = "config.json" @@ -43,7 +45,7 @@ func LoadBundle(ctx context.Context, root, id string) (*Bundle, error) { } // NewBundle returns a new bundle on disk -func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bundle, err error) { +func NewBundle(ctx context.Context, root, state, id string, spec typeurl.Any) (b *Bundle, err error) { if err := identifiers.Validate(id); err != nil { return nil, fmt.Errorf("invalid task id %s: %w", id, err) } @@ -73,8 +75,10 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun if err := os.Mkdir(b.Path, 0700); err != nil { return nil, err } - if err := prepareBundleDirectoryPermissions(b.Path, spec); err != nil { - return nil, err + if typeurl.Is(spec, &specs.Spec{}) { + if err := prepareBundleDirectoryPermissions(b.Path, spec.GetValue()); err != nil { + return nil, err + } } paths = append(paths, b.Path) // create working directory for the bundle @@ -100,9 +104,14 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun if err := os.Symlink(work, filepath.Join(b.Path, "work")); err != nil { return nil, err } - // write the spec to the bundle - err = os.WriteFile(filepath.Join(b.Path, configFilename), spec, 0666) - return b, err + if spec := spec.GetValue(); spec != nil { + // write the spec to the bundle + err = os.WriteFile(filepath.Join(b.Path, configFilename), spec, 0666) + if err != nil { + return nil, fmt.Errorf("failed to write %s", configFilename) + } + } + return b, nil } // Bundle represents an OCI bundle diff --git a/runtime/v2/bundle_linux_test.go b/runtime/v2/bundle_linux_test.go index 685dc2fbf..f34859453 100644 --- a/runtime/v2/bundle_linux_test.go +++ b/runtime/v2/bundle_linux_test.go @@ -29,6 +29,7 @@ import ( "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/oci" "github.com/containerd/containerd/pkg/testutil" + "github.com/containerd/typeurl" "github.com/opencontainers/runtime-spec/specs-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -57,11 +58,11 @@ func TestNewBundle(t *testing.T) { GIDMappings: []specs.LinuxIDMapping{{ContainerID: 0, HostID: usernsGID}}, } } - specBytes, err := json.Marshal(&spec) + specAny, err := typeurl.MarshalAny(&spec) require.NoError(t, err, "failed to marshal spec") ctx := namespaces.WithNamespace(context.TODO(), namespaces.Default) - b, err := NewBundle(ctx, work, state, id, specBytes) + b, err := NewBundle(ctx, work, state, id, specAny) require.NoError(t, err, "NewBundle should succeed") require.NotNil(t, b, "bundle should not be nil") diff --git a/runtime/v2/manager.go b/runtime/v2/manager.go index d8e2cb5fe..3ff177512 100644 --- a/runtime/v2/manager.go +++ b/runtime/v2/manager.go @@ -96,6 +96,24 @@ func init() { return NewTaskManager(shimManager), nil }, }) + + // Task manager uses shim manager as a dependency to manage shim instances. + // However, due to time limits and to avoid migration steps in 1.6 release, + // use the following workaround. + // This expected to be removed in 1.7. + plugin.Register(&plugin.Registration{ + Type: plugin.RuntimePluginV2, + ID: "shim", + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + taskManagerI, err := ic.GetByID(plugin.RuntimePluginV2, "task") + if err != nil { + return nil, err + } + + taskManager := taskManagerI.(*TaskManager) + return taskManager.manager, nil + }, + }) } type ManagerConfig struct { @@ -158,7 +176,7 @@ func (m *ShimManager) ID() string { // Start launches a new shim instance func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateOpts) (_ ShimProcess, retErr error) { - bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec.GetValue()) + bundle, err := NewBundle(ctx, m.root, m.state, id, opts.Spec) if err != nil { return nil, err } @@ -168,6 +186,40 @@ func (m *ShimManager) Start(ctx context.Context, id string, opts runtime.CreateO } }() + // This container belongs to sandbox which supposed to be already started via sandbox API. + if opts.SandboxID != "" { + process, err := m.Get(ctx, opts.SandboxID) + if err != nil { + return nil, fmt.Errorf("can't find sandbox %s", opts.SandboxID) + } + + // Write sandbox ID this task belongs to. + if err := os.WriteFile(filepath.Join(bundle.Path, "sandbox"), []byte(opts.SandboxID), 0600); err != nil { + return nil, err + } + + address, err := shimbinary.ReadAddress(filepath.Join(m.state, process.Namespace(), opts.SandboxID, "address")) + if err != nil { + return nil, fmt.Errorf("failed to get socket address for sandbox %q: %w", opts.SandboxID, err) + } + + // Use sandbox's socket address to handle task requests for this container. + if err := shimbinary.WriteAddress(filepath.Join(bundle.Path, "address"), address); err != nil { + return nil, err + } + + shim, err := loadShim(ctx, bundle, func() {}) + if err != nil { + return nil, fmt.Errorf("failed to load sandbox task %q: %w", opts.SandboxID, err) + } + + if err := m.shims.Add(ctx, shim); err != nil { + return nil, err + } + + return shim, nil + } + shim, err := m.startShim(ctx, bundle, id, opts) if err != nil { return nil, err @@ -324,7 +376,8 @@ func (m *ShimManager) Get(ctx context.Context, id string) (ShimProcess, error) { return nil, err } - return proc, nil + shimTask := proc.(*shimTask) + return shimTask, nil } // Delete a runtime task @@ -388,7 +441,8 @@ func (m *TaskManager) Create(ctx context.Context, taskID string, opts runtime.Cr dctx, cancel := timeout.WithContext(context.Background(), cleanupTimeout) defer cancel() - _, errShim := shim.delete(dctx, func(context.Context, string) {}) + sandboxed := opts.SandboxID != "" + _, errShim := shim.delete(dctx, sandboxed, func(context.Context, string) {}) if errShim != nil { if errdefs.IsDeadlineExceeded(errShim) { dctx, cancel = timeout.WithContext(context.Background(), cleanupTimeout) @@ -422,8 +476,14 @@ func (m *TaskManager) Delete(ctx context.Context, taskID string) (*runtime.Exit, return nil, err } + container, err := m.manager.containers.Get(ctx, taskID) + if err != nil { + return nil, err + } + + sandboxed := container.SandboxID != "" shimTask := item.(*shimTask) - exit, err := shimTask.delete(ctx, func(ctx context.Context, id string) { + exit, err := shimTask.delete(ctx, sandboxed, func(ctx context.Context, id string) { m.manager.shims.Delete(ctx, id) }) diff --git a/runtime/v2/runc/pause/sandbox.go b/runtime/v2/runc/pause/sandbox.go new file mode 100644 index 000000000..2ef6fc710 --- /dev/null +++ b/runtime/v2/runc/pause/sandbox.go @@ -0,0 +1,104 @@ +//go:build linux +// +build linux + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package pause + +import ( + "context" + + "github.com/containerd/containerd/pkg/shutdown" + "github.com/containerd/ttrpc" + log "github.com/sirupsen/logrus" + + "github.com/containerd/containerd/plugin" + api "github.com/containerd/containerd/runtime/v2/task" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.TTRPCPlugin, + ID: "pause", + Requires: []plugin.Type{ + plugin.InternalPlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown") + if err != nil { + return nil, err + } + + return &pauseService{ + shutdown: ss.(shutdown.Service), + }, nil + }, + }) +} + +// pauseService is an extension for task v2 runtime to support Pod "pause" containers via sandbox API. +type pauseService struct { + shutdown shutdown.Service +} + +var _ api.SandboxService = (*pauseService)(nil) + +func (p *pauseService) RegisterTTRPC(server *ttrpc.Server) error { + api.RegisterSandboxService(server, p) + return nil +} + +func (p *pauseService) StartSandbox(ctx context.Context, req *api.StartSandboxRequest) (*api.StartSandboxResponse, error) { + log.Debugf("start sandbox request: %+v", req) + return &api.StartSandboxResponse{}, nil +} + +func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequest) (*api.StopSandboxResponse, error) { + log.Debugf("stop sandbox request: %+v", req) + p.shutdown.Shutdown() + return &api.StopSandboxResponse{}, nil +} + +func (p *pauseService) WaitSandbox(ctx context.Context, req *api.WaitSandboxRequest) (*api.WaitSandboxResponse, error) { + return &api.WaitSandboxResponse{ + ExitStatus: 0, + }, nil +} + +func (p *pauseService) UpdateSandbox(ctx context.Context, req *api.UpdateSandboxRequest) (*api.UpdateSandboxResponse, error) { + log.Debugf("update sandbox request: %+v", req) + return &api.UpdateSandboxResponse{}, nil +} + +func (p *pauseService) PauseSandbox(ctx context.Context, req *api.PauseSandboxRequest) (*api.PauseSandboxResponse, error) { + log.Debugf("pause sandbox request: %+v", req) + return &api.PauseSandboxResponse{}, nil +} + +func (p *pauseService) ResumeSandbox(ctx context.Context, req *api.ResumeSandboxRequest) (*api.ResumeSandboxResponse, error) { + log.Debugf("resume sandbox request: %+v", req) + return &api.ResumeSandboxResponse{}, nil +} + +func (p *pauseService) SandboxStatus(ctx context.Context, req *api.SandboxStatusRequest) (*api.SandboxStatusResponse, error) { + log.Debugf("sandbox status request: %+v", req) + return &api.SandboxStatusResponse{}, nil +} + +func (p *pauseService) PingSandbox(ctx context.Context, req *api.PingRequest) (*api.PingResponse, error) { + return &api.PingResponse{}, nil +} diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 2bffe116a..4105f2b2b 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -194,6 +194,10 @@ type ShimProcess interface { ID() string // Namespace of this shim. Namespace() string + // Bundle is a file system path to shim's bundle. + Bundle() string + // Client returns the underlying TTRPC client for this shim. + Client() *ttrpc.Client } type shim struct { @@ -210,6 +214,10 @@ func (s *shim) Namespace() string { return s.bundle.Namespace } +func (s *shim) Bundle() string { + return s.bundle.Path +} + func (s *shim) Close() error { return s.client.Close() } @@ -243,6 +251,10 @@ type shimTask struct { task task.TaskService } +func (s *shimTask) Client() *ttrpc.Client { + return s.client +} + func (s *shimTask) Shutdown(ctx context.Context) error { _, err := s.task.Shutdown(ctx, &task.ShutdownRequest{ ID: s.ID(), @@ -271,7 +283,7 @@ func (s *shimTask) PID(ctx context.Context) (uint32, error) { return response.TaskPid, nil } -func (s *shimTask) delete(ctx context.Context, removeTask func(ctx context.Context, id string)) (*runtime.Exit, error) { +func (s *shimTask) delete(ctx context.Context, sandboxed bool, removeTask func(ctx context.Context, id string)) (*runtime.Exit, error) { response, shimErr := s.task.Delete(ctx, &task.DeleteRequest{ ID: s.ID(), }) @@ -299,8 +311,12 @@ func (s *shimTask) delete(ctx context.Context, removeTask func(ctx context.Conte removeTask(ctx, s.ID()) } - if err := s.waitShutdown(ctx); err != nil { - log.G(ctx).WithField("id", s.ID()).WithError(err).Error("failed to shutdown shim task") + // Don't shutdown sandbox as there may be other containers running. + // Let controller decide when to shutdown. + if !sandboxed { + if err := s.waitShutdown(ctx); err != nil { + log.G(ctx).WithField("id", s.ID()).WithError(err).Error("failed to shutdown shim task") + } } if err := s.shim.delete(ctx); err != nil { diff --git a/runtime/v2/task/sandbox.pb.go b/runtime/v2/task/sandbox.pb.go new file mode 100644 index 000000000..83268b854 --- /dev/null +++ b/runtime/v2/task/sandbox.pb.go @@ -0,0 +1,3694 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: github.com/containerd/containerd/runtime/v2/task/sandbox.proto + +package task + +import ( + context "context" + fmt "fmt" + types "github.com/containerd/containerd/api/types" + github_com_containerd_ttrpc "github.com/containerd/ttrpc" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + types1 "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type StartSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"` + Rootfs []*types.Mount `protobuf:"bytes,3,rep,name=rootfs,proto3" json:"rootfs,omitempty"` + Options *types1.Any `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartSandboxRequest) Reset() { *m = StartSandboxRequest{} } +func (*StartSandboxRequest) ProtoMessage() {} +func (*StartSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{0} +} +func (m *StartSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StartSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StartSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StartSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartSandboxRequest.Merge(m, src) +} +func (m *StartSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *StartSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StartSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StartSandboxRequest proto.InternalMessageInfo + +type StartSandboxResponse struct { + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StartSandboxResponse) Reset() { *m = StartSandboxResponse{} } +func (*StartSandboxResponse) ProtoMessage() {} +func (*StartSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{1} +} +func (m *StartSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StartSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StartSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StartSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StartSandboxResponse.Merge(m, src) +} +func (m *StartSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *StartSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StartSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StartSandboxResponse proto.InternalMessageInfo + +type StopSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + TimeoutSecs uint32 `protobuf:"varint,2,opt,name=timeout_secs,json=timeoutSecs,proto3" json:"timeout_secs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StopSandboxRequest) Reset() { *m = StopSandboxRequest{} } +func (*StopSandboxRequest) ProtoMessage() {} +func (*StopSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{2} +} +func (m *StopSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StopSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StopSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StopSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopSandboxRequest.Merge(m, src) +} +func (m *StopSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *StopSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StopSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StopSandboxRequest proto.InternalMessageInfo + +type StopSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StopSandboxResponse) Reset() { *m = StopSandboxResponse{} } +func (*StopSandboxResponse) ProtoMessage() {} +func (*StopSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{3} +} +func (m *StopSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StopSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StopSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StopSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StopSandboxResponse.Merge(m, src) +} +func (m *StopSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *StopSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StopSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StopSandboxResponse proto.InternalMessageInfo + +type UpdateSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + Resources *types1.Any `protobuf:"bytes,2,opt,name=resources,proto3" json:"resources,omitempty"` + Annotations map[string]string `protobuf:"bytes,3,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateSandboxRequest) Reset() { *m = UpdateSandboxRequest{} } +func (*UpdateSandboxRequest) ProtoMessage() {} +func (*UpdateSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{4} +} +func (m *UpdateSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UpdateSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateSandboxRequest.Merge(m, src) +} +func (m *UpdateSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *UpdateSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateSandboxRequest proto.InternalMessageInfo + +type WaitSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WaitSandboxRequest) Reset() { *m = WaitSandboxRequest{} } +func (*WaitSandboxRequest) ProtoMessage() {} +func (*WaitSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{5} +} +func (m *WaitSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WaitSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WaitSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WaitSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_WaitSandboxRequest.Merge(m, src) +} +func (m *WaitSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *WaitSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_WaitSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_WaitSandboxRequest proto.InternalMessageInfo + +type WaitSandboxResponse struct { + ExitStatus uint32 `protobuf:"varint,1,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,2,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *WaitSandboxResponse) Reset() { *m = WaitSandboxResponse{} } +func (*WaitSandboxResponse) ProtoMessage() {} +func (*WaitSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{6} +} +func (m *WaitSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WaitSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WaitSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WaitSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_WaitSandboxResponse.Merge(m, src) +} +func (m *WaitSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *WaitSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_WaitSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_WaitSandboxResponse proto.InternalMessageInfo + +type UpdateSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdateSandboxResponse) Reset() { *m = UpdateSandboxResponse{} } +func (*UpdateSandboxResponse) ProtoMessage() {} +func (*UpdateSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{7} +} +func (m *UpdateSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UpdateSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateSandboxResponse.Merge(m, src) +} +func (m *UpdateSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *UpdateSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateSandboxResponse proto.InternalMessageInfo + +type SandboxStatusRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SandboxStatusRequest) Reset() { *m = SandboxStatusRequest{} } +func (*SandboxStatusRequest) ProtoMessage() {} +func (*SandboxStatusRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{8} +} +func (m *SandboxStatusRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SandboxStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SandboxStatusRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SandboxStatusRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SandboxStatusRequest.Merge(m, src) +} +func (m *SandboxStatusRequest) XXX_Size() int { + return m.Size() +} +func (m *SandboxStatusRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SandboxStatusRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SandboxStatusRequest proto.InternalMessageInfo + +type PauseSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PauseSandboxRequest) Reset() { *m = PauseSandboxRequest{} } +func (*PauseSandboxRequest) ProtoMessage() {} +func (*PauseSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{9} +} +func (m *PauseSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PauseSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PauseSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PauseSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PauseSandboxRequest.Merge(m, src) +} +func (m *PauseSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *PauseSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PauseSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PauseSandboxRequest proto.InternalMessageInfo + +type PauseSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PauseSandboxResponse) Reset() { *m = PauseSandboxResponse{} } +func (*PauseSandboxResponse) ProtoMessage() {} +func (*PauseSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{10} +} +func (m *PauseSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PauseSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PauseSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PauseSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PauseSandboxResponse.Merge(m, src) +} +func (m *PauseSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *PauseSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PauseSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PauseSandboxResponse proto.InternalMessageInfo + +type ResumeSandboxRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResumeSandboxRequest) Reset() { *m = ResumeSandboxRequest{} } +func (*ResumeSandboxRequest) ProtoMessage() {} +func (*ResumeSandboxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{11} +} +func (m *ResumeSandboxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResumeSandboxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResumeSandboxRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResumeSandboxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResumeSandboxRequest.Merge(m, src) +} +func (m *ResumeSandboxRequest) XXX_Size() int { + return m.Size() +} +func (m *ResumeSandboxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ResumeSandboxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ResumeSandboxRequest proto.InternalMessageInfo + +type ResumeSandboxResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ResumeSandboxResponse) Reset() { *m = ResumeSandboxResponse{} } +func (*ResumeSandboxResponse) ProtoMessage() {} +func (*ResumeSandboxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{12} +} +func (m *ResumeSandboxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResumeSandboxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResumeSandboxResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResumeSandboxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResumeSandboxResponse.Merge(m, src) +} +func (m *ResumeSandboxResponse) XXX_Size() int { + return m.Size() +} +func (m *ResumeSandboxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ResumeSandboxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ResumeSandboxResponse proto.InternalMessageInfo + +type SandboxStatusResponse 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"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"` + ExitedAt time.Time `protobuf:"bytes,5,opt,name=exited_at,json=exitedAt,proto3,stdtime" json:"exited_at"` + Extra *types1.Any `protobuf:"bytes,6,opt,name=extra,proto3" json:"extra,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SandboxStatusResponse) Reset() { *m = SandboxStatusResponse{} } +func (*SandboxStatusResponse) ProtoMessage() {} +func (*SandboxStatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{13} +} +func (m *SandboxStatusResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SandboxStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SandboxStatusResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SandboxStatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SandboxStatusResponse.Merge(m, src) +} +func (m *SandboxStatusResponse) XXX_Size() int { + return m.Size() +} +func (m *SandboxStatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SandboxStatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SandboxStatusResponse proto.InternalMessageInfo + +type PingRequest struct { + SandboxID string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingRequest) Reset() { *m = PingRequest{} } +func (*PingRequest) ProtoMessage() {} +func (*PingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{14} +} +func (m *PingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingRequest.Merge(m, src) +} +func (m *PingRequest) XXX_Size() int { + return m.Size() +} +func (m *PingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PingRequest proto.InternalMessageInfo + +type PingResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PingResponse) Reset() { *m = PingResponse{} } +func (*PingResponse) ProtoMessage() {} +func (*PingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1a2e6d1f55947a07, []int{15} +} +func (m *PingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PingResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PingResponse.Merge(m, src) +} +func (m *PingResponse) XXX_Size() int { + return m.Size() +} +func (m *PingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PingResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*StartSandboxRequest)(nil), "containerd.task.v2.StartSandboxRequest") + proto.RegisterType((*StartSandboxResponse)(nil), "containerd.task.v2.StartSandboxResponse") + proto.RegisterType((*StopSandboxRequest)(nil), "containerd.task.v2.StopSandboxRequest") + proto.RegisterType((*StopSandboxResponse)(nil), "containerd.task.v2.StopSandboxResponse") + proto.RegisterType((*UpdateSandboxRequest)(nil), "containerd.task.v2.UpdateSandboxRequest") + proto.RegisterMapType((map[string]string)(nil), "containerd.task.v2.UpdateSandboxRequest.AnnotationsEntry") + proto.RegisterType((*WaitSandboxRequest)(nil), "containerd.task.v2.WaitSandboxRequest") + proto.RegisterType((*WaitSandboxResponse)(nil), "containerd.task.v2.WaitSandboxResponse") + proto.RegisterType((*UpdateSandboxResponse)(nil), "containerd.task.v2.UpdateSandboxResponse") + proto.RegisterType((*SandboxStatusRequest)(nil), "containerd.task.v2.SandboxStatusRequest") + proto.RegisterType((*PauseSandboxRequest)(nil), "containerd.task.v2.PauseSandboxRequest") + proto.RegisterType((*PauseSandboxResponse)(nil), "containerd.task.v2.PauseSandboxResponse") + proto.RegisterType((*ResumeSandboxRequest)(nil), "containerd.task.v2.ResumeSandboxRequest") + proto.RegisterType((*ResumeSandboxResponse)(nil), "containerd.task.v2.ResumeSandboxResponse") + proto.RegisterType((*SandboxStatusResponse)(nil), "containerd.task.v2.SandboxStatusResponse") + proto.RegisterType((*PingRequest)(nil), "containerd.task.v2.PingRequest") + proto.RegisterType((*PingResponse)(nil), "containerd.task.v2.PingResponse") +} + +func init() { + proto.RegisterFile("github.com/containerd/containerd/runtime/v2/task/sandbox.proto", fileDescriptor_1a2e6d1f55947a07) +} + +var fileDescriptor_1a2e6d1f55947a07 = []byte{ + // 790 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0xfb, 0x46, + 0x10, 0x8d, 0xe4, 0xc4, 0x89, 0x47, 0x76, 0x09, 0x1b, 0x3b, 0x71, 0x75, 0xb0, 0x5c, 0x1d, 0x1a, + 0xb7, 0x14, 0x09, 0x5c, 0x28, 0xfd, 0x03, 0x01, 0xbb, 0xe9, 0x21, 0x87, 0x82, 0x91, 0x5b, 0x5a, + 0x28, 0xd4, 0xac, 0xad, 0x8d, 0x23, 0x12, 0x6b, 0x55, 0xed, 0x2a, 0xc4, 0xb7, 0x7e, 0x84, 0x42, + 0xe9, 0x47, 0x2a, 0xe4, 0xd8, 0x63, 0x4f, 0x69, 0xe3, 0xcb, 0xef, 0x6b, 0xfc, 0x58, 0xef, 0x3a, + 0x96, 0x9d, 0xcd, 0x1f, 0xe2, 0xdb, 0x6a, 0xf5, 0xf6, 0xcd, 0xcc, 0x9b, 0x79, 0x03, 0x27, 0xe3, + 0x88, 0x5f, 0x64, 0x43, 0x6f, 0x44, 0x27, 0xfe, 0x88, 0xc6, 0x1c, 0x47, 0x31, 0x49, 0xc3, 0xfc, + 0x31, 0xcd, 0x62, 0x1e, 0x4d, 0x88, 0x7f, 0xdd, 0xf6, 0x39, 0x66, 0x97, 0x3e, 0xc3, 0x71, 0x38, + 0xa4, 0x37, 0x5e, 0x92, 0x52, 0x4e, 0x11, 0x5a, 0x22, 0x3d, 0xf1, 0xdb, 0xbb, 0x6e, 0xdb, 0x1f, + 0x8e, 0x29, 0x1d, 0x5f, 0x11, 0x7f, 0x8e, 0x18, 0x66, 0xe7, 0x3e, 0x8e, 0xa7, 0x12, 0x6e, 0x3b, + 0xeb, 0xbf, 0x04, 0x35, 0xe3, 0x78, 0x92, 0x28, 0x40, 0x75, 0x4c, 0xc7, 0x74, 0x7e, 0xf4, 0xc5, + 0x49, 0xdd, 0x7e, 0xf1, 0x62, 0x96, 0x38, 0x89, 0x7c, 0x3e, 0x4d, 0x08, 0xf3, 0x27, 0x34, 0x8b, + 0xb9, 0x7c, 0xe7, 0xfe, 0x6d, 0xc0, 0x41, 0x9f, 0xe3, 0x94, 0xf7, 0x65, 0xd2, 0x01, 0xf9, 0x2d, + 0x23, 0x8c, 0xa3, 0xcf, 0x00, 0x54, 0x19, 0x83, 0x28, 0xac, 0x1b, 0x4d, 0xa3, 0x55, 0xea, 0x56, + 0x66, 0x77, 0x4e, 0x49, 0xe1, 0xce, 0x4e, 0x83, 0x92, 0x02, 0x9c, 0x85, 0xc8, 0x01, 0x6b, 0x98, + 0xc5, 0xe1, 0x15, 0x19, 0x24, 0x98, 0x5f, 0xd4, 0x4d, 0x01, 0x0f, 0x40, 0x5e, 0xf5, 0x30, 0xbf, + 0x40, 0x3e, 0x14, 0x53, 0x4a, 0xf9, 0x39, 0xab, 0x17, 0x9a, 0x85, 0x96, 0xd5, 0x3e, 0xf2, 0xf2, + 0xaa, 0x88, 0xac, 0xbc, 0xef, 0x45, 0x56, 0x81, 0x82, 0x21, 0x0f, 0x76, 0x69, 0xc2, 0x23, 0x1a, + 0xb3, 0xfa, 0x76, 0xd3, 0x68, 0x59, 0xed, 0xaa, 0x27, 0x85, 0xf1, 0x16, 0xc2, 0x78, 0x9d, 0x78, + 0x1a, 0x2c, 0x40, 0x6e, 0x0b, 0xaa, 0xab, 0x65, 0xb0, 0x84, 0xc6, 0x8c, 0xa0, 0x7d, 0x28, 0x24, + 0xaa, 0x80, 0x4a, 0x20, 0x8e, 0x2e, 0x01, 0xd4, 0xe7, 0x34, 0xd9, 0xa8, 0xde, 0x8f, 0xa0, 0x2c, + 0xda, 0x42, 0x33, 0x3e, 0x60, 0x64, 0xc4, 0xe6, 0x05, 0x57, 0x02, 0x4b, 0xdd, 0xf5, 0xc9, 0x88, + 0xb9, 0x35, 0xa1, 0x6b, 0x2e, 0x8c, 0xcc, 0xc7, 0xfd, 0xcb, 0x84, 0xea, 0x8f, 0x49, 0x88, 0x39, + 0xd9, 0x28, 0x81, 0x36, 0x94, 0x52, 0xc2, 0x68, 0x96, 0x8e, 0x88, 0x8c, 0xfe, 0x94, 0x40, 0x4b, + 0x18, 0xfa, 0x05, 0x2c, 0x1c, 0xc7, 0x94, 0x63, 0x29, 0xab, 0x6c, 0xc4, 0x57, 0xde, 0xe3, 0xf1, + 0xf4, 0x74, 0x09, 0x7a, 0x9d, 0xe5, 0xdb, 0xef, 0x62, 0x9e, 0x4e, 0x83, 0x3c, 0x9b, 0x7d, 0x02, + 0xfb, 0xeb, 0x00, 0xa1, 0xfd, 0x25, 0x99, 0xca, 0x5a, 0x02, 0x71, 0x44, 0x55, 0xd8, 0xb9, 0xc6, + 0x57, 0x19, 0x51, 0x13, 0x22, 0x3f, 0xbe, 0x36, 0xbf, 0x34, 0xdc, 0x2e, 0xa0, 0x9f, 0x70, 0xb4, + 0xd1, 0x14, 0xba, 0x53, 0x38, 0x58, 0xe1, 0x50, 0x23, 0xe0, 0x80, 0x45, 0x6e, 0x22, 0x3e, 0x60, + 0x1c, 0xf3, 0x8c, 0xa9, 0x51, 0x00, 0x71, 0xd5, 0x9f, 0xdf, 0xa0, 0x0e, 0x94, 0xc4, 0x17, 0x09, + 0x07, 0x98, 0x2b, 0x31, 0xed, 0x47, 0x62, 0xfe, 0xb0, 0xb0, 0x61, 0x77, 0xef, 0xf6, 0xce, 0xd9, + 0xfa, 0xe3, 0x3f, 0xc7, 0x08, 0xf6, 0xe4, 0xb3, 0x0e, 0x77, 0x8f, 0xa0, 0xb6, 0x26, 0x9a, 0xea, + 0xf7, 0x29, 0x54, 0xd5, 0x95, 0x0c, 0xf6, 0xb6, 0xca, 0xbe, 0x85, 0x83, 0x1e, 0xce, 0xd8, 0x46, + 0x33, 0xe3, 0x1e, 0x42, 0x75, 0x95, 0x64, 0x99, 0x62, 0x40, 0x58, 0x36, 0xd9, 0x8c, 0xfd, 0x08, + 0x6a, 0x6b, 0x2c, 0x8a, 0xfe, 0x9d, 0x01, 0xb5, 0x35, 0x09, 0x54, 0x63, 0x0e, 0xc1, 0x7c, 0x20, + 0x2e, 0xce, 0xee, 0x1c, 0xf3, 0xec, 0x34, 0x30, 0xa3, 0x70, 0xe1, 0x59, 0xf3, 0xc1, 0xb3, 0x62, + 0x6e, 0x44, 0xf7, 0x48, 0xbd, 0x20, 0xe7, 0x66, 0xfe, 0xb1, 0xde, 0xd8, 0xed, 0xe7, 0x1b, 0xbb, + 0xf3, 0x96, 0xc6, 0xa2, 0x4f, 0x61, 0x87, 0xdc, 0xf0, 0x14, 0xd7, 0x8b, 0xcf, 0x98, 0x4c, 0x42, + 0xdc, 0x6f, 0xc0, 0xea, 0x45, 0xf1, 0xf8, 0x6d, 0xfa, 0x7d, 0x00, 0x65, 0xf9, 0x58, 0x8a, 0xd3, + 0xfe, 0xb3, 0x08, 0xbb, 0x0a, 0x88, 0x30, 0x94, 0xf3, 0xcb, 0x0d, 0x1d, 0xeb, 0x4c, 0xab, 0xd9, + 0xe2, 0x76, 0xeb, 0x65, 0xa0, 0xea, 0xc5, 0xaf, 0x60, 0xe5, 0xd6, 0x15, 0xfa, 0x58, 0xff, 0x70, + 0x7d, 0x6d, 0xda, 0xc7, 0x2f, 0xe2, 0x96, 0xfc, 0x39, 0x6f, 0xea, 0xf9, 0x1f, 0x2f, 0x00, 0x3d, + 0xbf, 0xce, 0xe4, 0x21, 0x54, 0x56, 0x0c, 0x88, 0x5a, 0xaf, 0x5d, 0x6c, 0xf6, 0x27, 0xaf, 0x40, + 0xaa, 0x28, 0x18, 0xca, 0x79, 0x0b, 0xe9, 0x1b, 0xa1, 0x71, 0xaa, 0xbe, 0x11, 0x3a, 0x37, 0x8a, + 0x42, 0x56, 0x7c, 0xa4, 0x2f, 0x44, 0x67, 0x58, 0x7d, 0x21, 0x5a, 0x53, 0x8a, 0x28, 0x2b, 0x9e, + 0xd4, 0x47, 0xd1, 0x6d, 0x2e, 0x7d, 0x14, 0xbd, 0xc1, 0x7b, 0xd2, 0x10, 0x8b, 0x4a, 0x1c, 0xad, + 0x08, 0x4b, 0xc7, 0xd8, 0xcd, 0xa7, 0x01, 0x92, 0xb1, 0x5b, 0xbf, 0xbd, 0x6f, 0x6c, 0xfd, 0x7b, + 0xdf, 0xd8, 0xfa, 0x7d, 0xd6, 0x30, 0x6e, 0x67, 0x0d, 0xe3, 0x9f, 0x59, 0xc3, 0xf8, 0x7f, 0xd6, + 0x30, 0x7e, 0x36, 0x87, 0xc5, 0xb9, 0x27, 0x3f, 0x7f, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x96, + 0x09, 0x90, 0xb1, 0x09, 0x00, 0x00, +} + +func (m *StartSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StartSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StartSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Options != nil { + { + size, err := m.Options.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Rootfs) > 0 { + for iNdEx := len(m.Rootfs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rootfs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.BundlePath) > 0 { + i -= len(m.BundlePath) + copy(dAtA[i:], m.BundlePath) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.BundlePath))) + i-- + dAtA[i] = 0x12 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StartSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StartSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StartSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StopSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StopSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StopSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.TimeoutSecs != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.TimeoutSecs)) + i-- + dAtA[i] = 0x10 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StopSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StopSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StopSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *UpdateSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Annotations) > 0 { + for k := range m.Annotations { + v := m.Annotations[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintSandbox(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintSandbox(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintSandbox(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.Resources != nil { + { + size, err := m.Resources.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WaitSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WaitSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WaitSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WaitSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WaitSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WaitSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintSandbox(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x12 + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *UpdateSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdateSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *SandboxStatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SandboxStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SandboxStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PauseSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PauseSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PauseSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PauseSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PauseSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PauseSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *ResumeSandboxRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResumeSandboxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResumeSandboxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ResumeSandboxResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResumeSandboxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResumeSandboxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *SandboxStatusResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SandboxStatusResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SandboxStatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Extra != nil { + { + size, err := m.Extra.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSandbox(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExitedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintSandbox(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x2a + if m.ExitStatus != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.ExitStatus)) + i-- + dAtA[i] = 0x20 + } + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x1a + } + if m.Pid != 0 { + i = encodeVarintSandbox(dAtA, i, uint64(m.Pid)) + i-- + dAtA[i] = 0x10 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PingRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SandboxID) > 0 { + i -= len(m.SandboxID) + copy(dAtA[i:], m.SandboxID) + i = encodeVarintSandbox(dAtA, i, uint64(len(m.SandboxID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PingResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func encodeVarintSandbox(dAtA []byte, offset int, v uint64) int { + offset -= sovSandbox(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StartSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + l = len(m.BundlePath) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Rootfs) > 0 { + for _, e := range m.Rootfs { + l = e.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + } + if m.Options != nil { + l = m.Options.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StartSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StopSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.TimeoutSecs != 0 { + n += 1 + sovSandbox(uint64(m.TimeoutSecs)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StopSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpdateSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Resources != nil { + l = m.Resources.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if len(m.Annotations) > 0 { + for k, v := range m.Annotations { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovSandbox(uint64(len(k))) + 1 + len(v) + sovSandbox(uint64(len(v))) + n += mapEntrySize + 1 + sovSandbox(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WaitSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *WaitSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *UpdateSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SandboxStatusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PauseSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PauseSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResumeSandboxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ResumeSandboxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *SandboxStatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.Pid != 0 { + n += 1 + sovSandbox(uint64(m.Pid)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.ExitStatus != 0 { + n += 1 + sovSandbox(uint64(m.ExitStatus)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExitedAt) + n += 1 + l + sovSandbox(uint64(l)) + if m.Extra != nil { + l = m.Extra.Size() + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SandboxID) + if l > 0 { + n += 1 + l + sovSandbox(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *PingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSandbox(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSandbox(x uint64) (n int) { + return sovSandbox(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StartSandboxRequest) String() string { + if this == nil { + return "nil" + } + repeatedStringForRootfs := "[]*Mount{" + for _, f := range this.Rootfs { + repeatedStringForRootfs += strings.Replace(fmt.Sprintf("%v", f), "Mount", "types.Mount", 1) + "," + } + repeatedStringForRootfs += "}" + s := strings.Join([]string{`&StartSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`, + `Rootfs:` + repeatedStringForRootfs + `,`, + `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StartSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StartSandboxResponse{`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StopSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StopSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `TimeoutSecs:` + fmt.Sprintf("%v", this.TimeoutSecs) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *StopSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&StopSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateSandboxRequest) String() string { + if this == nil { + return "nil" + } + keysForAnnotations := make([]string, 0, len(this.Annotations)) + for k, _ := range this.Annotations { + keysForAnnotations = append(keysForAnnotations, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations) + mapStringForAnnotations := "map[string]string{" + for _, k := range keysForAnnotations { + mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k]) + } + mapStringForAnnotations += "}" + s := strings.Join([]string{`&UpdateSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `Resources:` + strings.Replace(fmt.Sprintf("%v", this.Resources), "Any", "types1.Any", 1) + `,`, + `Annotations:` + mapStringForAnnotations + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *WaitSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WaitSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *WaitSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WaitSandboxResponse{`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *UpdateSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&UpdateSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *SandboxStatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SandboxStatusRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PauseSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PauseSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PauseSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PauseSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ResumeSandboxRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResumeSandboxRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *ResumeSandboxResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResumeSandboxResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *SandboxStatusResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&SandboxStatusResponse{`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, + `Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, + `State:` + fmt.Sprintf("%v", this.State) + `,`, + `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, + `ExitedAt:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ExitedAt), "Timestamp", "types1.Timestamp", 1), `&`, ``, 1) + `,`, + `Extra:` + strings.Replace(fmt.Sprintf("%v", this.Extra), "Any", "types1.Any", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingRequest{`, + `SandboxID:` + fmt.Sprintf("%v", this.SandboxID) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *PingResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PingResponse{`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func valueToStringSandbox(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} + +type SandboxService interface { + StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) + StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, error) + WaitSandbox(ctx context.Context, req *WaitSandboxRequest) (*WaitSandboxResponse, error) + UpdateSandbox(ctx context.Context, req *UpdateSandboxRequest) (*UpdateSandboxResponse, error) + PauseSandbox(ctx context.Context, req *PauseSandboxRequest) (*PauseSandboxResponse, error) + ResumeSandbox(ctx context.Context, req *ResumeSandboxRequest) (*ResumeSandboxResponse, error) + SandboxStatus(ctx context.Context, req *SandboxStatusRequest) (*SandboxStatusResponse, error) + PingSandbox(ctx context.Context, req *PingRequest) (*PingResponse, error) +} + +func RegisterSandboxService(srv *github_com_containerd_ttrpc.Server, svc SandboxService) { + srv.Register("containerd.task.v2.Sandbox", map[string]github_com_containerd_ttrpc.Method{ + "StartSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req StartSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.StartSandbox(ctx, &req) + }, + "StopSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req StopSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.StopSandbox(ctx, &req) + }, + "WaitSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req WaitSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.WaitSandbox(ctx, &req) + }, + "UpdateSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req UpdateSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.UpdateSandbox(ctx, &req) + }, + "PauseSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req PauseSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.PauseSandbox(ctx, &req) + }, + "ResumeSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req ResumeSandboxRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.ResumeSandbox(ctx, &req) + }, + "SandboxStatus": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req SandboxStatusRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.SandboxStatus(ctx, &req) + }, + "PingSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) { + var req PingRequest + if err := unmarshal(&req); err != nil { + return nil, err + } + return svc.PingSandbox(ctx, &req) + }, + }) +} + +type sandboxClient struct { + client *github_com_containerd_ttrpc.Client +} + +func NewSandboxClient(client *github_com_containerd_ttrpc.Client) SandboxService { + return &sandboxClient{ + client: client, + } +} + +func (c *sandboxClient) StartSandbox(ctx context.Context, req *StartSandboxRequest) (*StartSandboxResponse, error) { + var resp StartSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "StartSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) StopSandbox(ctx context.Context, req *StopSandboxRequest) (*StopSandboxResponse, error) { + var resp StopSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "StopSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) WaitSandbox(ctx context.Context, req *WaitSandboxRequest) (*WaitSandboxResponse, error) { + var resp WaitSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "WaitSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) UpdateSandbox(ctx context.Context, req *UpdateSandboxRequest) (*UpdateSandboxResponse, error) { + var resp UpdateSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "UpdateSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) PauseSandbox(ctx context.Context, req *PauseSandboxRequest) (*PauseSandboxResponse, error) { + var resp PauseSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "PauseSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) ResumeSandbox(ctx context.Context, req *ResumeSandboxRequest) (*ResumeSandboxResponse, error) { + var resp ResumeSandboxResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "ResumeSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) SandboxStatus(ctx context.Context, req *SandboxStatusRequest) (*SandboxStatusResponse, error) { + var resp SandboxStatusResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "SandboxStatus", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} + +func (c *sandboxClient) PingSandbox(ctx context.Context, req *PingRequest) (*PingResponse, error) { + var resp PingResponse + if err := c.client.Call(ctx, "containerd.task.v2.Sandbox", "PingSandbox", req, &resp); err != nil { + return nil, err + } + return &resp, nil +} +func (m *StartSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: StartSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StartSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlePath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundlePath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rootfs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rootfs = append(m.Rootfs, &types.Mount{}) + if err := m.Rootfs[len(m.Rootfs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Options == nil { + m.Options = &types1.Any{} + } + if err := m.Options.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StartSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: StartSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StartSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StopSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: StopSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StopSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSecs", wireType) + } + m.TimeoutSecs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutSecs |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StopSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: StopSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StopSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: UpdateSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resources == nil { + m.Resources = &types1.Any{} + } + if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Annotations == nil { + m.Annotations = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthSandbox + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Annotations[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WaitSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: WaitSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WaitSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WaitSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: WaitSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WaitSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: UpdateSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SandboxStatusRequest) 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 ErrIntOverflowSandbox + } + 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: SandboxStatusRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SandboxStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PauseSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: PauseSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PauseSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PauseSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: PauseSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PauseSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResumeSandboxRequest) 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 ErrIntOverflowSandbox + } + 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: ResumeSandboxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResumeSandboxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResumeSandboxResponse) 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 ErrIntOverflowSandbox + } + 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: ResumeSandboxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResumeSandboxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SandboxStatusResponse) 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 ErrIntOverflowSandbox + } + 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: SandboxStatusResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SandboxStatusResponse: 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 ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) + } + m.Pid = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Pid |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) + } + m.ExitStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitStatus |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExitedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extra", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSandbox + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Extra == nil { + m.Extra = &types1.Any{} + } + if err := m.Extra.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingRequest) 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 ErrIntOverflowSandbox + } + 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: PingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SandboxID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSandbox + } + 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 ErrInvalidLengthSandbox + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSandbox + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SandboxID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PingResponse) 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 ErrIntOverflowSandbox + } + 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: PingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSandbox(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthSandbox + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSandbox(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + 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, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSandbox + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSandbox + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSandbox + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSandbox + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSandbox = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSandbox = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSandbox = fmt.Errorf("proto: unexpected end of group") +) diff --git a/runtime/v2/task/sandbox.proto b/runtime/v2/task/sandbox.proto new file mode 100644 index 000000000..6ef735391 --- /dev/null +++ b/runtime/v2/task/sandbox.proto @@ -0,0 +1,121 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +syntax = "proto3"; + +package containerd.task.v2; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import weak "gogoproto/gogo.proto"; + +import "github.com/containerd/containerd/api/types/mount.proto"; + +// Sandbox is an optional interface that shim may implement to support sandboxes environments. +// A typical example of sandbox is microVM or pause container - an entity that groups containers and/or +// holds resources relevant for this group. +service Sandbox { + // StartSandbox will create/start a new sandbox instance + rpc StartSandbox(StartSandboxRequest) returns (StartSandboxResponse); + + // StopSandbox will stop existing sandbox instance + rpc StopSandbox(StopSandboxRequest) returns (StopSandboxResponse); + + // WaitSandbox blocks until sanbox exits. + rpc WaitSandbox(WaitSandboxRequest) returns (WaitSandboxResponse); + + // Update can be used to amend the state of currently running sandbox instance (depending on + // implementation this can be used to resize/reacquire needed resources like RAM/CPU). + rpc UpdateSandbox(UpdateSandboxRequest) returns (UpdateSandboxResponse); + + // PauseSandbox will suspend currently running sandbox instance. + rpc PauseSandbox(PauseSandboxRequest) returns (PauseSandboxResponse); + + // ResumeSandbox will resuyme previously suspended sandbox instance. + rpc ResumeSandbox(ResumeSandboxRequest) returns (ResumeSandboxResponse); + + // SandboxStatus will return current status of the running sandbox instance + rpc SandboxStatus(SandboxStatusRequest) returns (SandboxStatusResponse); + + // PingSandbox is a lightweight API call to check whether sandbox alive. + rpc PingSandbox(PingRequest) returns (PingResponse); +} + +message StartSandboxRequest { + string sandbox_id = 1; + string bundle_path = 2; + repeated containerd.types.Mount rootfs = 3; + google.protobuf.Any options = 4; +} + +message StartSandboxResponse { + uint32 pid = 1; +} + +message StopSandboxRequest { + string sandbox_id = 1; + uint32 timeout_secs = 2; +} + +message StopSandboxResponse {} + +message UpdateSandboxRequest { + string sandbox_id = 1; + google.protobuf.Any resources = 2; + map annotations = 3; +} + +message WaitSandboxRequest { + string sandbox_id = 1; +} + +message WaitSandboxResponse { + uint32 exit_status = 1; + google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} + +message UpdateSandboxResponse {} + +message SandboxStatusRequest { + string sandbox_id = 1; +} + +message PauseSandboxRequest { + string sandbox_id = 1; +} + +message PauseSandboxResponse {} + +message ResumeSandboxRequest { + string sandbox_id = 1; +} + +message ResumeSandboxResponse {} + +message SandboxStatusResponse { + string id = 1; + uint32 pid = 2; + string state = 3; + uint32 exit_status = 4; + google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Any extra = 6; +} + +message PingRequest { + string sandbox_id = 1; +} + +message PingResponse {} diff --git a/sandbox.go b/sandbox.go new file mode 100644 index 000000000..ef5f94d3e --- /dev/null +++ b/sandbox.go @@ -0,0 +1,239 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + "fmt" + "time" + + "github.com/containerd/containerd/containers" + "github.com/containerd/containerd/oci" + api "github.com/containerd/containerd/sandbox" + "github.com/containerd/typeurl" + "github.com/gogo/protobuf/types" + "github.com/pkg/errors" +) + +// Sandbox is a high level client to containerd's sandboxes. +type Sandbox interface { + // ID is a sandbox identifier + ID() string + // PID returns sandbox's process PID or error if its not yet started. + PID() (uint32, error) + // NewContainer creates new container that will belong to this sandbox + NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) + // Labels returns the labels set on the sandbox + Labels(ctx context.Context) (map[string]string, error) + // Start starts new sandbox instance + Start(ctx context.Context) error + // Stop sends stop request to the shim instance. + Stop(ctx context.Context) error + // Wait blocks until sandbox process exits. + Wait(ctx context.Context) (<-chan ExitStatus, error) + // Delete removes sandbox from the metadata store. + Delete(ctx context.Context) error +} + +type sandboxClient struct { + pid *uint32 + client *Client + metadata api.Sandbox +} + +func (s *sandboxClient) ID() string { + return s.metadata.ID +} + +func (s *sandboxClient) PID() (uint32, error) { + if s.pid == nil { + return 0, fmt.Errorf("sandbox not started") + } + + return *s.pid, nil +} + +func (s *sandboxClient) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { + return s.client.NewContainer(ctx, id, append(opts, WithSandbox(s.ID()))...) +} + +func (s *sandboxClient) Labels(ctx context.Context) (map[string]string, error) { + sandbox, err := s.client.SandboxStore().Get(ctx, s.ID()) + if err != nil { + return nil, err + } + + return sandbox.Labels, nil +} + +func (s *sandboxClient) Start(ctx context.Context) error { + pid, err := s.client.SandboxController().Start(ctx, s.ID()) + if err != nil { + return err + } + + s.pid = &pid + return nil +} + +func (s *sandboxClient) Wait(ctx context.Context) (<-chan ExitStatus, error) { + c := make(chan ExitStatus, 1) + go func() { + defer close(c) + + resp, err := s.client.SandboxController().Wait(ctx, s.ID()) + if err != nil { + c <- ExitStatus{ + code: UnknownExitStatus, + err: err, + } + return + } + + c <- ExitStatus{ + code: resp.ExitStatus, + exitedAt: resp.ExitedAt, + } + }() + + return c, nil +} + +func (s *sandboxClient) Stop(ctx context.Context) error { + return s.client.SandboxController().Shutdown(ctx, s.ID()) +} + +func (s *sandboxClient) Delete(ctx context.Context) error { + return s.client.SandboxStore().Delete(ctx, s.ID()) +} + +// NewSandbox creates new sandbox client +func (c *Client) NewSandbox(ctx context.Context, sandboxID string, opts ...NewSandboxOpts) (Sandbox, error) { + if sandboxID == "" { + return nil, errors.New("sandbox ID must be specified") + } + + newSandbox := api.Sandbox{ + ID: sandboxID, + CreatedAt: time.Now().UTC(), + UpdatedAt: time.Now().UTC(), + } + + for _, opt := range opts { + if err := opt(ctx, c, &newSandbox); err != nil { + return nil, err + } + } + + metadata, err := c.SandboxStore().Create(ctx, newSandbox) + if err != nil { + return nil, err + } + + return &sandboxClient{ + pid: nil, // Not yet started + client: c, + metadata: metadata, + }, nil +} + +// LoadSandbox laods existing sandbox metadata object using the id +func (c *Client) LoadSandbox(ctx context.Context, id string) (Sandbox, error) { + sandbox, err := c.SandboxStore().Get(ctx, id) + if err != nil { + return nil, err + } + + status, err := c.SandboxController().Status(ctx, id) + if err != nil { + return nil, fmt.Errorf("failed to load sandbox %s, status request failed: %w", id, err) + } + + return &sandboxClient{ + pid: &status.Pid, + client: c, + metadata: sandbox, + }, nil +} + +// NewSandboxOpts is a sandbox options and extensions to be provided by client +type NewSandboxOpts func(ctx context.Context, client *Client, sandbox *api.Sandbox) error + +// WithSandboxRuntime allows a user to specify the runtime to be used to run a sandbox +func WithSandboxRuntime(name string, options interface{}) NewSandboxOpts { + return func(ctx context.Context, client *Client, s *api.Sandbox) error { + if options == nil { + options = &types.Empty{} + } + + opts, err := typeurl.MarshalAny(options) + if err != nil { + return errors.Wrap(err, "failed to marshal sandbox runtime options") + } + + s.Runtime = api.RuntimeOpts{ + Name: name, + Options: opts, + } + + return nil + } +} + +// WithSandboxSpec will provide the sandbox runtime spec +func WithSandboxSpec(s *oci.Spec, opts ...oci.SpecOpts) NewSandboxOpts { + return func(ctx context.Context, client *Client, sandbox *api.Sandbox) error { + c := &containers.Container{ID: sandbox.ID} + + if err := oci.ApplyOpts(ctx, client, c, s, opts...); err != nil { + return err + } + + spec, err := typeurl.MarshalAny(s) + if err != nil { + return errors.Wrap(err, "failed to marshal spec") + } + + sandbox.Spec = spec + return nil + } +} + +// WithSandboxExtension attaches an extension to sandbox +func WithSandboxExtension(name string, ext interface{}) NewSandboxOpts { + return func(ctx context.Context, client *Client, s *api.Sandbox) error { + if s.Extensions == nil { + s.Extensions = make(map[string]typeurl.Any) + } + + any, err := typeurl.MarshalAny(ext) + if err != nil { + return errors.Wrap(err, "failed to marshal sandbox extension") + } + + s.Extensions[name] = any + return err + } +} + +// WithSandboxLabels attaches map of labels to sandbox +func WithSandboxLabels(labels map[string]string) NewSandboxOpts { + return func(ctx context.Context, client *Client, sandbox *api.Sandbox) error { + sandbox.Labels = labels + return nil + } +} diff --git a/sandbox/controller.go b/sandbox/controller.go new file mode 100644 index 000000000..e597e4b73 --- /dev/null +++ b/sandbox/controller.go @@ -0,0 +1,41 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + + "github.com/containerd/containerd/api/services/sandbox/v1" +) + +// Controller is an interface to manage sandboxes at runtime. +// When running in sandbox mode, shim expected to implement `SandboxService`. +// Shim lifetimes are now managed manually via sandbox API by the containerd's client. +type Controller interface { + // Start will start new sandbox instance. + // containerd will run new shim runtime instance and will invoke Start to create a sandbox process. + // This routine must be invoked before scheduling containers on this instance. + // Once started clients may run containers via Task service (additionally specifying sandbox id the container will belong to). + Start(ctx context.Context, sandboxID string) (uint32, error) + // Shutdown deletes and cleans all tasks and sandbox instance. + Shutdown(ctx context.Context, sandboxID string) error + // Wait blocks until sandbox process exits. + Wait(ctx context.Context, sandboxID string) (*sandbox.ControllerWaitResponse, error) + // Status will query sandbox process status. It is heavier than Ping call and must be used whenever you need to + // gather metadata about current sandbox state (status, uptime, resource use, etc). + Status(ctx context.Context, sandboxID string) (*sandbox.ControllerStatusResponse, error) +} diff --git a/sandbox/helpers.go b/sandbox/helpers.go new file mode 100644 index 000000000..0ffd7bbd0 --- /dev/null +++ b/sandbox/helpers.go @@ -0,0 +1,68 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "github.com/containerd/containerd/api/types" + "github.com/containerd/containerd/protobuf" + "github.com/containerd/typeurl" + gogo_types "github.com/gogo/protobuf/types" +) + +// ToProto will map Sandbox struct to it's protobuf definition +func ToProto(sandbox *Sandbox) types.Sandbox { + extensions := make(map[string]gogo_types.Any) + for k, v := range sandbox.Extensions { + extensions[k] = *protobuf.FromAny(v) + } + return types.Sandbox{ + SandboxID: sandbox.ID, + Runtime: types.Sandbox_Runtime{ + Name: sandbox.Runtime.Name, + Options: protobuf.FromAny(sandbox.Runtime.Options), + }, + Labels: sandbox.Labels, + CreatedAt: sandbox.CreatedAt, + UpdatedAt: sandbox.UpdatedAt, + Extensions: extensions, + Spec: protobuf.FromAny(sandbox.Spec), + } +} + +// FromProto map protobuf sandbox definition to Sandbox struct +func FromProto(sandboxpb *types.Sandbox) Sandbox { + runtime := RuntimeOpts{ + Name: sandboxpb.Runtime.Name, + Options: sandboxpb.Runtime.Options, + } + + extensions := make(map[string]typeurl.Any) + for k, v := range sandboxpb.Extensions { + v := v + extensions[k] = &v + } + + return Sandbox{ + ID: sandboxpb.SandboxID, + Labels: sandboxpb.Labels, + Runtime: runtime, + Spec: sandboxpb.Spec, + CreatedAt: sandboxpb.CreatedAt, + UpdatedAt: sandboxpb.UpdatedAt, + Extensions: extensions, + } +} diff --git a/sandbox/store.go b/sandbox/store.go new file mode 100644 index 000000000..d81a17e77 --- /dev/null +++ b/sandbox/store.go @@ -0,0 +1,66 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "time" + + "github.com/containerd/typeurl" +) + +// Sandbox is an object stored in metadata database +type Sandbox struct { + // ID uniquely identifies the sandbox in a namespace + ID string + // Labels provide metadata extension for a sandbox + Labels map[string]string + // Runtime shim to use for this sandbox + Runtime RuntimeOpts + // Spec carries the runtime specification used to implement the sandbox + Spec typeurl.Any + // CreatedAt is the time at which the sandbox was created + CreatedAt time.Time + // UpdatedAt is the time at which the sandbox was updated + UpdatedAt time.Time + // Extensions stores client-specified metadata + Extensions map[string]typeurl.Any +} + +// RuntimeOpts holds runtime specific information +type RuntimeOpts struct { + Name string + Options typeurl.Any +} + +// Store is a storage interface for sandbox metadata objects +type Store interface { + // Create a sandbox record in the store + Create(ctx context.Context, sandbox Sandbox) (Sandbox, error) + + // Update the sandbox with the provided sandbox object and fields + Update(ctx context.Context, sandbox Sandbox, fieldpaths ...string) (Sandbox, error) + + // Get sandbox metadata using the id + Get(ctx context.Context, id string) (Sandbox, error) + + // List returns sandboxes that match one or more of the provided filters + List(ctx context.Context, filters ...string) ([]Sandbox, error) + + // Delete a sandbox from metadata store using the id + Delete(ctx context.Context, id string) error +} diff --git a/sandbox_controller.go b/sandbox_controller.go new file mode 100644 index 000000000..17e91889b --- /dev/null +++ b/sandbox_controller.go @@ -0,0 +1,73 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/errdefs" + sb "github.com/containerd/containerd/sandbox" +) + +// sandboxRemoteController is a low level GRPC client for containerd's sandbox controller service +type sandboxRemoteController struct { + client api.ControllerClient +} + +var _ sb.Controller = (*sandboxRemoteController)(nil) + +// NewSandboxRemoteController creates client for sandbox controller +func NewSandboxRemoteController(client api.ControllerClient) sb.Controller { + return &sandboxRemoteController{client: client} +} + +func (s *sandboxRemoteController) Start(ctx context.Context, sandboxID string) (uint32, error) { + resp, err := s.client.Start(ctx, &api.ControllerStartRequest{SandboxID: sandboxID}) + if err != nil { + return 0, errdefs.FromGRPC(err) + } + + return resp.Pid, nil +} + +func (s *sandboxRemoteController) Shutdown(ctx context.Context, sandboxID string) error { + _, err := s.client.Shutdown(ctx, &api.ControllerShutdownRequest{SandboxID: sandboxID}) + if err != nil { + return errdefs.FromGRPC(err) + } + + return nil +} + +func (s *sandboxRemoteController) Wait(ctx context.Context, sandboxID string) (*api.ControllerWaitResponse, error) { + resp, err := s.client.Wait(ctx, &api.ControllerWaitRequest{SandboxID: sandboxID}) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + return resp, nil +} + +func (s *sandboxRemoteController) Status(ctx context.Context, sandboxID string) (*api.ControllerStatusResponse, error) { + resp, err := s.client.Status(ctx, &api.ControllerStatusRequest{SandboxID: sandboxID}) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + return resp, nil +} diff --git a/sandbox_store.go b/sandbox_store.go new file mode 100644 index 000000000..ee5c8cb20 --- /dev/null +++ b/sandbox_store.go @@ -0,0 +1,95 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package containerd + +import ( + "context" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/errdefs" + sb "github.com/containerd/containerd/sandbox" +) + +// remoteSandboxStore is a low-level containerd client to manage sandbox environments metadata +type remoteSandboxStore struct { + client api.StoreClient +} + +var _ sb.Store = (*remoteSandboxStore)(nil) + +// NewRemoteSandboxStore create client for sandbox store +func NewRemoteSandboxStore(client api.StoreClient) sb.Store { + return &remoteSandboxStore{client: client} +} + +func (s *remoteSandboxStore) Create(ctx context.Context, sandbox sb.Sandbox) (sb.Sandbox, error) { + resp, err := s.client.Create(ctx, &api.StoreCreateRequest{ + Sandbox: sb.ToProto(&sandbox), + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(&resp.Sandbox), nil +} + +func (s *remoteSandboxStore) Update(ctx context.Context, sandbox sb.Sandbox, fieldpaths ...string) (sb.Sandbox, error) { + resp, err := s.client.Update(ctx, &api.StoreUpdateRequest{ + Sandbox: sb.ToProto(&sandbox), + Fields: fieldpaths, + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(&resp.Sandbox), nil +} + +func (s *remoteSandboxStore) Get(ctx context.Context, id string) (sb.Sandbox, error) { + resp, err := s.client.Get(ctx, &api.StoreGetRequest{ + SandboxID: id, + }) + if err != nil { + return sb.Sandbox{}, errdefs.FromGRPC(err) + } + + return sb.FromProto(resp.Sandbox), nil +} + +func (s *remoteSandboxStore) List(ctx context.Context, filters ...string) ([]sb.Sandbox, error) { + resp, err := s.client.List(ctx, &api.StoreListRequest{ + Filters: filters, + }) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + + out := make([]sb.Sandbox, len(resp.List)) + for i := range resp.List { + out[i] = sb.FromProto(&resp.List[i]) + } + + return out, nil +} + +func (s *remoteSandboxStore) Delete(ctx context.Context, id string) error { + _, err := s.client.Delete(ctx, &api.StoreDeleteRequest{ + SandboxID: id, + }) + + return errdefs.FromGRPC(err) +} diff --git a/services.go b/services.go index e780e6ccf..3e1c66835 100644 --- a/services.go +++ b/services.go @@ -22,12 +22,14 @@ import ( imagesapi "github.com/containerd/containerd/api/services/images/v1" introspectionapi "github.com/containerd/containerd/api/services/introspection/v1" namespacesapi "github.com/containerd/containerd/api/services/namespaces/v1" + sandboxsapi "github.com/containerd/containerd/api/services/sandbox/v1" "github.com/containerd/containerd/api/services/tasks/v1" "github.com/containerd/containerd/containers" "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/leases" "github.com/containerd/containerd/namespaces" + "github.com/containerd/containerd/sandbox" "github.com/containerd/containerd/services/introspection" "github.com/containerd/containerd/snapshots" ) @@ -43,6 +45,8 @@ type services struct { eventService EventService leasesService leases.Manager introspectionService introspection.Service + sandboxStore sandbox.Store + sandboxController sandbox.Controller } // ServicesOpt allows callers to set options on the services @@ -155,3 +159,17 @@ func WithIntrospectionService(in introspection.Service) ServicesOpt { s.introspectionService = in } } + +// WithSandboxStore sets the sandbox store. +func WithSandboxStore(client sandboxsapi.StoreClient) ServicesOpt { + return func(s *services) { + s.sandboxStore = NewRemoteSandboxStore(client) + } +} + +// WithSandboxController sets the sandbox controller. +func WithSandboxController(client sandboxsapi.ControllerClient) ServicesOpt { + return func(s *services) { + s.sandboxController = NewSandboxRemoteController(client) + } +} diff --git a/services/containers/helpers.go b/services/containers/helpers.go index a75d5d62b..ceb2ca5dd 100644 --- a/services/containers/helpers.go +++ b/services/containers/helpers.go @@ -54,6 +54,7 @@ func containerToProto(container *containers.Container) api.Container { CreatedAt: container.CreatedAt, UpdatedAt: container.UpdatedAt, Extensions: extensions, + Sandbox: container.SandboxID, } } @@ -79,5 +80,6 @@ func containerFromProto(containerpb *api.Container) containers.Container { Snapshotter: containerpb.Snapshotter, SnapshotKey: containerpb.SnapshotKey, Extensions: extensions, + SandboxID: containerpb.Sandbox, } } diff --git a/services/sandbox/controller_local.go b/services/sandbox/controller_local.go new file mode 100644 index 000000000..a4b62088c --- /dev/null +++ b/services/sandbox/controller_local.go @@ -0,0 +1,196 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "fmt" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/events" + "github.com/containerd/containerd/events/exchange" + "github.com/containerd/containerd/metadata" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/runtime" + v2 "github.com/containerd/containerd/runtime/v2" + "github.com/containerd/containerd/runtime/v2/task" + proto "github.com/containerd/containerd/runtime/v2/task" + "github.com/containerd/containerd/sandbox" + "github.com/containerd/containerd/services" + "google.golang.org/grpc" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.ServicePlugin, + ID: services.SandboxControllerService, + Requires: []plugin.Type{ + plugin.RuntimePluginV2, + plugin.MetadataPlugin, + plugin.EventPlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + shimPlugin, err := ic.GetByID(plugin.RuntimePluginV2, "shim") + if err != nil { + return nil, err + } + + metadataPlugin, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } + + exchangePlugin, err := ic.GetByID(plugin.EventPlugin, "exchange") + if err != nil { + return nil, err + } + + var ( + shims = shimPlugin.(*v2.ShimManager) + publisher = exchangePlugin.(*exchange.Exchange) + db = metadataPlugin.(*metadata.DB) + store = metadata.NewSandboxStore(db) + ) + + return &controllerLocal{ + shims: shims, + store: store, + publisher: publisher, + }, nil + }, + }) +} + +type controllerLocal struct { + shims *v2.ShimManager + store sandbox.Store + publisher events.Publisher +} + +var _ api.ControllerClient = (*controllerLocal)(nil) + +func (c *controllerLocal) Start(ctx context.Context, in *api.ControllerStartRequest, opts ...grpc.CallOption) (*api.ControllerStartResponse, error) { + if _, err := c.shims.Get(ctx, in.SandboxID); err == nil { + return nil, fmt.Errorf("sandbox %s already running: %w", in.SandboxID, errdefs.ErrAlreadyExists) + } + + info, err := c.store.Get(ctx, in.SandboxID) + if err != nil { + return nil, fmt.Errorf("failed to query sandbox metadata from store: %w", err) + } + + shim, err := c.shims.Start(ctx, in.SandboxID, runtime.CreateOpts{ + Spec: info.Spec, + RuntimeOptions: info.Runtime.Options, + Runtime: info.Runtime.Name, + TaskOptions: nil, + }) + + if err != nil { + return nil, fmt.Errorf("failed to start new sandbox: %w", err) + } + + svc := task.NewSandboxClient(shim.Client()) + + resp, err := svc.StartSandbox(ctx, &proto.StartSandboxRequest{ + SandboxID: in.SandboxID, + BundlePath: shim.Bundle(), + Rootfs: in.Rootfs, + Options: in.Options, + }) + + if err != nil { + return nil, fmt.Errorf("failed to start sandbox %s: %w", in.SandboxID, err) + } + + return &api.ControllerStartResponse{ + SandboxID: in.SandboxID, + Pid: resp.Pid, + }, nil +} + +func (c *controllerLocal) Shutdown(ctx context.Context, in *api.ControllerShutdownRequest, opts ...grpc.CallOption) (*api.ControllerShutdownResponse, error) { + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + if _, err := svc.StopSandbox(ctx, &proto.StopSandboxRequest{ + SandboxID: in.SandboxID, + TimeoutSecs: in.TimeoutSecs, + }); err != nil { + return nil, fmt.Errorf("failed to stop sandbox: %w", err) + } + + if err := c.shims.Delete(ctx, in.SandboxID); err != nil { + return nil, fmt.Errorf("failed to delete sandbox shim: %w", err) + } + + return &api.ControllerShutdownResponse{}, nil +} + +func (c *controllerLocal) Wait(ctx context.Context, in *api.ControllerWaitRequest, opts ...grpc.CallOption) (*api.ControllerWaitResponse, error) { + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + resp, err := svc.WaitSandbox(ctx, &proto.WaitSandboxRequest{ + SandboxID: in.SandboxID, + }) + + if err != nil { + return nil, fmt.Errorf("failed to wait sandbox %s: %w", in.SandboxID, err) + } + + return &api.ControllerWaitResponse{ + ExitStatus: resp.ExitStatus, + ExitedAt: resp.ExitedAt, + }, nil +} + +func (c *controllerLocal) Status(ctx context.Context, in *api.ControllerStatusRequest, opts ...grpc.CallOption) (*api.ControllerStatusResponse, error) { + svc, err := c.getSandbox(ctx, in.SandboxID) + if err != nil { + return nil, err + } + + resp, err := svc.SandboxStatus(ctx, &proto.SandboxStatusRequest{SandboxID: in.SandboxID}) + if err != nil { + return nil, fmt.Errorf("failed to query sandbox %s status: %w", in.SandboxID, err) + } + + return &api.ControllerStatusResponse{ + ID: resp.ID, + Pid: resp.Pid, + State: resp.State, + ExitStatus: resp.ExitStatus, + ExitedAt: resp.ExitedAt, + Extra: resp.Extra, + }, nil +} + +func (c *controllerLocal) getSandbox(ctx context.Context, id string) (task.SandboxService, error) { + shim, err := c.shims.Get(ctx, id) + if err != nil { + return nil, errdefs.ErrNotFound + } + + svc := task.NewSandboxClient(shim.Client()) + return svc, nil +} diff --git a/services/sandbox/controller_service.go b/services/sandbox/controller_service.go new file mode 100644 index 000000000..12dc5b08a --- /dev/null +++ b/services/sandbox/controller_service.go @@ -0,0 +1,89 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "errors" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/services" + "google.golang.org/grpc" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "sandbox-controllers", + Requires: []plugin.Type{ + plugin.ServicePlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + plugins, err := ic.GetByType(plugin.ServicePlugin) + if err != nil { + return nil, err + } + + p, ok := plugins[services.SandboxControllerService] + if !ok { + return nil, errors.New("sandbox service not found") + } + + i, err := p.Instance() + if err != nil { + return nil, err + } + + return &controllerService{ + local: i.(api.ControllerClient), + }, nil + }, + }) +} + +type controllerService struct { + local api.ControllerClient +} + +var _ api.ControllerServer = (*controllerService)(nil) + +func (s *controllerService) Register(server *grpc.Server) error { + api.RegisterControllerServer(server, s) + return nil +} + +func (s *controllerService) Start(ctx context.Context, req *api.ControllerStartRequest) (*api.ControllerStartResponse, error) { + log.G(ctx).WithField("req", req).Debug("start sandbox") + return s.local.Start(ctx, req) +} + +func (s *controllerService) Shutdown(ctx context.Context, req *api.ControllerShutdownRequest) (*api.ControllerShutdownResponse, error) { + log.G(ctx).WithField("req", req).Debug("delete sandbox") + return s.local.Shutdown(ctx, req) +} + +func (s *controllerService) Wait(ctx context.Context, req *api.ControllerWaitRequest) (*api.ControllerWaitResponse, error) { + log.G(ctx).WithField("req", req).Debug("wait sandbox") + return s.local.Wait(ctx, req) +} + +func (s *controllerService) Status(ctx context.Context, req *api.ControllerStatusRequest) (*api.ControllerStatusResponse, error) { + log.G(ctx).WithField("req", req).Debug("sandbox status") + return s.local.Status(ctx, req) +} diff --git a/services/sandbox/store_local.go b/services/sandbox/store_local.go new file mode 100644 index 000000000..eb4ecb4bb --- /dev/null +++ b/services/sandbox/store_local.go @@ -0,0 +1,111 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + + "github.com/containerd/containerd/services" + "google.golang.org/grpc" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/api/types" + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/events" + "github.com/containerd/containerd/metadata" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/sandbox" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.ServicePlugin, + ID: services.SandboxStoreService, + Requires: []plugin.Type{ + plugin.MetadataPlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + m, err := ic.Get(plugin.MetadataPlugin) + if err != nil { + return nil, err + } + + db := m.(*metadata.DB) + return &sandboxLocal{ + store: metadata.NewSandboxStore(db), + publisher: ic.Events, + }, nil + }, + }) +} + +type sandboxLocal struct { + store sandbox.Store + publisher events.Publisher +} + +var _ = (api.StoreClient)(&sandboxLocal{}) + +func (s *sandboxLocal) Create(ctx context.Context, in *api.StoreCreateRequest, _ ...grpc.CallOption) (*api.StoreCreateResponse, error) { + sb, err := s.store.Create(ctx, sandbox.FromProto(&in.Sandbox)) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreCreateResponse{Sandbox: sandbox.ToProto(&sb)}, nil +} + +func (s *sandboxLocal) Update(ctx context.Context, in *api.StoreUpdateRequest, _ ...grpc.CallOption) (*api.StoreUpdateResponse, error) { + sb, err := s.store.Update(ctx, sandbox.FromProto(&in.Sandbox), in.Fields...) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreUpdateResponse{Sandbox: sandbox.ToProto(&sb)}, nil +} + +func (s *sandboxLocal) Get(ctx context.Context, in *api.StoreGetRequest, _ ...grpc.CallOption) (*api.StoreGetResponse, error) { + resp, err := s.store.Get(ctx, in.SandboxID) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + desc := sandbox.ToProto(&resp) + return &api.StoreGetResponse{Sandbox: &desc}, nil +} + +func (s *sandboxLocal) List(ctx context.Context, in *api.StoreListRequest, _ ...grpc.CallOption) (*api.StoreListResponse, error) { + resp, err := s.store.List(ctx, in.Filters...) + if err != nil { + return nil, errdefs.ToGRPC(err) + } + + list := make([]types.Sandbox, len(resp)) + for i := range resp { + list[i] = sandbox.ToProto(&resp[i]) + } + + return &api.StoreListResponse{List: list}, nil +} + +func (s *sandboxLocal) Delete(ctx context.Context, in *api.StoreDeleteRequest, _ ...grpc.CallOption) (*api.StoreDeleteResponse, error) { + if err := s.store.Delete(ctx, in.SandboxID); err != nil { + return nil, errdefs.ToGRPC(err) + } + + return &api.StoreDeleteResponse{}, nil +} diff --git a/services/sandbox/store_service.go b/services/sandbox/store_service.go new file mode 100644 index 000000000..45bb65519 --- /dev/null +++ b/services/sandbox/store_service.go @@ -0,0 +1,90 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package sandbox + +import ( + "context" + "errors" + + "google.golang.org/grpc" + + api "github.com/containerd/containerd/api/services/sandbox/v1" + "github.com/containerd/containerd/log" + "github.com/containerd/containerd/plugin" + "github.com/containerd/containerd/services" +) + +func init() { + plugin.Register(&plugin.Registration{ + Type: plugin.GRPCPlugin, + ID: "sandboxes", + Requires: []plugin.Type{ + plugin.ServicePlugin, + }, + InitFn: func(ic *plugin.InitContext) (interface{}, error) { + plugins, err := ic.GetByType(plugin.ServicePlugin) + if err != nil { + return nil, err + } + p, ok := plugins[services.SandboxStoreService] + if !ok { + return nil, errors.New("sandbox store service not found") + } + i, err := p.Instance() + if err != nil { + return nil, err + } + return &sandboxService{local: i.(api.StoreClient)}, nil + }, + }) +} + +type sandboxService struct { + local api.StoreClient +} + +var _ api.StoreServer = (*sandboxService)(nil) + +func (s *sandboxService) Register(server *grpc.Server) error { + api.RegisterStoreServer(server, s) + return nil +} + +func (s *sandboxService) Create(ctx context.Context, req *api.StoreCreateRequest) (*api.StoreCreateResponse, error) { + log.G(ctx).WithField("req", req).Debug("create sandbox") + return s.local.Create(ctx, req) +} + +func (s *sandboxService) Update(ctx context.Context, req *api.StoreUpdateRequest) (*api.StoreUpdateResponse, error) { + log.G(ctx).WithField("req", req).Debug("update sandbox") + return s.local.Update(ctx, req) +} + +func (s *sandboxService) List(ctx context.Context, req *api.StoreListRequest) (*api.StoreListResponse, error) { + log.G(ctx).WithField("req", req).Debug("list sandboxes") + return s.local.List(ctx, req) +} + +func (s *sandboxService) Get(ctx context.Context, req *api.StoreGetRequest) (*api.StoreGetResponse, error) { + log.G(ctx).WithField("req", req).Debug("get sandbox") + return s.local.Get(ctx, req) +} + +func (s *sandboxService) Delete(ctx context.Context, req *api.StoreDeleteRequest) (*api.StoreDeleteResponse, error) { + log.G(ctx).WithField("req", req).Debug("delete sandbox") + return s.local.Delete(ctx, req) +} diff --git a/services/services.go b/services/services.go index 6f3c1fd1e..5b47d9f68 100644 --- a/services/services.go +++ b/services/services.go @@ -33,4 +33,8 @@ const ( DiffService = "diff-service" // IntrospectionService is the id of introspection service IntrospectionService = "introspection-service" + // SandboxStoreService is the id of Sandbox's store service + SandboxStoreService = "sandbox-store-service" + // SandboxControllerService is the id of Sandbox's controller service + SandboxControllerService = "sandbox-controller-service" ) diff --git a/services/tasks/local.go b/services/tasks/local.go index aa97f2b51..ec7d8055c 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -200,6 +200,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc. Runtime: container.Runtime.Name, RuntimeOptions: container.Runtime.Options, TaskOptions: r.Options, + SandboxID: container.SandboxID, } if r.RuntimePath != "" { opts.Runtime = r.RuntimePath