Add variable names to runtime's interface definitions

To ease code readability

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2021-04-15 12:03:13 -07:00
parent 993b863993
commit b83d04f910
2 changed files with 22 additions and 22 deletions

View File

@ -63,14 +63,14 @@ type PlatformRuntime interface {
// ID of the runtime // ID of the runtime
ID() string ID() string
// Create creates a task with the provided id and options. // 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 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. // Tasks returns all the current tasks for the runtime.
// Any container runs at most one task at a time. // 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 adds a task into runtime.
Add(context.Context, Task) error Add(ctx context.Context, task Task) error
// Delete remove a task. // Delete remove a task.
Delete(context.Context, string) Delete(ctx context.Context, taskID string)
} }

View File

@ -36,19 +36,19 @@ type Process interface {
// ID of the process // ID of the process
ID() string ID() string
// State returns the process state // State returns the process state
State(context.Context) (State, error) State(ctx context.Context) (State, error)
// Kill signals a container // Kill signals a container
Kill(context.Context, uint32, bool) error Kill(ctx context.Context, signal uint32, all bool) error
// Pty resizes the processes pty/console // ResizePty resizes the processes pty/console
ResizePty(context.Context, ConsoleSize) error ResizePty(ctx context.Context, size ConsoleSize) error
// CloseStdin closes the processes stdin // CloseIO closes the processes IO
CloseIO(context.Context) error CloseIO(ctx context.Context) error
// Start the container's user defined process // Start the container's user defined process
Start(context.Context) error Start(ctx context.Context) error
// Wait for the process to exit // Wait for the process to exit
Wait(context.Context) (*Exit, error) Wait(ctx context.Context) (*Exit, error)
// Delete deletes the process // Delete deletes the process
Delete(context.Context) (*Exit, error) Delete(ctx context.Context) (*Exit, error)
} }
// Task is the runtime object for an executing container // Task is the runtime object for an executing container
@ -60,21 +60,21 @@ type Task interface {
// Namespace that the task exists in // Namespace that the task exists in
Namespace() string Namespace() string
// Pause pauses the container process // Pause pauses the container process
Pause(context.Context) error Pause(ctx context.Context) error
// Resume unpauses the container process // Resume unpauses the container process
Resume(context.Context) error Resume(ctx context.Context) error
// Exec adds a process into the container // 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 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 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 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 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 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 // ExecOpts provides additional options for additional processes running in a task