From ceae112f7d94436ca0cb005e0f042ef40db43f09 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 15 May 2018 14:03:32 -0400 Subject: [PATCH] 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 --- linux/runtime.go | 2 +- runtime/runtime.go | 6 +++--- services/tasks/local.go | 8 ++++---- windows/runtime.go | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/linux/runtime.go b/linux/runtime.go index 083b07224..26dedbfa9 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -79,7 +79,7 @@ func init() { }) } -var _ = (runtime.Runtime)(&Runtime{}) +var _ = (runtime.PlatformRuntime)(&Runtime{}) // Config options for the runtime type Config struct { diff --git a/runtime/runtime.go b/runtime/runtime.go index 000af4ad3..0057c1a4e 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -53,9 +53,9 @@ type Exit struct { Timestamp time.Time } -// Runtime is responsible for the creation of containers for a certain platform, -// arch, or custom usage. -type Runtime interface { +// PlatformRuntime is responsible for the creation and management of +// tasks and processes for a platform. +type PlatformRuntime interface { // ID of the runtime ID() string // Create creates a task with the provided id and options. diff --git a/services/tasks/local.go b/services/tasks/local.go index 3f99b8e23..1de7a4aa2 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -79,14 +79,14 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) { return nil, err } cs := m.(*metadata.DB).ContentStore() - runtimes := make(map[string]runtime.Runtime) + runtimes := make(map[string]runtime.PlatformRuntime) for _, rr := range rt { ri, err := rr.Instance() if err != nil { log.G(ic.Context).WithError(err).Warn("could not load runtime instance due to initialization error") continue } - r := ri.(runtime.Runtime) + r := ri.(runtime.PlatformRuntime) runtimes[r.ID()] = r } @@ -102,7 +102,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) { } type local struct { - runtimes map[string]runtime.Runtime + runtimes map[string]runtime.PlatformRuntime db *metadata.DB store content.Store publisher events.Publisher @@ -625,7 +625,7 @@ func (l *local) getTaskFromContainer(ctx context.Context, container *containers. 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] if !ok { return nil, status.Errorf(codes.NotFound, "unknown runtime %q", name) diff --git a/windows/runtime.go b/windows/runtime.go index 44306d7b8..59edf55f2 100644 --- a/windows/runtime.go +++ b/windows/runtime.go @@ -53,7 +53,7 @@ var ( pluginID = fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtimeName) ) -var _ = (runtime.Runtime)(&windowsRuntime{}) +var _ = (runtime.PlatformRuntime)(&windowsRuntime{}) func init() { plugin.Register(&plugin.Registration{