1/*
2	Copyright The containerd Authors.
3
4	Licensed under the Apache License, Version 2.0 (the "License");
5	you may not use this file except in compliance with the License.
6	You may obtain a copy of the License at
7
8		http://www.apache.org/licenses/LICENSE-2.0
9
10	Unless required by applicable law or agreed to in writing, software
11	distributed under the License is distributed on an "AS IS" BASIS,
12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13	See the License for the specific language governing permissions and
14	limitations under the License.
15*/
16
17syntax = "proto3";
18
19package containerd.runtime.linux.shim.v1;
20
21import "google/protobuf/any.proto";
22import "google/protobuf/empty.proto";
23import weak "gogoproto/gogo.proto";
24import "google/protobuf/timestamp.proto";
25import "github.com/containerd/containerd/api/types/mount.proto";
26import "github.com/containerd/containerd/api/types/task/task.proto";
27
28option go_package = "github.com/containerd/containerd/runtime/v1/shim/v1;shim";
29
30// Shim service is launched for each container and is responsible for owning the IO
31// for the container and its additional processes.  The shim is also the parent of
32// each container and allows reattaching to the IO and receiving the exit status
33// for the container processes.
34service Shim {
35	// State returns shim and task state information.
36	rpc State(StateRequest) returns (StateResponse);
37
38	rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
39
40	rpc Start(StartRequest) returns (StartResponse);
41
42	rpc Delete(google.protobuf.Empty) returns (DeleteResponse);
43
44	rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse);
45
46	rpc ListPids(ListPidsRequest) returns (ListPidsResponse);
47
48	rpc Pause(google.protobuf.Empty) returns (google.protobuf.Empty);
49
50	rpc Resume(google.protobuf.Empty) returns (google.protobuf.Empty);
51
52	rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty);
53
54	rpc Kill(KillRequest) returns (google.protobuf.Empty);
55
56	rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
57
58	rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
59
60	rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty);
61
62	// ShimInfo returns information about the shim.
63	rpc ShimInfo(google.protobuf.Empty) returns (ShimInfoResponse);
64
65	rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
66
67	rpc Wait(WaitRequest) returns (WaitResponse);
68}
69
70message CreateTaskRequest {
71	string id = 1;
72	string bundle = 2;
73	string runtime = 3;
74	repeated containerd.types.Mount rootfs = 4;
75	bool terminal = 5;
76	string stdin = 6;
77	string stdout = 7;
78	string stderr = 8;
79	string checkpoint = 9;
80	string parent_checkpoint = 10;
81	google.protobuf.Any options = 11;
82}
83
84message CreateTaskResponse {
85	uint32 pid = 1;
86}
87
88message DeleteResponse {
89	uint32 pid = 1;
90	uint32 exit_status = 2;
91	google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
92}
93
94message DeleteProcessRequest {
95	string id = 1;
96}
97
98message ExecProcessRequest {
99	string id = 1;
100	bool terminal = 2;
101	string stdin = 3;
102	string stdout = 4;
103	string stderr = 5;
104	google.protobuf.Any spec = 6;
105}
106
107message ExecProcessResponse {
108}
109
110message ResizePtyRequest {
111	string id = 1;
112	uint32 width = 2;
113	uint32 height = 3;
114}
115
116message StateRequest {
117	string id = 1;
118}
119
120message StateResponse {
121	string id = 1;
122	string bundle = 2;
123	uint32 pid = 3;
124	containerd.v1.types.Status status = 4;
125	string stdin = 5;
126	string stdout = 6;
127	string stderr = 7;
128	bool terminal = 8;
129	uint32 exit_status = 9;
130	google.protobuf.Timestamp exited_at = 10 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
131}
132
133message KillRequest {
134	string id = 1;
135	uint32 signal = 2;
136	bool all = 3;
137}
138
139message CloseIORequest {
140	string id = 1;
141	bool stdin = 2;
142}
143
144message ListPidsRequest {
145	string id = 1;
146}
147
148message ListPidsResponse {
149	repeated containerd.v1.types.ProcessInfo processes = 1;
150}
151
152message CheckpointTaskRequest {
153	string path = 1;
154	google.protobuf.Any options = 2;
155}
156
157message ShimInfoResponse {
158	uint32 shim_pid = 1;
159}
160
161message UpdateTaskRequest {
162	google.protobuf.Any resources = 1;
163}
164
165message StartRequest {
166	string id = 1;
167}
168
169message StartResponse {
170	string id = 1;
171	uint32 pid = 2;
172}
173
174message WaitRequest {
175	string id = 1;
176}
177
178message WaitResponse {
179	uint32 exit_status = 1;
180	google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
181}
182