open-nomad/client/interfaces/client.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.2 KiB
Go
Raw Normal View History

2018-07-19 00:06:44 +00:00
package interfaces
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
}
// 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.
AllocStateUpdated(alloc *structs.Allocation)
// PutAllocation is used to persist an updated allocation in the local state store.
PutAllocation(*structs.Allocation) error
2018-07-19 00:06:44 +00:00
}
// DeviceStatsReporter gives access to the latest resource usage
// for devices
type DeviceStatsReporter interface {
LatestDeviceResourceStats([]*structs.AllocatedDeviceResource) []*device.DeviceGroupStats
}
// EnvReplacer is an interface which can interpolate environment variables and
// is usually satisfied by taskenv.TaskEnv.
type EnvReplacer interface {
ReplaceEnv(string) string
ClientPath(string, bool) (string, bool)
}
// ArtifactGetter is an interface satisfied by the getter package.
type ArtifactGetter interface {
// Get artifact and put it in the task directory.
Get(taskEnv EnvReplacer, artifact *structs.TaskArtifact) error
}