Remove tasks map from service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-08 16:34:52 -07:00
parent 3c4e2a36dc
commit 745398b2e9
6 changed files with 58 additions and 57 deletions

View File

@@ -34,7 +34,6 @@ func init() {
}
func New(ic *plugin.InitContext) (interface{}, error) {
rootDir := filepath.Join(ic.Root, runtimeName)
if err := os.MkdirAll(rootDir, 0755); err != nil {
return nil, errors.Wrapf(err, "could not create state directory at %s", rootDir)
@@ -152,10 +151,19 @@ func (r *Runtime) Tasks(ctx context.Context) ([]plugin.Task, error) {
list = append(list, c)
}
}
return list, nil
}
func (r *Runtime) Get(ctx context.Context, id string) (plugin.Task, error) {
r.Lock()
defer r.Unlock()
c, ok := r.containers[id]
if !ok {
return fmt.Errorf("container %s does not exit", id)
}
return c, nil
}
func (r *Runtime) Events(ctx context.Context) <-chan *plugin.Event {
return r.events
}