github.com/dims/containerd@v0.2.5/supervisor/task.go (about) 1 package supervisor 2 3 import ( 4 "sync" 5 6 "github.com/docker/containerd/runtime" 7 ) 8 9 // StartResponse is the response containing a started container 10 type StartResponse struct { 11 Container runtime.Container 12 } 13 14 // Task executes an action returning an error chan with either nil or 15 // the error from executing the task 16 type Task interface { 17 // ErrorCh returns a channel used to report and error from an async task 18 ErrorCh() chan error 19 } 20 21 type baseTask struct { 22 errCh chan error 23 mu sync.Mutex 24 } 25 26 func (t *baseTask) ErrorCh() chan error { 27 t.mu.Lock() 28 defer t.mu.Unlock() 29 if t.errCh == nil { 30 t.errCh = make(chan error, 1) 31 } 32 return t.errCh 33 }