1syntax = "proto3";
2
3package containerd.services.tasks.v1;
4
5import "google/protobuf/empty.proto";
6import "google/protobuf/any.proto";
7import weak "gogoproto/gogo.proto";
8import "github.com/containerd/containerd/api/types/mount.proto";
9import "github.com/containerd/containerd/api/types/metrics.proto";
10import "github.com/containerd/containerd/api/types/descriptor.proto";
11import "github.com/containerd/containerd/api/types/task/task.proto";
12import "google/protobuf/timestamp.proto";
13
14option go_package = "github.com/containerd/containerd/api/services/tasks/v1;tasks";
15
16service Tasks {
17	// Create a task.
18	rpc Create(CreateTaskRequest) returns (CreateTaskResponse);
19
20	// Start a process.
21	rpc Start(StartRequest) returns (StartResponse);
22
23	// Delete a task and on disk state.
24	rpc Delete(DeleteTaskRequest) returns (DeleteResponse);
25
26	rpc DeleteProcess(DeleteProcessRequest) returns (DeleteResponse);
27
28	rpc Get(GetRequest) returns (GetResponse);
29
30	rpc List(ListTasksRequest) returns (ListTasksResponse);
31
32	// Kill a task or process.
33	rpc Kill(KillRequest) returns (google.protobuf.Empty);
34
35	rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty);
36
37	rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty);
38
39	rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty);
40
41	rpc Pause(PauseTaskRequest) returns (google.protobuf.Empty);
42
43	rpc Resume(ResumeTaskRequest) returns (google.protobuf.Empty);
44
45	rpc ListPids(ListPidsRequest) returns (ListPidsResponse);
46
47	rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse);
48
49	rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty);
50
51	rpc Metrics(MetricsRequest) returns (MetricsResponse);
52
53	rpc Wait(WaitRequest) returns (WaitResponse);
54}
55
56message CreateTaskRequest {
57	string container_id = 1;
58
59	// RootFS provides the pre-chroot mounts to perform in the shim before
60	// executing the container task.
61	//
62	// These are for mounts that cannot be performed in the user namespace.
63	// Typically, these mounts should be resolved from snapshots specified on
64	// the container object.
65	repeated containerd.types.Mount rootfs = 3;
66
67	string stdin = 4;
68	string stdout = 5;
69	string stderr = 6;
70	bool terminal = 7;
71
72	containerd.types.Descriptor checkpoint = 8;
73
74	google.protobuf.Any options = 9;
75}
76
77message CreateTaskResponse {
78	string container_id = 1;
79	uint32 pid = 2;
80}
81
82message StartRequest {
83	string container_id = 1;
84	string exec_id = 2;
85}
86
87message StartResponse {
88	uint32 pid = 1;
89}
90
91message DeleteTaskRequest {
92	string container_id = 1;
93}
94
95message DeleteResponse {
96	string id = 1;
97	uint32 pid = 2;
98	uint32 exit_status = 3;
99	google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
100}
101
102message DeleteProcessRequest {
103	string container_id = 1;
104	string exec_id = 2;
105}
106
107message GetRequest {
108	string container_id = 1;
109	string exec_id = 2;
110}
111
112message GetResponse {
113	containerd.v1.types.Process process = 1;
114}
115
116message ListTasksRequest {
117	string filter = 1;
118}
119
120message ListTasksResponse {
121	repeated containerd.v1.types.Process tasks = 1;
122}
123
124message KillRequest {
125	string container_id = 1;
126	string exec_id = 2;
127	uint32 signal = 3;
128	bool all = 4;
129}
130
131message ExecProcessRequest {
132	string container_id = 1;
133	string stdin = 2;
134	string stdout = 3;
135	string stderr = 4;
136	bool terminal = 5;
137	// Spec for starting a process in the target container.
138	//
139	// For runc, this is a process spec, for example.
140	google.protobuf.Any spec = 6;
141	// id of the exec process
142	string exec_id = 7;
143}
144
145message ExecProcessResponse {
146}
147
148message ResizePtyRequest {
149	string container_id = 1;
150	string exec_id = 2;
151	uint32 width = 3;
152	uint32 height = 4;
153}
154
155message CloseIORequest {
156	string container_id = 1;
157	string exec_id = 2;
158	bool stdin = 3;
159}
160
161message PauseTaskRequest {
162	string container_id = 1;
163}
164
165message ResumeTaskRequest {
166	string container_id = 1;
167}
168
169message ListPidsRequest {
170	string container_id = 1;
171}
172
173message ListPidsResponse {
174	// Processes includes the process ID and additional process information
175	repeated containerd.v1.types.ProcessInfo processes = 1;
176}
177
178message CheckpointTaskRequest {
179	string container_id = 1;
180	string parent_checkpoint = 2 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
181	google.protobuf.Any options = 3;
182}
183
184message CheckpointTaskResponse {
185	repeated containerd.types.Descriptor descriptors = 1;
186}
187
188message UpdateTaskRequest {
189	string container_id = 1;
190	google.protobuf.Any resources = 2;
191}
192
193message MetricsRequest {
194	repeated string filters = 1;
195}
196
197message MetricsResponse {
198	repeated types.Metric metrics = 1;
199}
200
201message WaitRequest {
202	string container_id = 1;
203	string exec_id = 2;
204}
205
206message WaitResponse {
207	uint32 exit_status = 1;
208	google.protobuf.Timestamp exited_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
209}
210