1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
10 "git.curoverse.com/arvados.git/lib/dispatchcloud/container"
11 "git.curoverse.com/arvados.git/lib/dispatchcloud/worker"
12 "git.curoverse.com/arvados.git/sdk/go/arvados"
15 // A ContainerQueue is a set of containers that need to be started or
16 // stopped. Implemented by container.Queue and test stubs.
17 type ContainerQueue interface {
18 Entries() (entries map[string]container.QueueEnt, updated time.Time)
19 Lock(uuid string) error
20 Unlock(uuid string) error
21 Cancel(uuid string) error
23 Get(uuid string) (arvados.Container, bool)
24 Subscribe() <-chan struct{}
25 Unsubscribe(<-chan struct{})
29 // A WorkerPool asynchronously starts and stops worker VMs, and starts
30 // and stops containers on them. Implemented by worker.Pool and test
32 type WorkerPool interface {
33 Running() map[string]time.Time
34 Unallocated() map[arvados.InstanceType]int
35 CountWorkers() map[worker.State]int
37 Create(arvados.InstanceType) error
38 Shutdown(arvados.InstanceType) bool
39 StartContainer(arvados.InstanceType, arvados.Container) bool
40 KillContainer(uuid string)
41 Subscribe() <-chan struct{}
42 Unsubscribe(<-chan struct{})