X Tutup
Skip to content

Commit e2d5522

Browse files
committed
Change ListProcesses to ListPids
These rpcs only return pids []uint32 so should be named that way in order to have other rpcs that list Processes such as Exec'd processes. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
1 parent 55861c1 commit e2d5522

File tree

11 files changed

+417
-371
lines changed

11 files changed

+417
-371
lines changed

api/services/tasks/v1/tasks.pb.go

Lines changed: 198 additions & 161 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/services/tasks/v1/tasks.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ service Tasks {
4141

4242
rpc Resume(ResumeTaskRequest) returns (google.protobuf.Empty);
4343

44-
rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse);
44+
rpc ListPids(ListPidsRequest) returns (ListPidsResponse);
4545

4646
rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse);
4747

@@ -173,12 +173,12 @@ message ResumeTaskRequest {
173173
string container_id = 1;
174174
}
175175

176-
message ListProcessesRequest {
176+
message ListPidsRequest {
177177
string container_id = 1;
178178
}
179179

180-
message ListProcessesResponse{
181-
repeated containerd.v1.types.Process processes = 1;
180+
message ListPidsResponse{
181+
repeated uint32 pids = 1;
182182
}
183183

184184
message CheckpointTaskRequest {

linux/shim/local.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func (c *local) Kill(ctx context.Context, in *shimapi.KillRequest, opts ...grpc.
7676
return c.s.Kill(ctx, in)
7777
}
7878

79-
func (c *local) ListProcesses(ctx context.Context, in *shimapi.ListProcessesRequest, opts ...grpc.CallOption) (*shimapi.ListProcessesResponse, error) {
80-
return c.s.ListProcesses(ctx, in)
79+
func (c *local) ListPids(ctx context.Context, in *shimapi.ListPidsRequest, opts ...grpc.CallOption) (*shimapi.ListPidsResponse, error) {
80+
return c.s.ListPids(ctx, in)
8181
}
8282

8383
func (c *local) CloseIO(ctx context.Context, in *shimapi.CloseIORequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) {

linux/shim/service.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,14 @@ func (s *Service) Kill(ctx context.Context, r *shimapi.KillRequest) (*google_pro
321321
return empty, nil
322322
}
323323

324-
func (s *Service) ListProcesses(ctx context.Context, r *shimapi.ListProcessesRequest) (*shimapi.ListProcessesResponse, error) {
324+
func (s *Service) ListPids(ctx context.Context, r *shimapi.ListPidsRequest) (*shimapi.ListPidsResponse, error) {
325325
pids, err := s.getContainerPids(ctx, r.ID)
326326
if err != nil {
327327
return nil, err
328328
}
329-
ps := []*task.Process{}
330-
for _, pid := range pids {
331-
ps = append(ps, &task.Process{
332-
Pid: pid,
333-
})
334-
}
335-
resp := &shimapi.ListProcessesResponse{
336-
Processes: ps,
337-
}
338-
return resp, nil
329+
return &shimapi.ListPidsResponse{
330+
Pids: pids,
331+
}, nil
339332
}
340333

341334
func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*google_protobuf.Empty, error) {

0 commit comments

Comments
 (0)
X Tutup