Comment more packages to pass go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/gogo/protobuf/types"
|
||||
)
|
||||
|
||||
// Task on a linux based system
|
||||
type Task struct {
|
||||
id string
|
||||
pid int
|
||||
@@ -45,10 +46,12 @@ func newTask(id, namespace string, pid int, shim *client.Client, monitor runtime
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ID of the task
|
||||
func (t *Task) ID() string {
|
||||
return t.id
|
||||
}
|
||||
|
||||
// Info returns task information about the runtime and namespace
|
||||
func (t *Task) Info() runtime.TaskInfo {
|
||||
return runtime.TaskInfo{
|
||||
ID: t.id,
|
||||
@@ -57,6 +60,7 @@ func (t *Task) Info() runtime.TaskInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// Start the task
|
||||
func (t *Task) Start(ctx context.Context) error {
|
||||
hasCgroup := t.cg != nil
|
||||
r, err := t.shim.Start(ctx, &shim.StartRequest{
|
||||
@@ -79,6 +83,7 @@ func (t *Task) Start(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// State returns runtime information for the task
|
||||
func (t *Task) State(ctx context.Context) (runtime.State, error) {
|
||||
response, err := t.shim.State(ctx, &shim.StateRequest{
|
||||
ID: t.id,
|
||||
@@ -114,6 +119,7 @@ func (t *Task) State(ctx context.Context) (runtime.State, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Pause the task and all processes
|
||||
func (t *Task) Pause(ctx context.Context) error {
|
||||
_, err := t.shim.Pause(ctx, empty)
|
||||
if err != nil {
|
||||
@@ -122,6 +128,7 @@ func (t *Task) Pause(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Resume the task and all processes
|
||||
func (t *Task) Resume(ctx context.Context) error {
|
||||
if _, err := t.shim.Resume(ctx, empty); err != nil {
|
||||
return errdefs.FromGRPC(err)
|
||||
@@ -129,6 +136,9 @@ func (t *Task) Resume(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Kill the task using the provided signal
|
||||
//
|
||||
// Optionally send the signal to all processes that are a child of the task
|
||||
func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error {
|
||||
if _, err := t.shim.Kill(ctx, &shim.KillRequest{
|
||||
ID: t.id,
|
||||
@@ -140,6 +150,7 @@ func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Exec creates a new process inside the task
|
||||
func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
|
||||
request := &shim.ExecProcessRequest{
|
||||
ID: id,
|
||||
@@ -158,6 +169,7 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Pids returns all system level process ids running inside the task
|
||||
func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
|
||||
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{
|
||||
ID: t.id,
|
||||
@@ -168,6 +180,7 @@ func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
|
||||
return resp.Pids, nil
|
||||
}
|
||||
|
||||
// ResizePty changes the side of the task's PTY to the provided width and height
|
||||
func (t *Task) ResizePty(ctx context.Context, size runtime.ConsoleSize) error {
|
||||
_, err := t.shim.ResizePty(ctx, &shim.ResizePtyRequest{
|
||||
ID: t.id,
|
||||
@@ -180,6 +193,7 @@ func (t *Task) ResizePty(ctx context.Context, size runtime.ConsoleSize) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// CloseIO closes the provided IO on the task
|
||||
func (t *Task) CloseIO(ctx context.Context) error {
|
||||
_, err := t.shim.CloseIO(ctx, &shim.CloseIORequest{
|
||||
ID: t.id,
|
||||
@@ -191,6 +205,7 @@ func (t *Task) CloseIO(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Checkpoint creates a system level dump of the task and process information that can be later restored
|
||||
func (t *Task) Checkpoint(ctx context.Context, path string, options *types.Any) error {
|
||||
r := &shim.CheckpointTaskRequest{
|
||||
Path: path,
|
||||
@@ -202,6 +217,7 @@ func (t *Task) Checkpoint(ctx context.Context, path string, options *types.Any)
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteProcess removes the provided process from the task and deletes all on disk state
|
||||
func (t *Task) DeleteProcess(ctx context.Context, id string) (*runtime.Exit, error) {
|
||||
r, err := t.shim.DeleteProcess(ctx, &shim.DeleteProcessRequest{
|
||||
ID: id,
|
||||
@@ -216,6 +232,7 @@ func (t *Task) DeleteProcess(ctx context.Context, id string) (*runtime.Exit, err
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Update changes runtime information of a running task
|
||||
func (t *Task) Update(ctx context.Context, resources *types.Any) error {
|
||||
if _, err := t.shim.Update(ctx, &shim.UpdateTaskRequest{
|
||||
Resources: resources,
|
||||
@@ -225,6 +242,7 @@ func (t *Task) Update(ctx context.Context, resources *types.Any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Process returns a specific process inside the task by the process id
|
||||
func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) {
|
||||
// TODO: verify process exists for container
|
||||
return &Process{
|
||||
@@ -233,6 +251,7 @@ func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error)
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Metrics returns runtime specific system level metric information for the task
|
||||
func (t *Task) Metrics(ctx context.Context) (interface{}, error) {
|
||||
stats, err := t.cg.Stat(cgroups.IgnoreNotExist)
|
||||
if err != nil {
|
||||
@@ -241,10 +260,12 @@ func (t *Task) Metrics(ctx context.Context) (interface{}, error) {
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// Cgroup returns the underlying cgroup for a linux task
|
||||
func (t *Task) Cgroup() cgroups.Cgroup {
|
||||
return t.cg
|
||||
}
|
||||
|
||||
// Wait for the task to exit returning the status and timestamp
|
||||
func (t *Task) Wait(ctx context.Context) (*runtime.Exit, error) {
|
||||
r, err := t.shim.Wait(ctx, &shim.WaitRequest{
|
||||
ID: t.id,
|
||||
|
Reference in New Issue
Block a user