1syntax = "proto3";
2
3package containerd.task.v2;
4
5import "google/protobuf/any.proto";
6import "google/protobuf/empty.proto";
7import weak "gogoproto/gogo.proto";
8import "google/protobuf/timestamp.proto";
9import "github.com/containerd/containerd/api/types/mount.proto";
10import "github.com/containerd/containerd/api/types/task/task.proto";
11
12option go_package = "github.com/containerd/containerd/runtime/v2/task;task";
13
14// Shim service is launched for each container and is responsible for owning the IO
15// for the container and its additional processes.  The shim is also the parent of
16// each container and allows reattaching to the IO and receiving the exit status
17// for the container processes.
18service Task {
19	rpc State(StateRequest) returns (StateResponse);
20	rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
21	rpc Start(StartRequest) returns (StartResponse);
22	rpc Delete(DeleteRequest) returns (DeleteResponse);
23	rpc Pids(PidsRequest) returns (PidsResponse);
24	rpc Pause(PauseRequest) returns (google.protobuf.Empty);
25	rpc Resume(ResumeRequest) returns (google.protobuf.Empty);
26	rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty);
27	rpc Kill(KillRequest) returns (google.protobuf.Empty);
28	rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
29	rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
30	rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty);
31	rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
32	rpc Wait(WaitRequest) returns (WaitResponse);
33	rpc Stats(StatsRequest) returns (StatsResponse);
34	rpc Connect(ConnectRequest) returns (ConnectResponse);
35	rpc Shutdown(ShutdownRequest) returns (google.protobuf.Empty);
36}
37
38message CreateTaskRequest {
39	string id = 1;
40	string bundle = 2;
41	repeated containerd.types.Mount rootfs = 3;
42	bool terminal = 4;
43	string stdin = 5;
44	string stdout = 6;
45	string stderr = 7;
46	string checkpoint = 8;
47	string parent_checkpoint = 9;
48	google.protobuf.Any options = 10;
49}
50
51message CreateTaskResponse {
52	uint32 pid = 1;
53}
54
55message DeleteRequest {
56	string id = 1;
57	string exec_id = 2;
58}
59
60message DeleteResponse {
61	uint32 pid = 1;
62	uint32 exit_status = 2;
63	google.protobuf.Timestamp exited_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
64}
65
66message ExecProcessRequest {
67	string id = 1;
68	string exec_id = 2;
69	bool terminal = 3;
70	string stdin = 4;
71	string stdout = 5;
72	string stderr = 6;
73	google.protobuf.Any spec = 7;
74}
75
76message ExecProcessResponse {
77}
78
79message ResizePtyRequest {
80	string id = 1;
81	string exec_id = 2;
82	uint32 width = 3;
83	uint32 height = 4;
84}
85
86message StateRequest {
87	string id = 1;
88	string exec_id = 2;
89}
90
91message StateResponse {
92	string id = 1;
93	string bundle = 2;
94	uint32 pid = 3;
95	containerd.v1.types.Status status = 4;
96	string stdin = 5;
97	string stdout = 6;
98	string stderr = 7;
99	bool terminal = 8;
100	uint32 exit_status = 9;
101	google.protobuf.Timestamp exited_at = 10 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
102	string exec_id = 11;
103}
104
105message KillRequest {
106	string id = 1;
107	string exec_id = 2;
108	uint32 signal = 3;
109	bool all = 4;
110}
111
112message CloseIORequest {
113	string id = 1;
114	string exec_id = 2;
115	bool stdin = 3;
116}
117
118message PidsRequest {
119	string id = 1;
120}
121
122message PidsResponse {
123	repeated containerd.v1.types.ProcessInfo processes = 1;
124}
125
126message CheckpointTaskRequest {
127	string id = 1;
128	string path = 2;
129	google.protobuf.Any options = 3;
130}
131
132message UpdateTaskRequest {
133	string id = 1;
134	google.protobuf.Any resources = 2;
135}
136
137message StartRequest {
138	string id = 1;
139	string exec_id = 2;
140}
141
142message StartResponse {
143	uint32 pid = 1;
144}
145
146message WaitRequest {
147	string id = 1;
148	string exec_id = 2;
149}
150
151message WaitResponse {
152	uint32 exit_status = 1;
153	google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
154}
155
156message StatsRequest {
157	string id = 1;
158}
159
160message StatsResponse {
161	google.protobuf.Any stats = 1;
162}
163
164message ConnectRequest {
165	string id = 1;
166}
167
168message ConnectResponse {
169	uint32 shim_pid = 1;
170	uint32 task_pid = 2;
171	string version = 3;
172}
173
174message ShutdownRequest {
175	string id = 1;
176	bool now = 2;
177}
178
179message PauseRequest {
180	string id = 1;
181}
182
183message ResumeRequest {
184	string id = 1;
185}
186