From b83d04f9105c9663db62b76d990e7bd233f5ad6d Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Thu, 15 Apr 2021 12:03:13 -0700 Subject: [PATCH] Add variable names to runtime's interface definitions To ease code readability Signed-off-by: Maksym Pavlenko --- runtime/runtime.go | 10 +++++----- runtime/task.go | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/runtime/runtime.go b/runtime/runtime.go index 5a3f654bd..3d758fb97 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -63,14 +63,14 @@ type PlatformRuntime interface { // ID of the runtime ID() string // Create creates a task with the provided id and options. - Create(ctx context.Context, id string, opts CreateOpts) (Task, error) + Create(ctx context.Context, taskID string, opts CreateOpts) (Task, error) // Get returns a task. - Get(context.Context, string) (Task, error) + Get(ctx context.Context, taskID string) (Task, error) // Tasks returns all the current tasks for the runtime. // Any container runs at most one task at a time. - Tasks(context.Context, bool) ([]Task, error) + Tasks(ctx context.Context, all bool) ([]Task, error) // Add adds a task into runtime. - Add(context.Context, Task) error + Add(ctx context.Context, task Task) error // Delete remove a task. - Delete(context.Context, string) + Delete(ctx context.Context, taskID string) } diff --git a/runtime/task.go b/runtime/task.go index 7078a6d97..c9876ed4a 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -36,19 +36,19 @@ type Process interface { // ID of the process ID() string // State returns the process state - State(context.Context) (State, error) + State(ctx context.Context) (State, error) // Kill signals a container - Kill(context.Context, uint32, bool) error - // Pty resizes the processes pty/console - ResizePty(context.Context, ConsoleSize) error - // CloseStdin closes the processes stdin - CloseIO(context.Context) error + Kill(ctx context.Context, signal uint32, all bool) error + // ResizePty resizes the processes pty/console + ResizePty(ctx context.Context, size ConsoleSize) error + // CloseIO closes the processes IO + CloseIO(ctx context.Context) error // Start the container's user defined process - Start(context.Context) error + Start(ctx context.Context) error // Wait for the process to exit - Wait(context.Context) (*Exit, error) + Wait(ctx context.Context) (*Exit, error) // Delete deletes the process - Delete(context.Context) (*Exit, error) + Delete(ctx context.Context) (*Exit, error) } // Task is the runtime object for an executing container @@ -60,21 +60,21 @@ type Task interface { // Namespace that the task exists in Namespace() string // Pause pauses the container process - Pause(context.Context) error + Pause(ctx context.Context) error // Resume unpauses the container process - Resume(context.Context) error + Resume(ctx context.Context) error // Exec adds a process into the container - Exec(context.Context, string, ExecOpts) (Process, error) + Exec(ctx context.Context, id string, opts ExecOpts) (Process, error) // Pids returns all pids - Pids(context.Context) ([]ProcessInfo, error) + Pids(ctx context.Context) ([]ProcessInfo, error) // Checkpoint checkpoints a container to an image with live system data - Checkpoint(context.Context, string, *types.Any) error + Checkpoint(ctx context.Context, path string, opts *types.Any) error // Update sets the provided resources to a running task - Update(context.Context, *types.Any, map[string]string) error + Update(ctx context.Context, resources *types.Any, annotations map[string]string) error // Process returns a process within the task for the provided id - Process(context.Context, string) (Process, error) + Process(ctx context.Context, id string) (Process, error) // Stats returns runtime specific metrics for a task - Stats(context.Context) (*types.Any, error) + Stats(ctx context.Context) (*types.Any, error) } // ExecOpts provides additional options for additional processes running in a task