Move io.go into cio package

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
Daniel Nephin
2017-11-17 14:18:30 -05:00
parent bc063f263c
commit 298dabc6c2
13 changed files with 77 additions and 69 deletions

15
task.go
View File

@@ -14,6 +14,7 @@ import (
"github.com/containerd/containerd/api/services/tasks/v1"
"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/cio"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
@@ -123,7 +124,7 @@ type Task interface {
// Resume the execution of the task
Resume(context.Context) error
// Exec creates a new process inside the task
Exec(context.Context, string, *specs.Process, IOCreation) (Process, error)
Exec(context.Context, string, *specs.Process, cio.Creation) (Process, error)
// Pids returns a list of system specific process ids inside the task
Pids(context.Context) ([]ProcessInfo, error)
// Checkpoint serializes the runtime and memory information of a task into an
@@ -134,7 +135,7 @@ type Task interface {
// Update modifies executing tasks with updated settings
Update(context.Context, ...UpdateTaskOpts) error
// LoadProcess loads a previously created exec'd process
LoadProcess(context.Context, string, IOAttach) (Process, error)
LoadProcess(context.Context, string, cio.Attach) (Process, error)
// Metrics returns task metrics for runtime specific metrics
//
// The metric types are generic to containerd and change depending on the runtime
@@ -148,7 +149,7 @@ var _ = (Task)(&task{})
type task struct {
client *Client
io IO
io cio.IO
id string
pid uint32
@@ -279,7 +280,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
return &ExitStatus{code: r.ExitStatus, exitedAt: r.ExitedAt}, nil
}
func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) {
func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate cio.Creation) (Process, error) {
if id == "" {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "exec id must not be empty")
}
@@ -344,7 +345,7 @@ func (t *task) CloseIO(ctx context.Context, opts ...IOCloserOpts) error {
return errdefs.FromGRPC(err)
}
func (t *task) IO() IO {
func (t *task) IO() cio.IO {
return t.io
}
@@ -461,7 +462,7 @@ func (t *task) Update(ctx context.Context, opts ...UpdateTaskOpts) error {
return errdefs.FromGRPC(err)
}
func (t *task) LoadProcess(ctx context.Context, id string, ioAttach IOAttach) (Process, error) {
func (t *task) LoadProcess(ctx context.Context, id string, ioAttach cio.Attach) (Process, error) {
response, err := t.client.TaskService().Get(ctx, &tasks.GetRequest{
ContainerID: t.id,
ExecID: id,
@@ -473,7 +474,7 @@ func (t *task) LoadProcess(ctx context.Context, id string, ioAttach IOAttach) (P
}
return nil, err
}
var i IO
var i cio.IO
if ioAttach != nil {
if i, err = attachExistingIO(response, ioAttach); err != nil {
return nil, err