structs

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2018 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocBroadcaster

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

AllocBroadcaster implements an allocation broadcast channel. The zero value is a usable unbuffered channel.

func NewAllocBroadcaster

func NewAllocBroadcaster(n int) *AllocBroadcaster

NewAllocBroadcaster returns a new AllocBroadcaster with the given capacity (0 means unbuffered).

func (*AllocBroadcaster) Close

func (b *AllocBroadcaster) Close()

Close closes the channel, disabling the sending of further messages.

func (*AllocBroadcaster) Listen

func (b *AllocBroadcaster) Listen() *AllocListener

Listen returns a Listener for the broadcast channel.

func (*AllocBroadcaster) Send

Send broadcasts a message to the channel. Send returns whether the message was sent to all channels.

type AllocFileInfo

type AllocFileInfo struct {
	Name     string
	IsDir    bool
	Size     int64
	FileMode string
	ModTime  time.Time
}

AllocFileInfo holds information about a file inside the AllocDir

func (*AllocFileInfo) CodecDecodeSelf

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

func (*AllocFileInfo) CodecEncodeSelf

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

type AllocListener

type AllocListener struct {
	// Ch receives the broadcast messages.
	Ch <-chan *structs.Allocation
	// contains filtered or unexported fields
}

AllocListener implements a listening endpoint for an allocation broadcast channel.

func (*AllocListener) Close

func (l *AllocListener) Close()

Close closes the Listener, disabling the receival of further messages.

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

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

func (*AllocResourceUsage) CodecEncodeSelf

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

type AllocStatsRequest

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

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

func (*AllocStatsRequest) CodecEncodeSelf

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

type AllocStatsResponse

type AllocStatsResponse struct {
	Stats *AllocResourceUsage
	structs.QueryMeta
}

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

func (*AllocStatsResponse) CodecDecodeSelf

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

func (*AllocStatsResponse) CodecEncodeSelf

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

type ClientStatsResponse

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

ClientStatsResponse is used to return statistics about a node.

func (*ClientStatsResponse) CodecDecodeSelf

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

func (*ClientStatsResponse) CodecEncodeSelf

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

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

func (*CpuStats) CodecEncodeSelf

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

type DriverNetwork

type DriverNetwork struct {
	// PortMap can be set by drivers to replace ports in environment
	// variables with driver-specific mappings.
	PortMap map[string]int

	// IP is the IP address for the task created by the driver.
	IP string

	// AutoAdvertise indicates whether the driver thinks services that
	// choose to auto-advertise-addresses should use this IP instead of the
	// host's. eg If a Docker network plugin is used
	AutoAdvertise bool
}

DriverNetwork is the network created by driver's (eg Docker's bridge network) during Prestart.

func (*DriverNetwork) Advertise

func (d *DriverNetwork) Advertise() bool

Advertise returns true if the driver suggests using the IP set. May be called on a nil Network in which case it returns false.

func (*DriverNetwork) CodecDecodeSelf

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

func (*DriverNetwork) CodecEncodeSelf

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

func (*DriverNetwork) Copy

func (d *DriverNetwork) Copy() *DriverNetwork

Copy a DriverNetwork struct. If it is nil, nil is returned.

func (*DriverNetwork) Hash

func (d *DriverNetwork) Hash() []byte

Hash the contents of a DriverNetwork struct to detect changes. If it is nil, an empty slice is returned.

type FSIsolation

type FSIsolation int

FSIsolation is an enumeration to describe what kind of filesystem isolation a driver supports.

const (
	// FSIsolationNone means no isolation. The host filesystem is used.
	FSIsolationNone FSIsolation = 0

	// FSIsolationChroot means the driver will use a chroot on the host
	// filesystem.
	FSIsolationChroot FSIsolation = 1

	// FSIsolationImage means the driver uses an image.
	FSIsolationImage FSIsolation = 2
)

func (*FSIsolation) CodecDecodeSelf

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

func (FSIsolation) CodecEncodeSelf

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

func (FSIsolation) String

func (f FSIsolation) String() string

type FingerprintRequest

type FingerprintRequest struct {
	Config *config.Config
	Node   *structs.Node
}

FingerprintRequest is a request which a fingerprinter accepts to fingerprint the node

func (*FingerprintRequest) CodecDecodeSelf

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

func (*FingerprintRequest) CodecEncodeSelf

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

type FingerprintResponse

type FingerprintResponse struct {
	Attributes map[string]string
	Links      map[string]string
	Resources  *structs.Resources

	// Detected is a boolean indicating whether the fingerprinter detected
	// if the resource was available
	Detected bool
}

FingerprintResponse is the response which a fingerprinter annotates with the results of the fingerprint method

func (*FingerprintResponse) AddAttribute

func (f *FingerprintResponse) AddAttribute(name, value string)

AddAttribute adds the name and value for a node attribute to the fingerprint response

func (f *FingerprintResponse) AddLink(name, value string)

AddLink adds a link entry to the fingerprint response

func (*FingerprintResponse) CodecDecodeSelf

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

func (*FingerprintResponse) CodecEncodeSelf

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

func (*FingerprintResponse) RemoveAttribute

func (f *FingerprintResponse) RemoveAttribute(name string)

RemoveAttribute sets the given attribute to empty, which will later remove it entirely from the node

func (f *FingerprintResponse) RemoveLink(name string)

RemoveLink removes a link entry from the fingerprint response. This will later remove it entirely from the node

type FsListRequest

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

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

func (*FsListRequest) CodecEncodeSelf

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

type FsListResponse

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

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

func (*FsListResponse) CodecEncodeSelf

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

type FsLogsRequest

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

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

func (*FsLogsRequest) CodecEncodeSelf

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

type FsStatRequest

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

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

func (*FsStatRequest) CodecEncodeSelf

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

type FsStatResponse

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

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

func (*FsStatResponse) CodecEncodeSelf

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

type FsStreamRequest

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

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

func (*FsStreamRequest) CodecEncodeSelf

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

type HealthCheckIntervalRequest

type HealthCheckIntervalRequest struct{}

func (*HealthCheckIntervalRequest) CodecDecodeSelf

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

func (*HealthCheckIntervalRequest) CodecEncodeSelf

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

type HealthCheckIntervalResponse

type HealthCheckIntervalResponse struct {
	Eligible bool
	Period   time.Duration
}

func (*HealthCheckIntervalResponse) CodecDecodeSelf

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

func (*HealthCheckIntervalResponse) CodecEncodeSelf

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

type HealthCheckRequest

type HealthCheckRequest struct{}

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

func (*HealthCheckRequest) CodecDecodeSelf

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

func (*HealthCheckRequest) CodecEncodeSelf

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

type HealthCheckResponse

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

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

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

func (*HealthCheckResponse) CodecEncodeSelf

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

type MemoryStats

type MemoryStats struct {
	RSS            uint64
	Cache          uint64
	Swap           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

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

func (*MemoryStats) CodecEncodeSelf

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

type ResourceUsage

type ResourceUsage struct {
	MemoryStats *MemoryStats
	CpuStats    *CpuStats
}

ResourceUsage holds information related to cpu and memory stats

func (*ResourceUsage) Add

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

func (*ResourceUsage) CodecDecodeSelf

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

func (*ResourceUsage) CodecEncodeSelf

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

type RpcError

type RpcError struct {
	Message string
	Code    *int64
}

RpcError is used for serializing errors with a potential error code

func NewRpcError

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

func (*RpcError) CodecDecodeSelf

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

func (*RpcError) CodecEncodeSelf

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

func (*RpcError) Error

func (r *RpcError) Error() string

type StreamErrWrapper

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

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

func (*StreamErrWrapper) CodecEncodeSelf

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

type TaskResourceUsage

type TaskResourceUsage struct {
	ResourceUsage *ResourceUsage
	Timestamp     int64
	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

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

func (*TaskResourceUsage) CodecEncodeSelf

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