Rename cio.Creation to cio.Creator
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
3146019918
commit
a901091f7c
10
cio/io.go
10
cio/io.go
@ -33,8 +33,8 @@ type IO interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// Creation creates new IO sets for a task
|
||||
type Creation func(id string) (IO, error)
|
||||
// Creator creates new IO sets for a task
|
||||
type Creator func(id string) (IO, error)
|
||||
|
||||
// Attach allows callers to reattach to running tasks
|
||||
//
|
||||
@ -61,13 +61,13 @@ func NewFIFOSet(config Config, close func() error) *FIFOSet {
|
||||
return &FIFOSet{Config: config, close: close}
|
||||
}
|
||||
|
||||
// NewIO returns an Creation that will provide IO sets without a terminal
|
||||
func NewIO(stdin io.Reader, stdout, stderr io.Writer) Creation {
|
||||
// NewIO returns an Creator that will provide IO sets without a terminal
|
||||
func NewIO(stdin io.Reader, stdout, stderr io.Writer) Creator {
|
||||
return NewIOWithTerminal(stdin, stdout, stderr, false)
|
||||
}
|
||||
|
||||
// NewIOWithTerminal creates a new io set with the provided io.Reader/Writers for use with a terminal
|
||||
func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) Creation {
|
||||
func NewIOWithTerminal(stdin io.Reader, stdout, stderr io.Writer, terminal bool) Creator {
|
||||
return func(id string) (IO, error) {
|
||||
fifos, err := newFIFOSetInTempDir(id)
|
||||
if err != nil {
|
||||
|
@ -27,7 +27,7 @@ type Container interface {
|
||||
// Delete removes the container
|
||||
Delete(context.Context, ...DeleteOpts) error
|
||||
// NewTask creates a new task based on the container metadata
|
||||
NewTask(context.Context, cio.Creation, ...NewTaskOpts) (Task, error)
|
||||
NewTask(context.Context, cio.Creator, ...NewTaskOpts) (Task, error)
|
||||
// Spec returns the OCI runtime specification
|
||||
Spec(context.Context) (*specs.Spec, error)
|
||||
// Task returns the current task for the container
|
||||
@ -163,7 +163,7 @@ func (c *container) Image(ctx context.Context) (Image, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *container) NewTask(ctx context.Context, ioCreate cio.Creation, opts ...NewTaskOpts) (_ Task, err error) {
|
||||
func (c *container) NewTask(ctx context.Context, ioCreate cio.Creator, opts ...NewTaskOpts) (_ Task, err error) {
|
||||
i, err := ioCreate(c.id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
gogotypes "github.com/gogo/protobuf/types"
|
||||
)
|
||||
|
||||
func empty() cio.Creation {
|
||||
func empty() cio.Creator {
|
||||
// TODO (@mlaventure) windows searches for pipes
|
||||
// when none are provided
|
||||
if runtime.GOOS == "windows" {
|
||||
|
4
task.go
4
task.go
@ -123,7 +123,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, cio.Creation) (Process, error)
|
||||
Exec(context.Context, string, *specs.Process, cio.Creator) (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
|
||||
@ -278,7 +278,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 cio.Creation) (_ Process, err error) {
|
||||
func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate cio.Creator) (_ Process, err error) {
|
||||
if id == "" {
|
||||
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "exec id must not be empty")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user