structs

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2019 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CheckBufSize = 4 * 1024

CheckBufSize is the size of the buffer that is used for job output

Variables

View Source
var DriverStatsNotImplemented = errors.New("stats not implemented for driver")

DriverStatsNotImplemented is the error to be returned if a driver doesn't implement stats.

View Source
var ErrAllocBroadcasterClosed = errors.New("alloc broadcaster closed")

Functions

This section is empty.

Types

type AllocBroadcaster added in v0.6.0

type AllocBroadcaster struct {
	// contains filtered or unexported fields
}

AllocBroadcaster implements an allocation broadcast channel where each listener receives allocation updates. Pending updates are dropped and replaced by newer allocation updates, so listeners may not receive every allocation update. However this ensures Sends never block and listeners only receive the latest allocation update -- never a stale version.

func NewAllocBroadcaster added in v0.6.0

func NewAllocBroadcaster(l hclog.Logger) *AllocBroadcaster

NewAllocBroadcaster returns a new AllocBroadcaster.

func (*AllocBroadcaster) Close added in v0.6.0

func (b *AllocBroadcaster) Close()

Close closes the channel, disabling the sending of further allocation updates. Pending updates are still received by listeners. Safe to call concurrently and more than once.

func (*AllocBroadcaster) Listen added in v0.6.0

func (b *AllocBroadcaster) Listen() *AllocListener

Listen returns a Listener for the broadcast channel. New listeners receive the last sent alloc update.

func (*AllocBroadcaster) Send added in v0.6.0

Send broadcasts an allocation update. Any pending updates are replaced with this version of the allocation to prevent blocking on slow receivers. Returns ErrAllocBroadcasterClosed if called after broadcaster is closed.

type AllocExecRequest added in v0.9.2

type AllocExecRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Task is the task to stream logs from
	Task string

	// Tty indicates whether to allocate a pseudo-TTY
	Tty bool

	// Cmd is the command to be executed
	Cmd []string

	structs.QueryOptions
}

AllocExecRequest is the initial request for execing into an Alloc task

func (*AllocExecRequest) CodecDecodeSelf added in v0.9.2

func (x *AllocExecRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocExecRequest) CodecEncodeSelf added in v0.9.2

func (x *AllocExecRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocFileInfo added in v0.8.0

type AllocFileInfo struct {
	Name        string
	IsDir       bool
	Size        int64
	FileMode    string
	ModTime     time.Time
	ContentType string `json:",omitempty"`
}

AllocFileInfo holds information about a file inside the AllocDir

func (*AllocFileInfo) CodecDecodeSelf added in v0.8.0

func (x *AllocFileInfo) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocFileInfo) CodecEncodeSelf added in v0.8.0

func (x *AllocFileInfo) CodecEncodeSelf(e *codec1978.Encoder)

type AllocListener added in v0.6.0

type AllocListener struct {
	// contains filtered or unexported fields
}

AllocListener implements a listening endpoint for an allocation broadcast channel.

func (*AllocListener) Ch added in v0.6.0

func (l *AllocListener) Ch() <-chan *structs.Allocation

func (*AllocListener) Close added in v0.6.0

func (l *AllocListener) Close()

Close closes the Listener, disabling the receival of further messages. Safe to call more than once and concurrently with receiving on Ch.

type AllocResourceUsage

type AllocResourceUsage struct {
	// ResourceUsage is the summation of the task resources
	ResourceUsage *ResourceUsage

	// Tasks contains the resource usage of each task
	Tasks map[string]*TaskResourceUsage

	// The max timestamp of all the Tasks
	Timestamp int64
}

AllocResourceUsage holds the aggregated task resource usage of the allocation.

func (*AllocResourceUsage) CodecDecodeSelf added in v0.8.0

func (x *AllocResourceUsage) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocResourceUsage) CodecEncodeSelf added in v0.8.0

func (x *AllocResourceUsage) CodecEncodeSelf(e *codec1978.Encoder)

type AllocStatsRequest added in v0.8.0

type AllocStatsRequest struct {
	// AllocID is the allocation to retrieves stats for
	AllocID string

	// Task is an optional filter to only request stats for the task.
	Task string

	structs.QueryOptions
}

AllocStatsRequest is used to request the resource usage of a given allocation, potentially filtering by task

func (*AllocStatsRequest) CodecDecodeSelf added in v0.8.0

func (x *AllocStatsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocStatsRequest) CodecEncodeSelf added in v0.8.0

func (x *AllocStatsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocStatsResponse added in v0.8.0

type AllocStatsResponse struct {
	Stats *AllocResourceUsage
	structs.QueryMeta
}

AllocStatsResponse is used to return the resource usage of a given allocation.

func (*AllocStatsResponse) CodecDecodeSelf added in v0.8.0

func (x *AllocStatsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocStatsResponse) CodecEncodeSelf added in v0.8.0

func (x *AllocStatsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ClientStatsResponse added in v0.8.0

type ClientStatsResponse struct {
	HostStats *stats.HostStats
	structs.QueryMeta
}

ClientStatsResponse is used to return statistics about a node.

func (*ClientStatsResponse) CodecDecodeSelf added in v0.8.0

func (x *ClientStatsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ClientStatsResponse) CodecEncodeSelf added in v0.8.0

func (x *ClientStatsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type CpuStats

type CpuStats struct {
	SystemMode       float64
	UserMode         float64
	TotalTicks       float64
	ThrottledPeriods uint64
	ThrottledTime    uint64
	Percent          float64

	// A list of fields whose values were actually sampled
	Measured []string
}

CpuStats holds cpu usage related stats

func (*CpuStats) Add

func (cs *CpuStats) Add(other *CpuStats)

func (*CpuStats) CodecDecodeSelf added in v0.8.0

func (x *CpuStats) CodecDecodeSelf(d *codec1978.Decoder)

func (*CpuStats) CodecEncodeSelf added in v0.8.0

func (x *CpuStats) CodecEncodeSelf(e *codec1978.Encoder)

type FsListRequest added in v0.8.0

type FsListRequest struct {
	// AllocID is the allocation to list from
	AllocID string

	// Path is the path to list
	Path string

	structs.QueryOptions
}

FsListRequest is used to list an allocation's directory.

func (*FsListRequest) CodecDecodeSelf added in v0.8.0

func (x *FsListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsListRequest) CodecEncodeSelf added in v0.8.0

func (x *FsListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type FsListResponse added in v0.8.0

type FsListResponse struct {
	// Files are the result of listing a directory.
	Files []*AllocFileInfo

	structs.QueryMeta
}

FsListResponse is used to return the listings of an allocation's directory.

func (*FsListResponse) CodecDecodeSelf added in v0.8.0

func (x *FsListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsListResponse) CodecEncodeSelf added in v0.8.0

func (x *FsListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type FsLogsRequest added in v0.8.0

type FsLogsRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Task is the task to stream logs from
	Task string

	// LogType indicates whether "stderr" or "stdout" should be streamed
	LogType string

	// Offset is the offset to start streaming data at.
	Offset int64

	// Origin can either be "start" or "end" and determines where the offset is
	// applied.
	Origin string

	// PlainText disables base64 encoding.
	PlainText bool

	// Follow follows logs.
	Follow bool

	structs.QueryOptions
}

FsLogsRequest is the initial request for accessing allocation logs.

func (*FsLogsRequest) CodecDecodeSelf added in v0.8.0

func (x *FsLogsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsLogsRequest) CodecEncodeSelf added in v0.8.0

func (x *FsLogsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type FsStatRequest added in v0.8.0

type FsStatRequest struct {
	// AllocID is the allocation to stat the file in
	AllocID string

	// Path is the path to list
	Path string

	structs.QueryOptions
}

FsStatRequest is used to stat a file

func (*FsStatRequest) CodecDecodeSelf added in v0.8.0

func (x *FsStatRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsStatRequest) CodecEncodeSelf added in v0.8.0

func (x *FsStatRequest) CodecEncodeSelf(e *codec1978.Encoder)

type FsStatResponse added in v0.8.0

type FsStatResponse struct {
	// Info is the result of stating a file
	Info *AllocFileInfo

	structs.QueryMeta
}

FsStatResponse is used to return the stat results of a file

func (*FsStatResponse) CodecDecodeSelf added in v0.8.0

func (x *FsStatResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsStatResponse) CodecEncodeSelf added in v0.8.0

func (x *FsStatResponse) CodecEncodeSelf(e *codec1978.Encoder)

type FsStreamRequest added in v0.8.0

type FsStreamRequest struct {
	// AllocID is the allocation to stream logs from
	AllocID string

	// Path is the path to the file to stream
	Path string

	// Offset is the offset to start streaming data at.
	Offset int64

	// Origin can either be "start" or "end" and determines where the offset is
	// applied.
	Origin string

	// PlainText disables base64 encoding.
	PlainText bool

	// Limit is the number of bytes to read
	Limit int64

	// Follow follows the file.
	Follow bool

	structs.QueryOptions
}

FsStreamRequest is the initial request for streaming the content of a file.

func (*FsStreamRequest) CodecDecodeSelf added in v0.8.0

func (x *FsStreamRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*FsStreamRequest) CodecEncodeSelf added in v0.8.0

func (x *FsStreamRequest) CodecEncodeSelf(e *codec1978.Encoder)

type HealthCheckIntervalRequest added in v0.8.0

type HealthCheckIntervalRequest struct{}

func (*HealthCheckIntervalRequest) CodecDecodeSelf added in v0.8.0

func (x *HealthCheckIntervalRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*HealthCheckIntervalRequest) CodecEncodeSelf added in v0.8.0

func (x *HealthCheckIntervalRequest) CodecEncodeSelf(e *codec1978.Encoder)

type HealthCheckIntervalResponse added in v0.8.0

type HealthCheckIntervalResponse struct {
	Eligible bool
	Period   time.Duration
}

func (*HealthCheckIntervalResponse) CodecDecodeSelf added in v0.8.0

func (x *HealthCheckIntervalResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*HealthCheckIntervalResponse) CodecEncodeSelf added in v0.8.0

func (x *HealthCheckIntervalResponse) CodecEncodeSelf(e *codec1978.Encoder)

type HealthCheckRequest added in v0.8.0

type HealthCheckRequest struct{}

HealthCheckRequest is the request type for a type that fulfils the Health Check interface

func (*HealthCheckRequest) CodecDecodeSelf added in v0.8.0

func (x *HealthCheckRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*HealthCheckRequest) CodecEncodeSelf added in v0.8.0

func (x *HealthCheckRequest) CodecEncodeSelf(e *codec1978.Encoder)

type HealthCheckResponse added in v0.8.0

type HealthCheckResponse struct {
	// Drivers is a map of driver names to current driver information
	Drivers map[string]*structs.DriverInfo
}

HealthCheckResponse is the response type for a type that fulfills the Health Check interface

func (*HealthCheckResponse) AddDriverInfo added in v0.8.0

func (h *HealthCheckResponse) AddDriverInfo(name string, driverInfo *structs.DriverInfo)

AddDriverInfo adds information about a driver to the fingerprint response. If the Drivers field has not yet been initialized, it does so here.

func (*HealthCheckResponse) CodecDecodeSelf added in v0.8.0

func (x *HealthCheckResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*HealthCheckResponse) CodecEncodeSelf added in v0.8.0

func (x *HealthCheckResponse) CodecEncodeSelf(e *codec1978.Encoder)

type MemoryStats

type MemoryStats struct {
	RSS            uint64
	Cache          uint64
	Swap           uint64
	Usage          uint64
	MaxUsage       uint64
	KernelUsage    uint64
	KernelMaxUsage uint64

	// A list of fields whose values were actually sampled
	Measured []string
}

MemoryStats holds memory usage related stats

func (*MemoryStats) Add

func (ms *MemoryStats) Add(other *MemoryStats)

func (*MemoryStats) CodecDecodeSelf added in v0.8.0

func (x *MemoryStats) CodecDecodeSelf(d *codec1978.Decoder)

func (*MemoryStats) CodecEncodeSelf added in v0.8.0

func (x *MemoryStats) CodecEncodeSelf(e *codec1978.Encoder)

type ResourceUsage

type ResourceUsage struct {
	MemoryStats *MemoryStats
	CpuStats    *CpuStats
	DeviceStats []*device.DeviceGroupStats
}

ResourceUsage holds information related to cpu and memory stats

func (*ResourceUsage) Add

func (ru *ResourceUsage) Add(other *ResourceUsage)

func (*ResourceUsage) CodecDecodeSelf added in v0.8.0

func (x *ResourceUsage) CodecDecodeSelf(d *codec1978.Decoder)

func (*ResourceUsage) CodecEncodeSelf added in v0.8.0

func (x *ResourceUsage) CodecEncodeSelf(e *codec1978.Encoder)

type RpcError added in v0.8.0

type RpcError struct {
	Message string
	Code    *int64
}

RpcError is used for serializing errors with a potential error code

func NewRpcError added in v0.8.0

func NewRpcError(err error, code *int64) *RpcError

func (*RpcError) CodecDecodeSelf added in v0.8.0

func (x *RpcError) CodecDecodeSelf(d *codec1978.Decoder)

func (*RpcError) CodecEncodeSelf added in v0.8.0

func (x *RpcError) CodecEncodeSelf(e *codec1978.Encoder)

func (*RpcError) Error added in v0.8.0

func (r *RpcError) Error() string

type StreamErrWrapper added in v0.8.0

type StreamErrWrapper struct {
	// Error stores any error that may have occurred.
	Error *RpcError

	// Payload is the payload
	Payload []byte
}

StreamErrWrapper is used to serialize output of a stream of a file or logs.

func (*StreamErrWrapper) CodecDecodeSelf added in v0.8.0

func (x *StreamErrWrapper) CodecDecodeSelf(d *codec1978.Decoder)

func (*StreamErrWrapper) CodecEncodeSelf added in v0.8.0

func (x *StreamErrWrapper) CodecEncodeSelf(e *codec1978.Encoder)

type TaskResourceUsage

type TaskResourceUsage struct {
	ResourceUsage *ResourceUsage
	Timestamp     int64 // UnixNano
	Pids          map[string]*ResourceUsage
}

TaskResourceUsage holds aggregated resource usage of all processes in a Task and the resource usage of the individual pids

func (*TaskResourceUsage) CodecDecodeSelf added in v0.8.0

func (x *TaskResourceUsage) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskResourceUsage) CodecEncodeSelf added in v0.8.0

func (x *TaskResourceUsage) CodecEncodeSelf(e *codec1978.Encoder)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL