api: introduce api/{types,services} for deduplication of API definition

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2017-02-09 07:31:26 +00:00
parent 6527a57d7b
commit bf8abef70f
37 changed files with 2179 additions and 1753 deletions

View File

@ -47,6 +47,7 @@ setup: ## install dependencies
generate: bin/protoc-gen-gogoctrd ## generate protobuf
@echo "🐳 $@"
@tools/gen-gen-go.sh
@PATH=${ROOTDIR}/bin:${PATH} go generate -x ${PACKAGES}
checkprotos: generate ## check if protobufs needs to be generated again

View File

@ -1,3 +0,0 @@
package execution
//go:generate protoc -I.:../../vendor:../../vendor/github.com/gogo/protobuf:../../../../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/execution,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. execution.proto

View File

@ -1,9 +1,11 @@
syntax = "proto3";
package containerd.v1;
package containerd.v1.services;
import "google/protobuf/empty.proto";
import "gogoproto/gogo.proto";
import "github.com/docker/containerd/api/types/container/container.proto";
import "github.com/docker/containerd/api/types/process/process.proto";
service ExecutionService {
rpc CreateContainer(CreateContainerRequest) returns (CreateContainerResponse);
@ -37,8 +39,8 @@ message CreateContainerRequest {
}
message CreateContainerResponse {
Container container = 1;
Process initProcess = 2;
types.Container container = 1;
types.Process initProcess = 2;
}
message DeleteContainerRequest {
@ -50,12 +52,12 @@ message ListContainersRequest {
}
message ListContainersResponse {
repeated Container containers = 1;
repeated types.Container containers = 1;
}
message StartProcessRequest {
string container_id = 1 [(gogoproto.customname) = "ContainerID"];
Process process = 2;
types.Process process = 2;
bool console = 3;
string stdin = 4;
string stdout = 5;
@ -63,36 +65,7 @@ message StartProcessRequest {
}
message StartProcessResponse {
Process process = 1;
}
message Container {
string id = 1 [(gogoproto.customname) = "ID"];
string bundle = 2;
Status status = 4;
}
message Process {
uint32 pid = 1;
repeated string args = 2;
repeated string env = 3;
User user = 4;
string cwd = 5;
bool terminal = 6;
uint32 exit_status = 7;
}
enum Status {
CREATED = 0;
RUNNING = 1;
STOPPED = 2;
PAUSED = 3;
}
message User {
uint32 uid = 1;
uint32 gid = 2;
repeated uint32 additionalGids = 3;
types.Process process = 1;
}
message GetContainerRequest {
@ -100,7 +73,7 @@ message GetContainerRequest {
}
message GetContainerResponse {
Container container = 1;
types.Container container = 1;
}
message UpdateContainerRequest {
@ -122,7 +95,7 @@ message GetProcessRequest {
}
message GetProcessResponse {
Process process = 1;
types.Process process = 1;
}
message SignalProcessRequest {
@ -141,5 +114,5 @@ message ListProcessesRequest {
}
message ListProcessesResponse {
repeated Process processes = 1;
repeated types.Process processes = 1;
}

View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package execution
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/services/execution,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. execution.proto

6
api/services/shim/gen.go Normal file
View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package shim
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/services/shim,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. shim.proto

View File

@ -15,7 +15,6 @@
DeleteRequest
DeleteResponse
ExecRequest
User
Rlimit
ExecResponse
PtyRequest
@ -23,7 +22,6 @@
Event
StateRequest
StateResponse
Process
PauseRequest
ResumeRequest
*/
@ -34,6 +32,8 @@ import fmt "fmt"
import math "math"
import google_protobuf "github.com/golang/protobuf/ptypes/empty"
import _ "github.com/gogo/protobuf/gogoproto"
import containerd_v1_types2 "github.com/docker/containerd/api/types/process"
import containerd_v1_types "github.com/docker/containerd/api/types/user"
import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
@ -89,34 +89,6 @@ func (x EventType) String() string {
}
func (EventType) EnumDescriptor() ([]byte, []int) { return fileDescriptorShim, []int{0} }
// TODO: share core runtime types between shim and execution rpcs
type State int32
const (
State_STOPPED State = 0
State_RUNNING State = 1
State_PAUSED State = 2
State_CREATED State = 3
)
var State_name = map[int32]string{
0: "STOPPED",
1: "RUNNING",
2: "PAUSED",
3: "CREATED",
}
var State_value = map[string]int32{
"STOPPED": 0,
"RUNNING": 1,
"PAUSED": 2,
"CREATED": 3,
}
func (x State) String() string {
return proto.EnumName(State_name, int32(x))
}
func (State) EnumDescriptor() ([]byte, []int) { return fileDescriptorShim, []int{1} }
type CreateRequest struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
@ -164,35 +136,25 @@ func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{4} }
type ExecRequest struct {
Terminal bool `protobuf:"varint,1,opt,name=terminal,proto3" json:"terminal,omitempty"`
Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"`
Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"`
Stderr string `protobuf:"bytes,4,opt,name=stderr,proto3" json:"stderr,omitempty"`
SelinuxLabel string `protobuf:"bytes,5,opt,name=selinux_label,json=selinuxLabel,proto3" json:"selinux_label,omitempty"`
User *User `protobuf:"bytes,6,opt,name=user" json:"user,omitempty"`
Args []string `protobuf:"bytes,7,rep,name=args" json:"args,omitempty"`
Env []string `protobuf:"bytes,8,rep,name=env" json:"env,omitempty"`
Cwd string `protobuf:"bytes,9,opt,name=cwd,proto3" json:"cwd,omitempty"`
Capabilities []string `protobuf:"bytes,10,rep,name=capabilities" json:"capabilities,omitempty"`
Rlimits []*Rlimit `protobuf:"bytes,11,rep,name=rlimits" json:"rlimits,omitempty"`
NoNewPrivileges bool `protobuf:"varint,12,opt,name=no_new_privileges,json=noNewPrivileges,proto3" json:"no_new_privileges,omitempty"`
ApparmorProfile string `protobuf:"bytes,13,opt,name=apparmor_profile,json=apparmorProfile,proto3" json:"apparmor_profile,omitempty"`
Terminal bool `protobuf:"varint,1,opt,name=terminal,proto3" json:"terminal,omitempty"`
Stdin string `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"`
Stdout string `protobuf:"bytes,3,opt,name=stdout,proto3" json:"stdout,omitempty"`
Stderr string `protobuf:"bytes,4,opt,name=stderr,proto3" json:"stderr,omitempty"`
SelinuxLabel string `protobuf:"bytes,5,opt,name=selinux_label,json=selinuxLabel,proto3" json:"selinux_label,omitempty"`
User *containerd_v1_types.User `protobuf:"bytes,6,opt,name=user" json:"user,omitempty"`
Args []string `protobuf:"bytes,7,rep,name=args" json:"args,omitempty"`
Env []string `protobuf:"bytes,8,rep,name=env" json:"env,omitempty"`
Cwd string `protobuf:"bytes,9,opt,name=cwd,proto3" json:"cwd,omitempty"`
Capabilities []string `protobuf:"bytes,10,rep,name=capabilities" json:"capabilities,omitempty"`
Rlimits []*Rlimit `protobuf:"bytes,11,rep,name=rlimits" json:"rlimits,omitempty"`
NoNewPrivileges bool `protobuf:"varint,12,opt,name=no_new_privileges,json=noNewPrivileges,proto3" json:"no_new_privileges,omitempty"`
ApparmorProfile string `protobuf:"bytes,13,opt,name=apparmor_profile,json=apparmorProfile,proto3" json:"apparmor_profile,omitempty"`
}
func (m *ExecRequest) Reset() { *m = ExecRequest{} }
func (*ExecRequest) ProtoMessage() {}
func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{5} }
type User struct {
Uid uint32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
Gid uint32 `protobuf:"varint,2,opt,name=gid,proto3" json:"gid,omitempty"`
AdditionalGids []uint32 `protobuf:"varint,3,rep,packed,name=additional_gids,json=additionalGids" json:"additional_gids,omitempty"`
}
func (m *User) Reset() { *m = User{} }
func (*User) ProtoMessage() {}
func (*User) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{6} }
type Rlimit struct {
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Hard uint64 `protobuf:"varint,2,opt,name=hard,proto3" json:"hard,omitempty"`
@ -201,7 +163,7 @@ type Rlimit struct {
func (m *Rlimit) Reset() { *m = Rlimit{} }
func (*Rlimit) ProtoMessage() {}
func (*Rlimit) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} }
func (*Rlimit) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{6} }
type ExecResponse struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
@ -209,7 +171,7 @@ type ExecResponse struct {
func (m *ExecResponse) Reset() { *m = ExecResponse{} }
func (*ExecResponse) ProtoMessage() {}
func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} }
func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{7} }
type PtyRequest struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
@ -219,87 +181,76 @@ type PtyRequest struct {
func (m *PtyRequest) Reset() { *m = PtyRequest{} }
func (*PtyRequest) ProtoMessage() {}
func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} }
func (*PtyRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{8} }
type EventsRequest struct {
}
func (m *EventsRequest) Reset() { *m = EventsRequest{} }
func (*EventsRequest) ProtoMessage() {}
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} }
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{9} }
// should be moved to api/types/event maybe
type Event struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.shim.v1.EventType" json:"type,omitempty"`
Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=containerd.v1.services.EventType" json:"type,omitempty"`
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
ExitStatus uint32 `protobuf:"varint,4,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
}
func (m *Event) Reset() { *m = Event{} }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} }
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{10} }
type StateRequest struct {
}
func (m *StateRequest) Reset() { *m = StateRequest{} }
func (*StateRequest) ProtoMessage() {}
func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} }
func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{11} }
type StateResponse struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
InitPid uint32 `protobuf:"varint,3,opt,name=initPid,proto3" json:"initPid,omitempty"`
Processes []*Process `protobuf:"bytes,4,rep,name=processes" json:"processes,omitempty"`
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
InitPid uint32 `protobuf:"varint,3,opt,name=initPid,proto3" json:"initPid,omitempty"`
Processes []*containerd_v1_types2.Process `protobuf:"bytes,4,rep,name=processes" json:"processes,omitempty"`
}
func (m *StateResponse) Reset() { *m = StateResponse{} }
func (*StateResponse) ProtoMessage() {}
func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} }
type Process struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
State State `protobuf:"varint,2,opt,name=state,proto3,enum=containerd.shim.v1.State" json:"state,omitempty"`
}
func (m *Process) Reset() { *m = Process{} }
func (*Process) ProtoMessage() {}
func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} }
func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{12} }
type PauseRequest struct {
}
func (m *PauseRequest) Reset() { *m = PauseRequest{} }
func (*PauseRequest) ProtoMessage() {}
func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{15} }
func (*PauseRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{13} }
type ResumeRequest struct {
}
func (m *ResumeRequest) Reset() { *m = ResumeRequest{} }
func (*ResumeRequest) ProtoMessage() {}
func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{16} }
func (*ResumeRequest) Descriptor() ([]byte, []int) { return fileDescriptorShim, []int{14} }
func init() {
proto.RegisterType((*CreateRequest)(nil), "containerd.shim.v1.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "containerd.shim.v1.CreateResponse")
proto.RegisterType((*StartRequest)(nil), "containerd.shim.v1.StartRequest")
proto.RegisterType((*DeleteRequest)(nil), "containerd.shim.v1.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "containerd.shim.v1.DeleteResponse")
proto.RegisterType((*ExecRequest)(nil), "containerd.shim.v1.ExecRequest")
proto.RegisterType((*User)(nil), "containerd.shim.v1.User")
proto.RegisterType((*Rlimit)(nil), "containerd.shim.v1.Rlimit")
proto.RegisterType((*ExecResponse)(nil), "containerd.shim.v1.ExecResponse")
proto.RegisterType((*PtyRequest)(nil), "containerd.shim.v1.PtyRequest")
proto.RegisterType((*EventsRequest)(nil), "containerd.shim.v1.EventsRequest")
proto.RegisterType((*Event)(nil), "containerd.shim.v1.Event")
proto.RegisterType((*StateRequest)(nil), "containerd.shim.v1.StateRequest")
proto.RegisterType((*StateResponse)(nil), "containerd.shim.v1.StateResponse")
proto.RegisterType((*Process)(nil), "containerd.shim.v1.Process")
proto.RegisterType((*PauseRequest)(nil), "containerd.shim.v1.PauseRequest")
proto.RegisterType((*ResumeRequest)(nil), "containerd.shim.v1.ResumeRequest")
proto.RegisterEnum("containerd.shim.v1.EventType", EventType_name, EventType_value)
proto.RegisterEnum("containerd.shim.v1.State", State_name, State_value)
proto.RegisterType((*CreateRequest)(nil), "containerd.v1.services.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "containerd.v1.services.CreateResponse")
proto.RegisterType((*StartRequest)(nil), "containerd.v1.services.StartRequest")
proto.RegisterType((*DeleteRequest)(nil), "containerd.v1.services.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "containerd.v1.services.DeleteResponse")
proto.RegisterType((*ExecRequest)(nil), "containerd.v1.services.ExecRequest")
proto.RegisterType((*Rlimit)(nil), "containerd.v1.services.Rlimit")
proto.RegisterType((*ExecResponse)(nil), "containerd.v1.services.ExecResponse")
proto.RegisterType((*PtyRequest)(nil), "containerd.v1.services.PtyRequest")
proto.RegisterType((*EventsRequest)(nil), "containerd.v1.services.EventsRequest")
proto.RegisterType((*Event)(nil), "containerd.v1.services.Event")
proto.RegisterType((*StateRequest)(nil), "containerd.v1.services.StateRequest")
proto.RegisterType((*StateResponse)(nil), "containerd.v1.services.StateResponse")
proto.RegisterType((*PauseRequest)(nil), "containerd.v1.services.PauseRequest")
proto.RegisterType((*ResumeRequest)(nil), "containerd.v1.services.ResumeRequest")
proto.RegisterEnum("containerd.v1.services.EventType", EventType_name, EventType_value)
}
func (this *CreateRequest) GoString() string {
if this == nil {
@ -383,18 +334,6 @@ func (this *ExecRequest) GoString() string {
s = append(s, "}")
return strings.Join(s, "")
}
func (this *User) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&shim.User{")
s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n")
s = append(s, "Gid: "+fmt.Sprintf("%#v", this.Gid)+",\n")
s = append(s, "AdditionalGids: "+fmt.Sprintf("%#v", this.AdditionalGids)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func (this *Rlimit) GoString() string {
if this == nil {
return "nil"
@ -475,17 +414,6 @@ func (this *StateResponse) GoString() string {
s = append(s, "}")
return strings.Join(s, "")
}
func (this *Process) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 6)
s = append(s, "&shim.Process{")
s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n")
s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func (this *PauseRequest) GoString() string {
if this == nil {
return "nil"
@ -563,7 +491,7 @@ func NewShimClient(cc *grpc.ClientConn) ShimClient {
func (c *shimClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
out := new(CreateResponse)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Create", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Create", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -572,7 +500,7 @@ func (c *shimClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc
func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Start", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Start", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -581,7 +509,7 @@ func (c *shimClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.C
func (c *shimClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
out := new(DeleteResponse)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Delete", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Delete", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -590,7 +518,7 @@ func (c *shimClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc
func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) {
out := new(ExecResponse)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Exec", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Exec", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -599,7 +527,7 @@ func (c *shimClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.Cal
func (c *shimClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Pty", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Pty", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -607,7 +535,7 @@ func (c *shimClient) Pty(ctx context.Context, in *PtyRequest, opts ...grpc.CallO
}
func (c *shimClient) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (Shim_EventsClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.shim.v1.Shim/Events", opts...)
stream, err := grpc.NewClientStream(ctx, &_Shim_serviceDesc.Streams[0], c.cc, "/containerd.v1.services.Shim/Events", opts...)
if err != nil {
return nil, err
}
@ -640,7 +568,7 @@ func (x *shimEventsClient) Recv() (*Event, error) {
func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.CallOption) (*StateResponse, error) {
out := new(StateResponse)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/State", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/State", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -649,7 +577,7 @@ func (c *shimClient) State(ctx context.Context, in *StateRequest, opts ...grpc.C
func (c *shimClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Pause", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Pause", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -658,7 +586,7 @@ func (c *shimClient) Pause(ctx context.Context, in *PauseRequest, opts ...grpc.C
func (c *shimClient) Resume(ctx context.Context, in *ResumeRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {
out := new(google_protobuf.Empty)
err := grpc.Invoke(ctx, "/containerd.shim.v1.Shim/Resume", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/containerd.v1.services.Shim/Resume", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -693,7 +621,7 @@ func _Shim_Create_Handler(srv interface{}, ctx context.Context, dec func(interfa
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Create",
FullMethod: "/containerd.v1.services.Shim/Create",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Create(ctx, req.(*CreateRequest))
@ -711,7 +639,7 @@ func _Shim_Start_Handler(srv interface{}, ctx context.Context, dec func(interfac
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Start",
FullMethod: "/containerd.v1.services.Shim/Start",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Start(ctx, req.(*StartRequest))
@ -729,7 +657,7 @@ func _Shim_Delete_Handler(srv interface{}, ctx context.Context, dec func(interfa
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Delete",
FullMethod: "/containerd.v1.services.Shim/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Delete(ctx, req.(*DeleteRequest))
@ -747,7 +675,7 @@ func _Shim_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Exec",
FullMethod: "/containerd.v1.services.Shim/Exec",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Exec(ctx, req.(*ExecRequest))
@ -765,7 +693,7 @@ func _Shim_Pty_Handler(srv interface{}, ctx context.Context, dec func(interface{
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Pty",
FullMethod: "/containerd.v1.services.Shim/Pty",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Pty(ctx, req.(*PtyRequest))
@ -804,7 +732,7 @@ func _Shim_State_Handler(srv interface{}, ctx context.Context, dec func(interfac
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/State",
FullMethod: "/containerd.v1.services.Shim/State",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).State(ctx, req.(*StateRequest))
@ -822,7 +750,7 @@ func _Shim_Pause_Handler(srv interface{}, ctx context.Context, dec func(interfac
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Pause",
FullMethod: "/containerd.v1.services.Shim/Pause",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Pause(ctx, req.(*PauseRequest))
@ -840,7 +768,7 @@ func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interfa
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/containerd.shim.v1.Shim/Resume",
FullMethod: "/containerd.v1.services.Shim/Resume",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShimServer).Resume(ctx, req.(*ResumeRequest))
@ -849,7 +777,7 @@ func _Shim_Resume_Handler(srv interface{}, ctx context.Context, dec func(interfa
}
var _Shim_serviceDesc = grpc.ServiceDesc{
ServiceName: "containerd.shim.v1.Shim",
ServiceName: "containerd.v1.services.Shim",
HandlerType: (*ShimServer)(nil),
Methods: []grpc.MethodDesc{
{
@ -1197,51 +1125,6 @@ func (m *ExecRequest) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *User) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *User) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Uid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintShim(dAtA, i, uint64(m.Uid))
}
if m.Gid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintShim(dAtA, i, uint64(m.Gid))
}
if len(m.AdditionalGids) > 0 {
dAtA3 := make([]byte, len(m.AdditionalGids)*10)
var j2 int
for _, num := range m.AdditionalGids {
for num >= 1<<7 {
dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j2++
}
dAtA3[j2] = uint8(num)
j2++
}
dAtA[i] = 0x1a
i++
i = encodeVarintShim(dAtA, i, uint64(j2))
i += copy(dAtA[i:], dAtA3[:j2])
}
return i, nil
}
func (m *Rlimit) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1454,34 +1337,6 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *Process) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Process) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Pid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintShim(dAtA, i, uint64(m.Pid))
}
if m.State != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintShim(dAtA, i, uint64(m.State))
}
return i, nil
}
func (m *PauseRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -1678,25 +1533,6 @@ func (m *ExecRequest) Size() (n int) {
return n
}
func (m *User) Size() (n int) {
var l int
_ = l
if m.Uid != 0 {
n += 1 + sovShim(uint64(m.Uid))
}
if m.Gid != 0 {
n += 1 + sovShim(uint64(m.Gid))
}
if len(m.AdditionalGids) > 0 {
l = 0
for _, e := range m.AdditionalGids {
l += sovShim(uint64(e))
}
n += 1 + sovShim(uint64(l)) + l
}
return n
}
func (m *Rlimit) Size() (n int) {
var l int
_ = l
@ -1791,18 +1627,6 @@ func (m *StateResponse) Size() (n int) {
return n
}
func (m *Process) Size() (n int) {
var l int
_ = l
if m.Pid != 0 {
n += 1 + sovShim(uint64(m.Pid))
}
if m.State != 0 {
n += 1 + sovShim(uint64(m.State))
}
return n
}
func (m *PauseRequest) Size() (n int) {
var l int
_ = l
@ -1894,7 +1718,7 @@ func (this *ExecRequest) String() string {
`Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`,
`Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`,
`SelinuxLabel:` + fmt.Sprintf("%v", this.SelinuxLabel) + `,`,
`User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "User", 1) + `,`,
`User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "containerd_v1_types.User", 1) + `,`,
`Args:` + fmt.Sprintf("%v", this.Args) + `,`,
`Env:` + fmt.Sprintf("%v", this.Env) + `,`,
`Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`,
@ -1906,18 +1730,6 @@ func (this *ExecRequest) String() string {
}, "")
return s
}
func (this *User) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&User{`,
`Uid:` + fmt.Sprintf("%v", this.Uid) + `,`,
`Gid:` + fmt.Sprintf("%v", this.Gid) + `,`,
`AdditionalGids:` + fmt.Sprintf("%v", this.AdditionalGids) + `,`,
`}`,
}, "")
return s
}
func (this *Rlimit) String() string {
if this == nil {
return "nil"
@ -1991,18 +1803,7 @@ func (this *StateResponse) String() string {
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
`InitPid:` + fmt.Sprintf("%v", this.InitPid) + `,`,
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "Process", 1) + `,`,
`}`,
}, "")
return s
}
func (this *Process) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Process{`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`State:` + fmt.Sprintf("%v", this.State) + `,`,
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types2.Process", 1) + `,`,
`}`,
}, "")
return s
@ -2746,7 +2547,7 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.User == nil {
m.User = &User{}
m.User = &containerd_v1_types.User{}
}
if err := m.User.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@ -2969,156 +2770,6 @@ func (m *ExecRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *User) 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 ErrIntOverflowShim
}
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: User: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType)
}
m.Uid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Uid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType)
}
m.Gid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Gid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthShim
}
postIndex := iNdEx + packedLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
for iNdEx < postIndex {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
}
} else if wireType == 0 {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
} else {
return fmt.Errorf("proto: wrong wireType = %d for field AdditionalGids", wireType)
}
default:
iNdEx = preIndex
skippy, err := skipShim(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthShim
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Rlimit) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -3780,7 +3431,7 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Processes = append(m.Processes, &Process{})
m.Processes = append(m.Processes, &containerd_v1_types2.Process{})
if err := m.Processes[len(m.Processes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@ -3806,94 +3457,6 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Process) 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 ErrIntOverflowShim
}
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: Process: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Process: 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 ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field State", wireType)
}
m.State = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowShim
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.State |= (State(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipShim(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthShim
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *PauseRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -4102,70 +3665,66 @@ var (
func init() { proto.RegisterFile("shim.proto", fileDescriptorShim) }
var fileDescriptorShim = []byte{
// 1027 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6e, 0xe3, 0xb6,
0x13, 0x8e, 0x2c, 0xf9, 0xdf, 0x38, 0x76, 0xfc, 0x23, 0x16, 0x81, 0xe2, 0xfd, 0xd5, 0x71, 0xd4,
0x43, 0xd3, 0xa0, 0x70, 0x9a, 0xb4, 0x97, 0x16, 0xe8, 0x21, 0x1b, 0x0b, 0xdb, 0x00, 0x69, 0x22,
0xd0, 0x0e, 0xb0, 0x37, 0x43, 0x89, 0x18, 0x9b, 0x80, 0x2c, 0xa9, 0x24, 0x95, 0x3f, 0xb7, 0x5e,
0xfa, 0x06, 0xed, 0x53, 0xf4, 0x45, 0xf6, 0xd8, 0x53, 0xd1, 0x53, 0xd1, 0xe4, 0x09, 0xfa, 0x08,
0x05, 0x49, 0xc9, 0x4e, 0x36, 0xd2, 0x1e, 0x7a, 0x9b, 0xf9, 0xf4, 0x69, 0x38, 0xdf, 0x70, 0x66,
0x08, 0xc0, 0xe7, 0x74, 0x31, 0x4c, 0x58, 0x2c, 0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
0x09, 0x00, 0x00,
// 975 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x8e, 0xdb, 0x44,
0x14, 0x5e, 0xc7, 0xce, 0xdf, 0x49, 0x9c, 0x0d, 0xa3, 0x6a, 0xe5, 0x86, 0x92, 0xa6, 0x6e, 0x8b,
0x96, 0x4a, 0x38, 0x74, 0x11, 0x08, 0x21, 0x6e, 0xb6, 0x1b, 0x0b, 0x55, 0x2a, 0x34, 0x78, 0x83,
0xe8, 0x5d, 0xe4, 0xc4, 0xb3, 0xc9, 0x08, 0xc7, 0x36, 0x33, 0xe3, 0xec, 0xe6, 0x8e, 0x5b, 0x1e,
0x80, 0xf7, 0xe0, 0x31, 0x7a, 0x83, 0xc4, 0x15, 0xe2, 0x0a, 0xb1, 0x79, 0x02, 0x1e, 0x01, 0xcd,
0x8c, 0x9d, 0x6c, 0xda, 0xf5, 0x2e, 0xea, 0x4d, 0x72, 0xce, 0xe7, 0x6f, 0xce, 0x9c, 0xff, 0x01,
0x60, 0x73, 0xb2, 0x70, 0x12, 0x1a, 0xf3, 0x18, 0x1d, 0x4c, 0xe3, 0x88, 0xfb, 0x24, 0xc2, 0x34,
0x70, 0x96, 0x4f, 0x1d, 0x86, 0xe9, 0x92, 0x4c, 0x31, 0xeb, 0xbc, 0x3f, 0x8b, 0xe3, 0x59, 0x88,
0xfb, 0x92, 0x35, 0x49, 0xcf, 0xfa, 0x78, 0x91, 0xf0, 0x95, 0x3a, 0xd4, 0xb9, 0x33, 0x8b, 0x67,
0xb1, 0x14, 0xfb, 0x42, 0xca, 0xd0, 0xaf, 0x66, 0x84, 0xcf, 0xd3, 0x89, 0x33, 0x8d, 0x17, 0xfd,
0x20, 0x9e, 0xfe, 0x88, 0x69, 0x7f, 0x6b, 0xbc, 0xef, 0x27, 0xa4, 0xcf, 0x57, 0x09, 0x66, 0xc2,
0xe4, 0x14,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5c, 0x18, 0xee, 0xd7, 0x50, 0x51, 0xed, 0x5d, 0x1c, 0xee, 0x4e, 0xfb, 0x17, 0x19, 0x7a,
0x76, 0xef, 0xf5, 0x65, 0x77, 0xef, 0xaf, 0xcb, 0xee, 0xde, 0xbf, 0x97, 0x5d, 0xed, 0xe7, 0x75,
0x57, 0x7b, 0xbd, 0xee, 0x6a, 0x7f, 0xac, 0xbb, 0xda, 0x3f, 0xeb, 0xae, 0x36, 0xa9, 0x48, 0xf6,
0xa7, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x6e, 0x6f, 0xa5, 0x3c, 0x09, 0x00, 0x00,
}

View File

@ -1,9 +1,11 @@
syntax = "proto3";
package containerd.shim.v1;
package containerd.v1.services;
import "google/protobuf/empty.proto";
import "gogoproto/gogo.proto";
import "github.com/docker/containerd/api/types/process/process.proto";
import "github.com/docker/containerd/api/types/user/user.proto";
service Shim {
rpc Create(CreateRequest) returns (CreateResponse);
@ -49,7 +51,7 @@ message ExecRequest {
string stdout = 3;
string stderr = 4;
string selinux_label = 5;
User user = 6;
types.User user = 6;
repeated string args = 7;
repeated string env = 8;
string cwd = 9;
@ -59,12 +61,6 @@ message ExecRequest {
string apparmor_profile = 13;
}
message User {
uint32 uid = 1;
uint32 gid = 2;
repeated uint32 additional_gids = 3;
}
message Rlimit {
string type = 1;
uint64 hard = 2;
@ -92,6 +88,7 @@ enum EventType {
EXEC_ADDED = 4;
}
// should be moved to api/types/event maybe
message Event {
string id = 1 [(gogoproto.customname) = "ID"];
EventType type = 2;
@ -106,20 +103,7 @@ message StateResponse {
string id = 1 [(gogoproto.customname) = "ID"];
string bundle = 2;
uint32 initPid = 3;
repeated Process processes = 4;
}
// TODO: share core runtime types between shim and execution rpcs
enum State {
STOPPED = 0;
RUNNING = 1;
PAUSED = 2;
CREATED = 3;
}
message Process {
uint32 pid = 1;
State state = 2;
repeated types.Process processes = 4;
}
message PauseRequest {

View File

@ -1,3 +0,0 @@
package shim
//go:generate protoc -I.:../../vendor:../../vendor/github.com/gogo/protobuf:../../../../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/shim,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. shim.proto

View File

@ -0,0 +1,454 @@
// Code generated by protoc-gen-gogo.
// source: container.proto
// DO NOT EDIT!
/*
Package container is a generated protocol buffer package.
It is generated from these files:
container.proto
It has these top-level messages:
Container
*/
package container
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import containerd_v1_types "github.com/docker/containerd/api/types/state"
import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type Container struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
State containerd_v1_types.State `protobuf:"varint,4,opt,name=state,proto3,enum=containerd.v1.types.State" json:"state,omitempty"`
}
func (m *Container) Reset() { *m = Container{} }
func (*Container) ProtoMessage() {}
func (*Container) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{0} }
func init() {
proto.RegisterType((*Container)(nil), "containerd.v1.types.Container")
}
func (this *Container) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&container.Container{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
s = append(s, "Bundle: "+fmt.Sprintf("%#v", this.Bundle)+",\n")
s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringContainer(v interface{}, typ string) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
func extensionToGoStringContainer(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Container) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Container) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.ID) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.ID)))
i += copy(dAtA[i:], m.ID)
}
if len(m.Bundle) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.Bundle)))
i += copy(dAtA[i:], m.Bundle)
}
if m.State != 0 {
dAtA[i] = 0x20
i++
i = encodeVarintContainer(dAtA, i, uint64(m.State))
}
return i, nil
}
func encodeFixed64Container(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Container(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintContainer(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *Container) Size() (n int) {
var l int
_ = l
l = len(m.ID)
if l > 0 {
n += 1 + l + sovContainer(uint64(l))
}
l = len(m.Bundle)
if l > 0 {
n += 1 + l + sovContainer(uint64(l))
}
if m.State != 0 {
n += 1 + sovContainer(uint64(m.State))
}
return n
}
func sovContainer(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozContainer(x uint64) (n int) {
return sovContainer(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *Container) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Container{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
`State:` + fmt.Sprintf("%v", this.State) + `,`,
`}`,
}, "")
return s
}
func valueToStringContainer(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *Container) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Container: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthContainer
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Bundle", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthContainer
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Bundle = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field State", wireType)
}
m.State = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.State |= (containerd_v1_types.State(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipContainer(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthContainer
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipContainer(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContainer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContainer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContainer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthContainer
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowContainer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipContainer(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthContainer = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowContainer = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("container.proto", fileDescriptorContainer) }
var fileDescriptorContainer = []byte{
// 216 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0xce, 0xcf, 0x2b,
0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x0b, 0xa4,
0xe8, 0x95, 0x19, 0xea, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83,
0xe5, 0xf5, 0x41, 0x2c, 0x88, 0x52, 0x29, 0x8b, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4,
0xfc, 0x5c, 0xfd, 0x94, 0xfc, 0xe4, 0xec, 0xd4, 0x22, 0x7d, 0x84, 0x66, 0xfd, 0xc4, 0x82, 0x4c,
0x7d, 0xb0, 0x6e, 0xfd, 0xe2, 0x92, 0xc4, 0x92, 0x54, 0x08, 0x09, 0xd1, 0xa9, 0x94, 0xcb, 0xc5,
0xe9, 0x0c, 0x53, 0x29, 0x24, 0xc6, 0xc5, 0x94, 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9,
0xc4, 0xf6, 0xe8, 0x9e, 0x3c, 0x93, 0xa7, 0x4b, 0x10, 0x53, 0x66, 0x8a, 0x90, 0x18, 0x17, 0x5b,
0x52, 0x69, 0x5e, 0x4a, 0x4e, 0xaa, 0x04, 0x13, 0x48, 0x2e, 0x08, 0xca, 0x13, 0x32, 0xe0, 0x62,
0x05, 0x9b, 0x25, 0xc1, 0xa2, 0xc0, 0xa8, 0xc1, 0x67, 0x24, 0xa5, 0x87, 0xc5, 0xc5, 0x7a, 0xc1,
0x20, 0x15, 0x41, 0x10, 0x85, 0x4e, 0x32, 0x27, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xf0,
0xe1, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63,
0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x89, 0x0d, 0xec, 0x26, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff,
0x85, 0x4e, 0xbe, 0x56, 0x0b, 0x01, 0x00, 0x00,
}

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package containerd.v1.types;
import "gogoproto/gogo.proto";
import "github.com/docker/containerd/api/types/state/state.proto";
message Container {
string id = 1 [(gogoproto.customname) = "ID"];
string bundle = 2;
State state = 4;
}

View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package container
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/container,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. container.proto

View File

@ -1,3 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package mount
//go:generate protoc -I.:../../../vendor:../../../vendor/github.com/gogo/protobuf:../../../../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/mount,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. mount.proto
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/mount,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. mount.proto

6
api/types/process/gen.go Normal file
View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package process
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/process,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. process.proto

View File

@ -0,0 +1,671 @@
// Code generated by protoc-gen-gogo.
// source: process.proto
// DO NOT EDIT!
/*
Package process is a generated protocol buffer package.
It is generated from these files:
process.proto
It has these top-level messages:
Process
*/
package process
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import containerd_v1_types "github.com/docker/containerd/api/types/user"
import containerd_v1_types1 "github.com/docker/containerd/api/types/state"
import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type Process struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"`
Args []string `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"`
Env []string `protobuf:"bytes,3,rep,name=env" json:"env,omitempty"`
User *containerd_v1_types.User `protobuf:"bytes,4,opt,name=user" json:"user,omitempty"`
Cwd string `protobuf:"bytes,5,opt,name=cwd,proto3" json:"cwd,omitempty"`
Terminal bool `protobuf:"varint,6,opt,name=terminal,proto3" json:"terminal,omitempty"`
State containerd_v1_types1.State `protobuf:"varint,7,opt,name=state,proto3,enum=containerd.v1.types.State" json:"state,omitempty"`
ExitStatus uint32 `protobuf:"varint,8,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
}
func (m *Process) Reset() { *m = Process{} }
func (*Process) ProtoMessage() {}
func (*Process) Descriptor() ([]byte, []int) { return fileDescriptorProcess, []int{0} }
func init() {
proto.RegisterType((*Process)(nil), "containerd.v1.types.Process")
}
func (this *Process) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 12)
s = append(s, "&process.Process{")
s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n")
s = append(s, "Args: "+fmt.Sprintf("%#v", this.Args)+",\n")
s = append(s, "Env: "+fmt.Sprintf("%#v", this.Env)+",\n")
if this.User != nil {
s = append(s, "User: "+fmt.Sprintf("%#v", this.User)+",\n")
}
s = append(s, "Cwd: "+fmt.Sprintf("%#v", this.Cwd)+",\n")
s = append(s, "Terminal: "+fmt.Sprintf("%#v", this.Terminal)+",\n")
s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n")
s = append(s, "ExitStatus: "+fmt.Sprintf("%#v", this.ExitStatus)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringProcess(v interface{}, typ string) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
func extensionToGoStringProcess(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *Process) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Process) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Pid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintProcess(dAtA, i, uint64(m.Pid))
}
if len(m.Args) > 0 {
for _, s := range m.Args {
dAtA[i] = 0x12
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
if len(m.Env) > 0 {
for _, s := range m.Env {
dAtA[i] = 0x1a
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
if m.User != nil {
dAtA[i] = 0x22
i++
i = encodeVarintProcess(dAtA, i, uint64(m.User.Size()))
n1, err := m.User.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
if len(m.Cwd) > 0 {
dAtA[i] = 0x2a
i++
i = encodeVarintProcess(dAtA, i, uint64(len(m.Cwd)))
i += copy(dAtA[i:], m.Cwd)
}
if m.Terminal {
dAtA[i] = 0x30
i++
if m.Terminal {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i++
}
if m.State != 0 {
dAtA[i] = 0x38
i++
i = encodeVarintProcess(dAtA, i, uint64(m.State))
}
if m.ExitStatus != 0 {
dAtA[i] = 0x40
i++
i = encodeVarintProcess(dAtA, i, uint64(m.ExitStatus))
}
return i, nil
}
func encodeFixed64Process(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Process(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintProcess(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *Process) Size() (n int) {
var l int
_ = l
if m.Pid != 0 {
n += 1 + sovProcess(uint64(m.Pid))
}
if len(m.Args) > 0 {
for _, s := range m.Args {
l = len(s)
n += 1 + l + sovProcess(uint64(l))
}
}
if len(m.Env) > 0 {
for _, s := range m.Env {
l = len(s)
n += 1 + l + sovProcess(uint64(l))
}
}
if m.User != nil {
l = m.User.Size()
n += 1 + l + sovProcess(uint64(l))
}
l = len(m.Cwd)
if l > 0 {
n += 1 + l + sovProcess(uint64(l))
}
if m.Terminal {
n += 2
}
if m.State != 0 {
n += 1 + sovProcess(uint64(m.State))
}
if m.ExitStatus != 0 {
n += 1 + sovProcess(uint64(m.ExitStatus))
}
return n
}
func sovProcess(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozProcess(x uint64) (n int) {
return sovProcess(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *Process) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Process{`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
`Args:` + fmt.Sprintf("%v", this.Args) + `,`,
`Env:` + fmt.Sprintf("%v", this.Env) + `,`,
`User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "containerd_v1_types.User", 1) + `,`,
`Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`,
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
`State:` + fmt.Sprintf("%v", this.State) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`}`,
}, "")
return s
}
func valueToStringProcess(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *Process) 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 ErrIntOverflowProcess
}
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: Process: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Process: 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 ErrIntOverflowProcess
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
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 ErrInvalidLengthProcess
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Args = append(m.Args, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
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 ErrInvalidLengthProcess
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Env = append(m.Env, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field User", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthProcess
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.User == nil {
m.User = &containerd_v1_types.User{}
}
if err := m.User.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Cwd", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
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 ErrInvalidLengthProcess
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Cwd = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Terminal", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.Terminal = bool(v != 0)
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field State", wireType)
}
m.State = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowProcess
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.State |= (containerd_v1_types1.State(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 8:
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 ErrIntOverflowProcess
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExitStatus |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipProcess(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthProcess
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipProcess(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowProcess
}
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, ErrIntOverflowProcess
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowProcess
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthProcess
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowProcess
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipProcess(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthProcess = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowProcess = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("process.proto", fileDescriptorProcess) }
var fileDescriptorProcess = []byte{
// 296 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x90, 0xbd, 0x4e, 0xc3, 0x30,
0x14, 0x85, 0x7b, 0xe9, 0x5f, 0x70, 0x55, 0x84, 0xcc, 0x62, 0x22, 0x64, 0x2c, 0xa6, 0x2c, 0x38,
0x50, 0x24, 0xc4, 0x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be, 0x40, 0xc3, 0xd0,
0x97, 0x8c, 0x19, 0x24, 0x07, 0xb3, 0x78, 0x67, 0xfa, 0xdc, 0x13, 0x59, 0x07, 0xe2, 0x53, 0x34,
0x91, 0x2f, 0xca, 0x3d, 0xf8, 0xa9, 0xb6, 0x24, 0x0a, 0xe7, 0x20, 0x6f, 0xcd, 0x83, 0x73, 0x7b,
0xb2, 0x6d, 0x68, 0xef, 0xa3, 0xa1, 0xbd, 0xaf, 0x86, 0xc2, 0x5b, 0x4b, 0x61, 0xdb, 0x52, 0x78,
0x6f, 0x29, 0x7c, 0xb6, 0x14, 0x16, 0xa3, 0xf0, 0x31, 0x57, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff,
0x04, 0x02, 0x48, 0xdc, 0xb0, 0x01, 0x00, 0x00,
}

View File

@ -0,0 +1,17 @@
syntax = "proto3";
package containerd.v1.types;
import "github.com/docker/containerd/api/types/user/user.proto";
import "github.com/docker/containerd/api/types/state/state.proto";
message Process {
uint32 pid = 1;
repeated string args = 2;
repeated string env = 3;
User user = 4;
string cwd = 5;
bool terminal = 6;
State state = 7; // only used by shim at the moment
uint32 exit_status = 8;
}

6
api/types/state/gen.go Normal file
View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package state
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/state,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. state.proto

View File

@ -0,0 +1,79 @@
// Code generated by protoc-gen-gogo.
// source: state.proto
// DO NOT EDIT!
/*
Package state is a generated protocol buffer package.
It is generated from these files:
state.proto
It has these top-level messages:
*/
package state
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
// At the moment we have same State type for Container and Process
type State int32
const (
State_UNKNOWN State = 0
State_CREATED State = 1
State_RUNNING State = 2
State_STOPPED State = 3
State_PAUSED State = 4
)
var State_name = map[int32]string{
0: "UNKNOWN",
1: "CREATED",
2: "RUNNING",
3: "STOPPED",
4: "PAUSED",
}
var State_value = map[string]int32{
"UNKNOWN": 0,
"CREATED": 1,
"RUNNING": 2,
"STOPPED": 3,
"PAUSED": 4,
}
func (x State) String() string {
return proto.EnumName(State_name, int32(x))
}
func (State) EnumDescriptor() ([]byte, []int) { return fileDescriptorState, []int{0} }
func init() {
proto.RegisterEnum("containerd.v1.types.State", State_name, State_value)
}
func init() { proto.RegisterFile("state.proto", fileDescriptorState) }
var fileDescriptorState = []byte{
// 159 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x2e, 0x49, 0x2c,
0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x4e, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc,
0x4b, 0x2d, 0x4a, 0xd1, 0x2b, 0x33, 0xd4, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x72, 0xe7, 0x62,
0x0d, 0x06, 0xa9, 0x11, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, 0x0f, 0xf7, 0x13, 0x60,
0x00, 0x71, 0x9c, 0x83, 0x5c, 0x1d, 0x43, 0x5c, 0x5d, 0x04, 0x18, 0x41, 0x9c, 0xa0, 0x50, 0x3f,
0x3f, 0x4f, 0x3f, 0x77, 0x01, 0x26, 0x10, 0x27, 0x38, 0xc4, 0x3f, 0x20, 0xc0, 0xd5, 0x45, 0x80,
0x59, 0x88, 0x8b, 0x8b, 0x2d, 0xc0, 0x31, 0x34, 0xd8, 0xd5, 0x45, 0x80, 0xc5, 0x49, 0xe6, 0xc4,
0x43, 0x39, 0x86, 0x1b, 0x0f, 0xe5, 0x18, 0x3e, 0x3c, 0x94, 0x63, 0x6c, 0x78, 0x24, 0xc7, 0x78,
0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x26, 0xb1, 0x81, 0x9d,
0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xfd, 0xe3, 0xd8, 0x91, 0x00, 0x00, 0x00,
}

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package containerd.v1.types;
// At the moment we have same State type for Container and Process
enum State {
UNKNOWN = 0;
CREATED = 1;
RUNNING = 2;
STOPPED = 3;
PAUSED = 4;
}

6
api/types/user/gen.go Normal file
View File

@ -0,0 +1,6 @@
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package user
//go:generate protoc -I.:/home/suda/gopath/src/github.com/docker/containerd/vendor:/home/suda/gopath/src/github.com/docker/containerd/vendor/github.com/gogo/protobuf:/home/suda/gopath/src/github.com/docker/containerd/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=github.com/docker/containerd/api/types/user,Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. user.proto

484
api/types/user/user.pb.go Normal file
View File

@ -0,0 +1,484 @@
// Code generated by protoc-gen-gogo.
// source: user.proto
// DO NOT EDIT!
/*
Package user is a generated protocol buffer package.
It is generated from these files:
user.proto
It has these top-level messages:
User
*/
package user
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import strings "strings"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import sort "sort"
import strconv "strconv"
import reflect "reflect"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type User struct {
Uid uint32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
Gid uint32 `protobuf:"varint,2,opt,name=gid,proto3" json:"gid,omitempty"`
AdditionalGids []uint32 `protobuf:"varint,3,rep,packed,name=additional_gids,json=additionalGids" json:"additional_gids,omitempty"`
}
func (m *User) Reset() { *m = User{} }
func (*User) ProtoMessage() {}
func (*User) Descriptor() ([]byte, []int) { return fileDescriptorUser, []int{0} }
func init() {
proto.RegisterType((*User)(nil), "containerd.v1.types.User")
}
func (this *User) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&user.User{")
s = append(s, "Uid: "+fmt.Sprintf("%#v", this.Uid)+",\n")
s = append(s, "Gid: "+fmt.Sprintf("%#v", this.Gid)+",\n")
s = append(s, "AdditionalGids: "+fmt.Sprintf("%#v", this.AdditionalGids)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringUser(v interface{}, typ string) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
func extensionToGoStringUser(m github_com_gogo_protobuf_proto.Message) string {
e := github_com_gogo_protobuf_proto.GetUnsafeExtensionsMap(m)
if e == nil {
return "nil"
}
s := "proto.NewUnsafeXXX_InternalExtensions(map[int32]proto.Extension{"
keys := make([]int, 0, len(e))
for k := range e {
keys = append(keys, int(k))
}
sort.Ints(keys)
ss := []string{}
for _, k := range keys {
ss = append(ss, strconv.Itoa(k)+": "+e[int32(k)].GoString())
}
s += strings.Join(ss, ",") + "})"
return s
}
func (m *User) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *User) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Uid != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintUser(dAtA, i, uint64(m.Uid))
}
if m.Gid != 0 {
dAtA[i] = 0x10
i++
i = encodeVarintUser(dAtA, i, uint64(m.Gid))
}
if len(m.AdditionalGids) > 0 {
dAtA2 := make([]byte, len(m.AdditionalGids)*10)
var j1 int
for _, num := range m.AdditionalGids {
for num >= 1<<7 {
dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j1++
}
dAtA2[j1] = uint8(num)
j1++
}
dAtA[i] = 0x1a
i++
i = encodeVarintUser(dAtA, i, uint64(j1))
i += copy(dAtA[i:], dAtA2[:j1])
}
return i, nil
}
func encodeFixed64User(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
dAtA[offset+4] = uint8(v >> 32)
dAtA[offset+5] = uint8(v >> 40)
dAtA[offset+6] = uint8(v >> 48)
dAtA[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32User(dAtA []byte, offset int, v uint32) int {
dAtA[offset] = uint8(v)
dAtA[offset+1] = uint8(v >> 8)
dAtA[offset+2] = uint8(v >> 16)
dAtA[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintUser(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *User) Size() (n int) {
var l int
_ = l
if m.Uid != 0 {
n += 1 + sovUser(uint64(m.Uid))
}
if m.Gid != 0 {
n += 1 + sovUser(uint64(m.Gid))
}
if len(m.AdditionalGids) > 0 {
l = 0
for _, e := range m.AdditionalGids {
l += sovUser(uint64(e))
}
n += 1 + sovUser(uint64(l)) + l
}
return n
}
func sovUser(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozUser(x uint64) (n int) {
return sovUser(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *User) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&User{`,
`Uid:` + fmt.Sprintf("%v", this.Uid) + `,`,
`Gid:` + fmt.Sprintf("%v", this.Gid) + `,`,
`AdditionalGids:` + fmt.Sprintf("%v", this.AdditionalGids) + `,`,
`}`,
}, "")
return s
}
func valueToStringUser(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *User) 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 ErrIntOverflowUser
}
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: User: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: User: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Uid", wireType)
}
m.Uid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUser
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Uid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Gid", wireType)
}
m.Gid = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUser
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Gid |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType == 2 {
var packedLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUser
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
packedLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if packedLen < 0 {
return ErrInvalidLengthUser
}
postIndex := iNdEx + packedLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
for iNdEx < postIndex {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUser
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
}
} else if wireType == 0 {
var v uint32
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowUser
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= (uint32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
m.AdditionalGids = append(m.AdditionalGids, v)
} else {
return fmt.Errorf("proto: wrong wireType = %d for field AdditionalGids", wireType)
}
default:
iNdEx = preIndex
skippy, err := skipUser(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthUser
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipUser(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowUser
}
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, ErrIntOverflowUser
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowUser
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthUser
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowUser
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipUser(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthUser = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowUser = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("user.proto", fileDescriptorUser) }
var fileDescriptorUser = []byte{
// 162 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x2d, 0x4e, 0x2d,
0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x4e, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b,
0x2d, 0x4a, 0xd1, 0x2b, 0x33, 0xd4, 0x2b, 0xa9, 0x2c, 0x48, 0x2d, 0x56, 0x0a, 0xe6, 0x62, 0x09,
0x2d, 0x4e, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x2e, 0xcd, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0,
0x0d, 0x02, 0x31, 0x41, 0x22, 0xe9, 0x99, 0x29, 0x12, 0x4c, 0x10, 0x91, 0xf4, 0xcc, 0x14, 0x21,
0x75, 0x2e, 0xfe, 0xc4, 0x94, 0x94, 0xcc, 0x92, 0xcc, 0xfc, 0xbc, 0xc4, 0x9c, 0xf8, 0xf4, 0xcc,
0x94, 0x62, 0x09, 0x66, 0x05, 0x66, 0x0d, 0xde, 0x20, 0x3e, 0x84, 0xb0, 0x7b, 0x66, 0x4a, 0xb1,
0x93, 0xcc, 0x89, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca, 0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0,
0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x4c,
0x62, 0x03, 0x3b, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x28, 0xf0, 0x6e, 0xd2, 0x9c, 0x00,
0x00, 0x00,
}

View File

@ -0,0 +1,9 @@
syntax = "proto3";
package containerd.v1.types;
message User {
uint32 uid = 1;
uint32 gid = 2;
repeated uint32 additional_gids = 3;
}

View File

@ -11,7 +11,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/containerd"
apishim "github.com/docker/containerd/api/shim"
shimapi "github.com/docker/containerd/api/services/shim"
"github.com/docker/containerd/shim"
"github.com/docker/containerd/sys"
"github.com/docker/containerd/utils"
@ -57,7 +57,7 @@ func main() {
sv = shim.New()
)
logrus.Debug("registering grpc server")
apishim.RegisterShimServer(server, sv)
shimapi.RegisterShimServer(server, sv)
if err := serve(server, "shim.sock"); err != nil {
return err
}

View File

@ -19,7 +19,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/containerd"
api "github.com/docker/containerd/api/execution"
api "github.com/docker/containerd/api/services/execution"
"github.com/docker/containerd/events"
"github.com/docker/containerd/log"
"github.com/docker/containerd/supervisor"

View File

@ -4,7 +4,7 @@ import (
gocontext "context"
"errors"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
"github.com/urfave/cli"
)

View File

@ -7,7 +7,8 @@ import (
gocontext "context"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
"github.com/docker/containerd/api/types/process"
"github.com/urfave/cli"
)
@ -48,7 +49,7 @@ var execCommand = cli.Command{
id := context.String("id")
sOpts := &execution.StartProcessRequest{
ContainerID: id,
Process: &execution.Process{
Process: &process.Process{
Cwd: context.String("cwd"),
Terminal: context.Bool("tty"),
Args: context.Args(),

View File

@ -5,7 +5,7 @@ import (
"errors"
"github.com/davecgh/go-spew/spew"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
"github.com/urfave/cli"
)

View File

@ -4,7 +4,7 @@ import (
gocontext "context"
"fmt"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
"github.com/urfave/cli"
)
@ -31,7 +31,7 @@ var listCommand = cli.Command{
}
fmt.Printf("%s\t%s\t%d\t%s\n",
c.ID,
c.Status,
c.State,
len(listProcResponse.Processes),
c.Bundle,
)

View File

@ -10,7 +10,7 @@ import (
gocontext "context"
"github.com/crosbymichael/console"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
execEvents "github.com/docker/containerd/execution"
"github.com/nats-io/go-nats"
"github.com/nats-io/go-nats-streaming"

View File

@ -18,7 +18,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/crosbymichael/console"
"github.com/docker/containerd/api/shim"
"github.com/docker/containerd/api/services/shim"
"github.com/urfave/cli"
"github.com/pkg/errors"
)

View File

@ -14,7 +14,7 @@ import (
gocontext "context"
"github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/services/execution"
"github.com/pkg/errors"
"github.com/tonistiigi/fifo"
"github.com/urfave/cli"

View File

@ -9,7 +9,7 @@ import (
"github.com/crosbymichael/console"
runc "github.com/crosbymichael/go-runc"
apishim "github.com/docker/containerd/api/shim"
shimapi "github.com/docker/containerd/api/services/shim"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
@ -25,7 +25,7 @@ type execProcess struct {
parent *initProcess
}
func newExecProcess(context context.Context, r *apishim.ExecRequest, parent *initProcess, id int) (process, error) {
func newExecProcess(context context.Context, r *shimapi.ExecRequest, parent *initProcess, id int) (process, error) {
cwd, err := os.Getwd()
if err != nil {
return nil, err
@ -82,7 +82,7 @@ func newExecProcess(context context.Context, r *apishim.ExecRequest, parent *ini
return e, nil
}
func processFromRequest(r *apishim.ExecRequest) specs.Process {
func processFromRequest(r *shimapi.ExecRequest) specs.Process {
var user specs.User
if r.User != nil {
user.UID = r.User.Uid
@ -103,7 +103,7 @@ func processFromRequest(r *apishim.ExecRequest) specs.Process {
}
}
func rlimits(rr []*apishim.Rlimit) (o []specs.LinuxRlimit) {
func rlimits(rr []*shimapi.Rlimit) (o []specs.LinuxRlimit) {
for _, r := range rr {
o = append(o, specs.LinuxRlimit{
Type: r.Type,

View File

@ -9,7 +9,7 @@ import (
"github.com/crosbymichael/console"
runc "github.com/crosbymichael/go-runc"
apishim "github.com/docker/containerd/api/shim"
shimapi "github.com/docker/containerd/api/services/shim"
)
type initProcess struct {
@ -24,7 +24,7 @@ type initProcess struct {
pid int
}
func newInitProcess(context context.Context, r *apishim.CreateRequest) (*initProcess, error) {
func newInitProcess(context context.Context, r *shimapi.CreateRequest) (*initProcess, error) {
cwd, err := os.Getwd()
if err != nil {
return nil, err

View File

@ -5,7 +5,9 @@ import (
"syscall"
"github.com/crosbymichael/console"
apishim "github.com/docker/containerd/api/shim"
shimapi "github.com/docker/containerd/api/services/shim"
processapi "github.com/docker/containerd/api/types/process"
stateapi "github.com/docker/containerd/api/types/state"
"github.com/docker/containerd/utils"
google_protobuf "github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
@ -18,7 +20,7 @@ var emptyResponse = &google_protobuf.Empty{}
func New() *Service {
return &Service{
processes: make(map[int]process),
events: make(chan *apishim.Event, 4096),
events: make(chan *shimapi.Event, 4096),
}
}
@ -28,11 +30,11 @@ type Service struct {
bundle string
mu sync.Mutex
processes map[int]process
events chan *apishim.Event
events chan *shimapi.Event
execID int
}
func (s *Service) Create(ctx context.Context, r *apishim.CreateRequest) (*apishim.CreateResponse, error) {
func (s *Service) Create(ctx context.Context, r *shimapi.CreateRequest) (*shimapi.CreateResponse, error) {
process, err := newInitProcess(ctx, r)
if err != nil {
return nil, err
@ -44,29 +46,29 @@ func (s *Service) Create(ctx context.Context, r *apishim.CreateRequest) (*apishi
pid := process.Pid()
s.processes[pid] = process
s.mu.Unlock()
s.events <- &apishim.Event{
Type: apishim.EventType_CREATE,
s.events <- &shimapi.Event{
Type: shimapi.EventType_CREATE,
ID: r.ID,
Pid: uint32(pid),
}
return &apishim.CreateResponse{
return &shimapi.CreateResponse{
Pid: uint32(pid),
}, nil
}
func (s *Service) Start(ctx context.Context, r *apishim.StartRequest) (*google_protobuf.Empty, error) {
func (s *Service) Start(ctx context.Context, r *shimapi.StartRequest) (*google_protobuf.Empty, error) {
if err := s.initProcess.Start(ctx); err != nil {
return nil, err
}
s.events <- &apishim.Event{
Type: apishim.EventType_START,
s.events <- &shimapi.Event{
Type: shimapi.EventType_START,
ID: s.id,
Pid: uint32(s.initProcess.Pid()),
}
return emptyResponse, nil
}
func (s *Service) Delete(ctx context.Context, r *apishim.DeleteRequest) (*apishim.DeleteResponse, error) {
func (s *Service) Delete(ctx context.Context, r *shimapi.DeleteRequest) (*shimapi.DeleteResponse, error) {
s.mu.Lock()
p, ok := s.processes[int(r.Pid)]
s.mu.Unlock()
@ -79,12 +81,12 @@ func (s *Service) Delete(ctx context.Context, r *apishim.DeleteRequest) (*apishi
s.mu.Lock()
delete(s.processes, p.Pid())
s.mu.Unlock()
return &apishim.DeleteResponse{
return &shimapi.DeleteResponse{
ExitStatus: uint32(p.Status()),
}, nil
}
func (s *Service) Exec(ctx context.Context, r *apishim.ExecRequest) (*apishim.ExecResponse, error) {
func (s *Service) Exec(ctx context.Context, r *shimapi.ExecRequest) (*shimapi.ExecResponse, error) {
s.mu.Lock()
defer s.mu.Unlock()
s.execID++
@ -94,17 +96,17 @@ func (s *Service) Exec(ctx context.Context, r *apishim.ExecRequest) (*apishim.Ex
}
pid := process.Pid()
s.processes[pid] = process
s.events <- &apishim.Event{
Type: apishim.EventType_EXEC_ADDED,
s.events <- &shimapi.Event{
Type: shimapi.EventType_EXEC_ADDED,
ID: s.id,
Pid: uint32(pid),
}
return &apishim.ExecResponse{
return &shimapi.ExecResponse{
Pid: uint32(pid),
}, nil
}
func (s *Service) Pty(ctx context.Context, r *apishim.PtyRequest) (*google_protobuf.Empty, error) {
func (s *Service) Pty(ctx context.Context, r *shimapi.PtyRequest) (*google_protobuf.Empty, error) {
if r.Pid == 0 {
return nil, errors.Errorf("pid not provided in request")
}
@ -124,7 +126,7 @@ func (s *Service) Pty(ctx context.Context, r *apishim.PtyRequest) (*google_proto
return emptyResponse, nil
}
func (s *Service) Events(r *apishim.EventsRequest, stream apishim.Shim_EventsServer) error {
func (s *Service) Events(r *shimapi.EventsRequest, stream shimapi.Shim_EventsServer) error {
for e := range s.events {
if err := stream.Send(e); err != nil {
return err
@ -133,24 +135,24 @@ func (s *Service) Events(r *apishim.EventsRequest, stream apishim.Shim_EventsSer
return nil
}
func (s *Service) State(ctx context.Context, r *apishim.StateRequest) (*apishim.StateResponse, error) {
o := &apishim.StateResponse{
func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) {
o := &shimapi.StateResponse{
ID: s.id,
Bundle: s.bundle,
InitPid: uint32(s.initProcess.Pid()),
Processes: []*apishim.Process{},
Processes: []*processapi.Process{},
}
s.mu.Lock()
defer s.mu.Unlock()
for _, p := range s.processes {
state := apishim.State_RUNNING
state := stateapi.State_RUNNING
if err := syscall.Kill(p.Pid(), 0); err != nil {
if err != syscall.ESRCH {
return nil, err
}
state = apishim.State_STOPPED
state = stateapi.State_STOPPED
}
o.Processes = append(o.Processes, &apishim.Process{
o.Processes = append(o.Processes, &processapi.Process{
Pid: uint32(p.Pid()),
State: state,
})
@ -158,14 +160,14 @@ func (s *Service) State(ctx context.Context, r *apishim.StateRequest) (*apishim.
return o, nil
}
func (s *Service) Pause(ctx context.Context, r *apishim.PauseRequest) (*google_protobuf.Empty, error) {
func (s *Service) Pause(ctx context.Context, r *shimapi.PauseRequest) (*google_protobuf.Empty, error) {
if err := s.initProcess.Pause(ctx); err != nil {
return nil, err
}
return emptyResponse, nil
}
func (s *Service) Resume(ctx context.Context, r *apishim.ResumeRequest) (*google_protobuf.Empty, error) {
func (s *Service) Resume(ctx context.Context, r *shimapi.ResumeRequest) (*google_protobuf.Empty, error) {
if err := s.initProcess.Resume(ctx); err != nil {
return nil, err
}
@ -176,8 +178,8 @@ func (s *Service) ProcessExit(e utils.Exit) error {
s.mu.Lock()
if p, ok := s.processes[e.Pid]; ok {
p.Exited(e.Status)
s.events <- &apishim.Event{
Type: apishim.EventType_EXIT,
s.events <- &shimapi.Event{
Type: shimapi.EventType_EXIT,
ID: s.id,
Pid: uint32(p.Pid()),
ExitStatus: uint32(e.Status),

View File

@ -9,8 +9,10 @@ import (
"sync"
"time"
api "github.com/docker/containerd/api/execution"
"github.com/docker/containerd/api/shim"
executionapi "github.com/docker/containerd/api/services/execution"
"github.com/docker/containerd/api/services/shim"
"github.com/docker/containerd/api/types/container"
"github.com/docker/containerd/api/types/process"
"github.com/docker/containerd/events"
"github.com/docker/containerd/execution"
"github.com/docker/containerd/log"
@ -20,7 +22,7 @@ import (
)
var (
_ = (api.ExecutionServiceServer)(&Service{})
_ = (executionapi.ExecutionServiceServer)(&Service{})
empty = &google_protobuf.Empty{}
)
@ -56,7 +58,7 @@ type Service struct {
shims map[string]*shimClient
}
func (s *Service) CreateContainer(ctx context.Context, r *api.CreateContainerRequest) (*api.CreateContainerResponse, error) {
func (s *Service) CreateContainer(ctx context.Context, r *executionapi.CreateContainerRequest) (*executionapi.CreateContainerResponse, error) {
client, err := s.newShim(r.ID)
if err != nil {
return nil, err
@ -82,17 +84,17 @@ func (s *Service) CreateContainer(ctx context.Context, r *api.CreateContainerReq
return nil, errors.Wrapf(err, "shim create request failed")
}
client.initPid = createResponse.Pid
return &api.CreateContainerResponse{
Container: &api.Container{
return &executionapi.CreateContainerResponse{
Container: &container.Container{
ID: r.ID,
},
InitProcess: &api.Process{
InitProcess: &process.Process{
Pid: createResponse.Pid,
},
}, nil
}
func (s *Service) StartContainer(ctx context.Context, r *api.StartContainerRequest) (*google_protobuf.Empty, error) {
func (s *Service) StartContainer(ctx context.Context, r *executionapi.StartContainerRequest) (*google_protobuf.Empty, error) {
client, err := s.getShim(r.ID)
if err != nil {
return nil, err
@ -103,7 +105,7 @@ func (s *Service) StartContainer(ctx context.Context, r *api.StartContainerReque
return empty, nil
}
func (s *Service) DeleteContainer(ctx context.Context, r *api.DeleteContainerRequest) (*google_protobuf.Empty, error) {
func (s *Service) DeleteContainer(ctx context.Context, r *executionapi.DeleteContainerRequest) (*google_protobuf.Empty, error) {
client, err := s.getShim(r.ID)
if err != nil {
return nil, err
@ -118,21 +120,21 @@ func (s *Service) DeleteContainer(ctx context.Context, r *api.DeleteContainerReq
return empty, nil
}
func (s *Service) ListContainers(ctx context.Context, r *api.ListContainersRequest) (*api.ListContainersResponse, error) {
resp := &api.ListContainersResponse{}
func (s *Service) ListContainers(ctx context.Context, r *executionapi.ListContainersRequest) (*executionapi.ListContainersResponse, error) {
resp := &executionapi.ListContainersResponse{}
for _, client := range s.shims {
status, err := client.State(ctx, &shim.StateRequest{})
if err != nil {
return nil, err
}
resp.Containers = append(resp.Containers, &api.Container{
resp.Containers = append(resp.Containers, &container.Container{
ID: status.ID,
Bundle: status.Bundle,
})
}
return resp, nil
}
func (s *Service) GetContainer(ctx context.Context, r *api.GetContainerRequest) (*api.GetContainerResponse, error) {
func (s *Service) GetContainer(ctx context.Context, r *executionapi.GetContainerRequest) (*executionapi.GetContainerResponse, error) {
client, err := s.getShim(r.ID)
if err != nil {
return nil, err
@ -141,8 +143,8 @@ func (s *Service) GetContainer(ctx context.Context, r *api.GetContainerRequest)
if err != nil {
return nil, err
}
return &api.GetContainerResponse{
Container: &api.Container{
return &executionapi.GetContainerResponse{
Container: &container.Container{
ID: state.ID,
Bundle: state.Bundle,
// TODO: add processes
@ -150,12 +152,12 @@ func (s *Service) GetContainer(ctx context.Context, r *api.GetContainerRequest)
}, nil
}
func (s *Service) UpdateContainer(ctx context.Context, r *api.UpdateContainerRequest) (*google_protobuf.Empty, error) {
func (s *Service) UpdateContainer(ctx context.Context, r *executionapi.UpdateContainerRequest) (*google_protobuf.Empty, error) {
panic("not implemented")
return empty, nil
}
func (s *Service) PauseContainer(ctx context.Context, r *api.PauseContainerRequest) (*google_protobuf.Empty, error) {
func (s *Service) PauseContainer(ctx context.Context, r *executionapi.PauseContainerRequest) (*google_protobuf.Empty, error) {
client, err := s.getShim(r.ID)
if err != nil {
return nil, err
@ -163,7 +165,7 @@ func (s *Service) PauseContainer(ctx context.Context, r *api.PauseContainerReque
return client.Pause(ctx, &shim.PauseRequest{})
}
func (s *Service) ResumeContainer(ctx context.Context, r *api.ResumeContainerRequest) (*google_protobuf.Empty, error) {
func (s *Service) ResumeContainer(ctx context.Context, r *executionapi.ResumeContainerRequest) (*google_protobuf.Empty, error) {
client, err := s.getShim(r.ID)
if err != nil {
return nil, err
@ -171,7 +173,7 @@ func (s *Service) ResumeContainer(ctx context.Context, r *api.ResumeContainerReq
return client.Resume(ctx, &shim.ResumeRequest{})
}
func (s *Service) StartProcess(ctx context.Context, r *api.StartProcessRequest) (*api.StartProcessResponse, error) {
func (s *Service) StartProcess(ctx context.Context, r *executionapi.StartProcessRequest) (*executionapi.StartProcessResponse, error) {
client, err := s.getShim(r.ContainerID)
if err != nil {
return nil, err
@ -198,21 +200,21 @@ func (s *Service) StartProcess(ctx context.Context, r *api.StartProcessRequest)
return nil, errors.Wrapf(err, "failed to exec into container %q", r.ContainerID)
}
r.Process.Pid = resp.Pid
return &api.StartProcessResponse{
return &executionapi.StartProcessResponse{
Process: r.Process,
}, nil
}
// containerd managed execs + system pids forked in container
func (s *Service) GetProcess(ctx context.Context, r *api.GetProcessRequest) (*api.GetProcessResponse, error) {
func (s *Service) GetProcess(ctx context.Context, r *executionapi.GetProcessRequest) (*executionapi.GetProcessResponse, error) {
panic("not implemented")
}
func (s *Service) SignalProcess(ctx context.Context, r *api.SignalProcessRequest) (*google_protobuf.Empty, error) {
func (s *Service) SignalProcess(ctx context.Context, r *executionapi.SignalProcessRequest) (*google_protobuf.Empty, error) {
panic("not implemented")
}
func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest) (*google_protobuf.Empty, error) {
func (s *Service) DeleteProcess(ctx context.Context, r *executionapi.DeleteProcessRequest) (*google_protobuf.Empty, error) {
client, err := s.getShim(r.ContainerID)
if err != nil {
return nil, err
@ -229,7 +231,7 @@ func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest
return empty, nil
}
func (s *Service) ListProcesses(ctx context.Context, r *api.ListProcessesRequest) (*api.ListProcessesResponse, error) {
func (s *Service) ListProcesses(ctx context.Context, r *executionapi.ListProcessesRequest) (*executionapi.ListProcessesResponse, error) {
panic("not implemented")
}

View File

@ -12,7 +12,7 @@ import (
"syscall"
"time"
"github.com/docker/containerd/api/shim"
"github.com/docker/containerd/api/services/shim"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"

32
tools/gen-gen-go.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# This script generates gen.go for grpc packages.
set -e
validate_dir() {
dir=$1
parent=$(dirname $dir)
( [ $parent = api/types ] || [ $parent = api/services ] ) || { echo "Unexpected dir ${dir}"; exit 1; }
[ $(find $dir -name '*.proto' | wc -l) -eq 1 ] || { echo "${dir} has unexpected number of proto files"; exit 1; }
}
repo=$(pwd)
[ $(basename $repo) = containerd ] || { echo "Unexpected cwd ${repo}"; exit 1; }
protos=$(find api -name '*.proto')
for proto in $protos; do
dir=$(dirname $proto)
validate_dir $dir
proto_base=$(basename $proto)
pkg="github.com/docker/containerd/${dir}"
pkg_base=$(basename $dir)
gengo="${dir}/gen.go"
cat <<EOF > $gengo
// Code generated by tools/gen-gen-go.sh
// DO NOT EDIT!
package ${pkg_base}
//go:generate protoc -I.:${repo}/vendor:${repo}/vendor/github.com/gogo/protobuf:${repo}/../../..:/usr/local/include --gogoctrd_out=plugins=grpc,import_path=${pkg},Mgogoproto/gogo.proto=github.com/gogo/protobuf/gogoproto,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:. ${proto_base}
EOF
done