Merge pull request #2899 from fuweid/proposal-add-Add-method-in-PlatformRuntime

runtime: add Add/Delete method in PlatformRuntime interface
This commit is contained in:
Michael Crosby
2019-01-22 13:48:39 -05:00
committed by GitHub
4 changed files with 32 additions and 0 deletions

View File

@@ -309,6 +309,16 @@ func (r *Runtime) Get(ctx context.Context, id string) (runtime.Task, error) {
return r.tasks.Get(ctx, id)
}
// Add a runtime task
func (r *Runtime) Add(ctx context.Context, task runtime.Task) error {
return r.tasks.Add(ctx, task)
}
// Delete a runtime task
func (r *Runtime) Delete(ctx context.Context, id string) {
r.tasks.Delete(ctx, id)
}
func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
dir, err := ioutil.ReadDir(filepath.Join(r.state, ns))
if err != nil {