findProc returns a vmProc if exists. The function itself doesn't lock the manager's mutex. The callers are responsible to lock/unlock since they may mutate the value.
(taskID, execID string)
| 326 | // findProc returns a vmProc if exists. The function itself doesn't lock the manager's mutex. |
| 327 | // The callers are responsible to lock/unlock since they may mutate the value. |
| 328 | func (m *taskManager) findProc(taskID, execID string) (*vmProc, error) { |
| 329 | _, ok := m.tasks[taskID] |
| 330 | if !ok { |
| 331 | return nil, fmt.Errorf("cannot find exec %q from non-existent task %q", execID, taskID) |
| 332 | } |
| 333 | |
| 334 | proc, ok := m.tasks[taskID][execID] |
| 335 | if !ok { |
| 336 | return nil, fmt.Errorf("cannot find non-existent exec %q from task %q", execID, taskID) |
| 337 | } |
| 338 | |
| 339 | if proc.proxy == nil { |
| 340 | return nil, fmt.Errorf("exec %q and task %q are present, but no proxy", taskID, execID) |
| 341 | } |
| 342 | return proc, nil |
| 343 | } |
| 344 | |
| 345 | func (m *taskManager) AttachIO(_ context.Context, taskID, execID string, proxy IOProxy) error { |
| 346 | m.mu.Lock() |
no outgoing calls
no test coverage detected