open-nomad/plugins/drivers/cstructs.go
Mahmood Ali 64f80343fc drivers: re-export ResourceUsage structs
Re-export the ResourceUsage structs in drivers package to avoid drivers
directly depending on the internal client/structs package directly.

I attempted moving the structs to drivers, but that caused some import
cycles that was a bit hard to disentagle.  Alternatively, I added an
alias here that's sufficient for our purposes of avoiding external
drivers depend on internal packages, while allowing us to restructure
packages in future without breaking source compatibility.
2019-01-08 09:11:47 -05:00

30 lines
1,011 B
Go

package drivers
import (
cstructs "github.com/hashicorp/nomad/client/structs"
)
// This files present an indirection layer to client structs used by drivers,
// and represent the public interface for drivers, as client interfaces are
// internal and subject to change.
// MemoryStats holds memory usage related stats
type MemoryStats = cstructs.MemoryStats
// CpuStats holds cpu usage related stats
type CpuStats = cstructs.CpuStats
// ResourceUsage holds information related to cpu and memory stats
type ResourceUsage = cstructs.ResourceUsage
// TaskResourceUsage holds aggregated resource usage of all processes in a Task
// and the resource usage of the individual pids
type TaskResourceUsage = cstructs.TaskResourceUsage
// CheckBufSize is the size of the buffer that is used for job output
const CheckBufSize = cstructs.CheckBufSize
// DriverStatsNotImplemented is the error to be returned if a driver doesn't
// implement stats.
var DriverStatsNotImplemented = cstructs.DriverStatsNotImplemented