2018-07-19 00:06:44 +00:00
|
|
|
package interfaces
|
|
|
|
|
2018-11-15 15:13:14 +00:00
|
|
|
import (
|
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
"github.com/hashicorp/nomad/plugins/device"
|
|
|
|
)
|
2018-07-19 00:06:44 +00:00
|
|
|
|
|
|
|
type Client interface {
|
|
|
|
AllocStateHandler
|
|
|
|
}
|
|
|
|
|
2022-01-10 16:59:46 +00:00
|
|
|
// AllocStateHandler exposes a handler to be called when an allocation's state changes
|
2018-07-19 00:06:44 +00:00
|
|
|
type AllocStateHandler interface {
|
|
|
|
// AllocStateUpdated is used to emit an updated allocation. This allocation
|
|
|
|
// is stripped to only include client settable fields.
|
2018-08-17 17:34:44 +00:00
|
|
|
AllocStateUpdated(alloc *structs.Allocation)
|
2018-07-19 00:06:44 +00:00
|
|
|
}
|
2018-11-15 15:13:14 +00:00
|
|
|
|
|
|
|
// DeviceStatsReporter gives access to the latest resource usage
|
|
|
|
// for devices
|
|
|
|
type DeviceStatsReporter interface {
|
|
|
|
LatestDeviceResourceStats([]*structs.AllocatedDeviceResource) []*device.DeviceGroupStats
|
|
|
|
}
|