Rename Runtime to PlatformRuntime

This renames the runtime interface to PlatformRuntime to denote the
layer at which the runtime is being abstracted.  This should be used to
abstract different platforms that vary greatly and do not have full
compat with OCI based binary runtimes.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2018-05-15 14:03:32 -04:00
parent 257d74f837
commit ceae112f7d
4 changed files with 9 additions and 9 deletions

View File

@ -79,7 +79,7 @@ func init() {
}) })
} }
var _ = (runtime.Runtime)(&Runtime{}) var _ = (runtime.PlatformRuntime)(&Runtime{})
// Config options for the runtime // Config options for the runtime
type Config struct { type Config struct {

View File

@ -53,9 +53,9 @@ type Exit struct {
Timestamp time.Time Timestamp time.Time
} }
// Runtime is responsible for the creation of containers for a certain platform, // PlatformRuntime is responsible for the creation and management of
// arch, or custom usage. // tasks and processes for a platform.
type Runtime interface { 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.

View File

@ -79,14 +79,14 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
return nil, err return nil, err
} }
cs := m.(*metadata.DB).ContentStore() cs := m.(*metadata.DB).ContentStore()
runtimes := make(map[string]runtime.Runtime) runtimes := make(map[string]runtime.PlatformRuntime)
for _, rr := range rt { for _, rr := range rt {
ri, err := rr.Instance() ri, err := rr.Instance()
if err != nil { if err != nil {
log.G(ic.Context).WithError(err).Warn("could not load runtime instance due to initialization error") log.G(ic.Context).WithError(err).Warn("could not load runtime instance due to initialization error")
continue continue
} }
r := ri.(runtime.Runtime) r := ri.(runtime.PlatformRuntime)
runtimes[r.ID()] = r runtimes[r.ID()] = r
} }
@ -102,7 +102,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
} }
type local struct { type local struct {
runtimes map[string]runtime.Runtime runtimes map[string]runtime.PlatformRuntime
db *metadata.DB db *metadata.DB
store content.Store store content.Store
publisher events.Publisher publisher events.Publisher
@ -625,7 +625,7 @@ func (l *local) getTaskFromContainer(ctx context.Context, container *containers.
return t, nil return t, nil
} }
func (l *local) getRuntime(name string) (runtime.Runtime, error) { func (l *local) getRuntime(name string) (runtime.PlatformRuntime, error) {
runtime, ok := l.runtimes[name] runtime, ok := l.runtimes[name]
if !ok { if !ok {
return nil, status.Errorf(codes.NotFound, "unknown runtime %q", name) return nil, status.Errorf(codes.NotFound, "unknown runtime %q", name)

View File

@ -53,7 +53,7 @@ var (
pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtimeName) pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtimeName)
) )
var _ = (runtime.Runtime)(&windowsRuntime{}) var _ = (runtime.PlatformRuntime)(&windowsRuntime{})
func init() { func init() {
plugin.Register(&plugin.Registration{ plugin.Register(&plugin.Registration{