Move Container and runtime to plugin pkg

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-05-11 15:24:12 -07:00
parent fa4e114979
commit 01b9f5ec67
10 changed files with 63 additions and 61 deletions

42
plugin/runtime.go Normal file
View File

@@ -0,0 +1,42 @@
package plugin
import (
"context"
"time"
"github.com/containerd/containerd"
)
type IO struct {
Stdin string
Stdout string
Stderr string
Terminal bool
}
type CreateOpts struct {
// Spec is the OCI runtime spec
Spec []byte
// Rootfs mounts to perform to gain access to the container's filesystem
Rootfs []containerd.Mount
// IO for the container's main process
IO IO
}
type Exit struct {
Status uint32
Timestamp time.Time
}
// Runtime is responsible for the creation of containers for a certain platform,
// arch, or custom usage.
type Runtime interface {
// Create creates a container with the provided id and options
Create(ctx context.Context, id string, opts CreateOpts) (Container, error)
// Containers returns all the current containers for the runtime
Containers(context.Context) ([]Container, error)
// Delete removes the container in the runtime
Delete(context.Context, Container) (*Exit, error)
// Events returns events for the runtime and all containers created by the runtime
Events(context.Context) <-chan *containerd.Event
}