21700: Install Bundler system-wide in Rails postinst
[arvados.git] / lib / dispatchcloud / scheduler / interfaces.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package scheduler
6
7 import (
8         "time"
9
10         "git.arvados.org/arvados.git/lib/dispatchcloud/container"
11         "git.arvados.org/arvados.git/lib/dispatchcloud/worker"
12         "git.arvados.org/arvados.git/sdk/go/arvados"
13 )
14
15 // A ContainerQueue is a set of containers that need to be started or
16 // stopped. Implemented by container.Queue and test stubs. See
17 // container.Queue method documentation for details.
18 type ContainerQueue interface {
19         Entries() (entries map[string]container.QueueEnt, updated time.Time)
20         Lock(uuid string) error
21         Unlock(uuid string) error
22         Cancel(uuid string) error
23         Forget(uuid string)
24         Get(uuid string) (arvados.Container, bool)
25         Subscribe() <-chan struct{}
26         Unsubscribe(<-chan struct{})
27         Update() error
28 }
29
30 // A WorkerPool asynchronously starts and stops worker VMs, and starts
31 // and stops containers on them. Implemented by worker.Pool and test
32 // stubs. See worker.Pool method documentation for details.
33 type WorkerPool interface {
34         Running() map[string]time.Time
35         Unallocated() map[arvados.InstanceType]int
36         CountWorkers() map[worker.State]int
37         AtCapacity(arvados.InstanceType) bool
38         AtQuota() bool
39         Create(arvados.InstanceType) bool
40         Shutdown(arvados.InstanceType) bool
41         StartContainer(arvados.InstanceType, arvados.Container) bool
42         KillContainer(uuid, reason string) bool
43         ForgetContainer(uuid string)
44         Subscribe() <-chan struct{}
45         Unsubscribe(<-chan struct{})
46 }