(taskID, execID string)
| 107 | } |
| 108 | |
| 109 | func (m *taskManager) newProc(taskID, execID string) (*vmProc, error) { |
| 110 | m.mu.Lock() |
| 111 | defer m.mu.Unlock() |
| 112 | |
| 113 | if m.isShutdown { |
| 114 | return nil, fmt.Errorf("cannot create new exec %q in task %q after shutdown", execID, taskID) |
| 115 | } |
| 116 | |
| 117 | _, taskExists := m.tasks[taskID] |
| 118 | if !taskExists { |
| 119 | if execID != "" { |
| 120 | return nil, fmt.Errorf("cannot add exec %q to non-existent task %q", execID, taskID) |
| 121 | } |
| 122 | |
| 123 | m.tasks[taskID] = make(map[string]*vmProc) |
| 124 | } |
| 125 | |
| 126 | _, procExists := m.tasks[taskID][execID] |
| 127 | if procExists { |
| 128 | return nil, status.Errorf(codes.AlreadyExists, "exec %q already exists", execID) |
| 129 | } |
| 130 | |
| 131 | proc := &vmProc{} |
| 132 | proc.taskID = taskID |
| 133 | proc.execID = execID |
| 134 | proc.logger = m.logger.WithField("TaskID", taskID).WithField("ExecID", execID) |
| 135 | proc.ctx, proc.cancel = context.WithCancel(m.shimCtx) |
| 136 | |
| 137 | m.tasks[taskID][execID] = proc |
| 138 | return proc, nil |
| 139 | } |
| 140 | |
| 141 | func (m *taskManager) deleteProc(taskID, execID string) (*vmProc, error) { |
| 142 | m.mu.Lock() |
no outgoing calls
no test coverage detected