-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
runner.go
34 lines (27 loc) · 912 Bytes
/
runner.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package interfaces
import (
"github.com/hashicorp/nomad/client/allocrunner/state"
cstructs "github.com/hashicorp/nomad/client/structs"
)
// AllocRunner is the interface for an allocation runner.
type AllocRunner interface {
// ID returns the ID of the allocation being run.
ID() string
// Run starts the runner and begins executing all the tasks as part of the
// allocation.
Run()
// State returns a copy of the runners state object
State() *state.State
TaskStateHandler
}
// TaskStateHandler exposes a handler to be called when a task's state changes
type TaskStateHandler interface {
// TaskStateUpdated is used to notify the alloc runner about task state
// changes.
TaskStateUpdated()
}
// AllocStatsReporter gives access to the latest resource usage from the
// allocation
type AllocStatsReporter interface {
LatestAllocStats(taskFilter string) (*cstructs.AllocResourceUsage, error)
}