Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(buf []byte, out interface{}) error
- func Encode(t MessageType, msg interface{}) ([]byte, error)
- type CheckServiceNode
- type CheckServiceNodes
- type ChecksInStateRequest
- type DCSpecificRequest
- type DeregisterRequest
- type DirEntries
- type DirEntry
- type HealthCheck
- type HealthChecks
- type IndexedCheckServiceNodes
- type IndexedDirEntries
- type IndexedHealthChecks
- type IndexedKeyList
- type IndexedNodeDump
- type IndexedNodeServices
- type IndexedNodes
- type IndexedServiceNodes
- type IndexedServices
- type KVSOp
- type KVSRequest
- type KeyListRequest
- type KeyRequest
- type MessageType
- type Node
- type NodeDump
- type NodeInfo
- type NodeService
- type NodeServices
- type NodeSpecificRequest
- type Nodes
- type QueryMeta
- type QueryOptions
- type RPCInfo
- type RegisterRequest
- type ServiceNode
- type ServiceNodes
- type ServiceSpecificRequest
- type Services
- type WriteRequest
Constants ¶
const ( HealthUnknown = "unknown" HealthPassing = "passing" HealthWarning = "warning" HealthCritical = "critical" )
const ( KVSSet KVSOp = "set" KVSDelete = "delete" KVSDeleteTree = "delete-tree" KVSCAS = "cas" // Check-and-set )
Variables ¶
Functions ¶
func Encode ¶
func Encode(t MessageType, msg interface{}) ([]byte, error)
Encode is used to encode a MsgPack object with type prefix
Types ¶
type CheckServiceNode ¶
type CheckServiceNode struct { Node Node Service NodeService Checks HealthChecks }
CheckServiceNode is used to provide the node, it's service definition, as well as a HealthCheck that is associated
type CheckServiceNodes ¶
type CheckServiceNodes []CheckServiceNode
type ChecksInStateRequest ¶
type ChecksInStateRequest struct { Datacenter string State string QueryOptions }
ChecksInStateRequest is used to query for nodes in a state
func (*ChecksInStateRequest) RequestDatacenter ¶ added in v0.2.0
func (r *ChecksInStateRequest) RequestDatacenter() string
type DCSpecificRequest ¶
type DCSpecificRequest struct { Datacenter string QueryOptions }
DCSpecificRequest is used to query about a specific DC
func (*DCSpecificRequest) RequestDatacenter ¶ added in v0.2.0
func (r *DCSpecificRequest) RequestDatacenter() string
type DeregisterRequest ¶
type DeregisterRequest struct { Datacenter string Node string ServiceID string CheckID string WriteRequest }
DeregisterRequest is used for the Catalog.Deregister endpoint to deregister a node as providing a service. If no service is provided the entire node is deregistered.
func (*DeregisterRequest) RequestDatacenter ¶ added in v0.2.0
func (r *DeregisterRequest) RequestDatacenter() string
type DirEntries ¶
type DirEntries []*DirEntry
type DirEntry ¶
DirEntry is used to represent a directory entry. This is used for values in our Key-Value store.
type HealthCheck ¶
type HealthCheck struct { Node string CheckID string // Unique per-node ID Name string // Check name Status string // The current check status Notes string // Additional notes with the status Output string // Holds output of script runs ServiceID string // optional associated service ServiceName string // optional service name }
HealthCheck represents a single check on a given node
type HealthChecks ¶
type HealthChecks []*HealthCheck
type IndexedCheckServiceNodes ¶
type IndexedCheckServiceNodes struct { Nodes CheckServiceNodes QueryMeta }
type IndexedDirEntries ¶
type IndexedDirEntries struct { Entries DirEntries QueryMeta }
type IndexedHealthChecks ¶
type IndexedHealthChecks struct { HealthChecks HealthChecks QueryMeta }
type IndexedKeyList ¶ added in v0.2.0
type IndexedNodeDump ¶ added in v0.2.0
type IndexedNodeServices ¶
type IndexedNodeServices struct { NodeServices *NodeServices QueryMeta }
type IndexedNodes ¶
type IndexedServiceNodes ¶
type IndexedServiceNodes struct { ServiceNodes ServiceNodes QueryMeta }
type IndexedServices ¶
type KVSRequest ¶
type KVSRequest struct { Datacenter string Op KVSOp // Which operation are we performing DirEnt DirEntry // Which directory entry WriteRequest }
KVSRequest is used to operate on the Key-Value store
func (*KVSRequest) RequestDatacenter ¶ added in v0.2.0
func (r *KVSRequest) RequestDatacenter() string
type KeyListRequest ¶ added in v0.2.0
type KeyListRequest struct { Datacenter string Prefix string Seperator string QueryOptions }
KeyListRequest is used to list keys
func (*KeyListRequest) RequestDatacenter ¶ added in v0.2.0
func (r *KeyListRequest) RequestDatacenter() string
type KeyRequest ¶
type KeyRequest struct { Datacenter string Key string QueryOptions }
KeyRequest is used to request a key, or key prefix
func (*KeyRequest) RequestDatacenter ¶ added in v0.2.0
func (r *KeyRequest) RequestDatacenter() string
type MessageType ¶
type MessageType uint8
const ( RegisterRequestType MessageType = iota DeregisterRequestType KVSRequestType )
type NodeDump ¶ added in v0.2.0
type NodeDump []*NodeInfo
NodeDump is used to dump all the nodes with all their associated data. This is currently used for the UI only, as it is rather expensive to generate.
type NodeInfo ¶ added in v0.2.0
type NodeInfo struct { Node string Address string Services []*NodeService Checks []*HealthCheck }
NodeInfo is used to dump all associated information about a node. This is currently used for the UI only, as it is rather expensive to generate.
type NodeService ¶
NodeService is a service provided by a node
type NodeServices ¶
type NodeServices struct { Node Node Services map[string]*NodeService }
type NodeSpecificRequest ¶
type NodeSpecificRequest struct { Datacenter string Node string QueryOptions }
NodeSpecificRequest is used to request the information about a single node
func (*NodeSpecificRequest) RequestDatacenter ¶ added in v0.2.0
func (r *NodeSpecificRequest) RequestDatacenter() string
type QueryMeta ¶ added in v0.2.0
type QueryMeta struct { // This is the index associated with the read Index uint64 // If AllowStale is used, this is time elapsed since // last contact between the follower and leader. This // can be used to gauge staleness. LastContact time.Duration // Used to indicate if there is a known leader node KnownLeader bool }
QueryMeta allows a query response to include potentially useful metadata about a query
type QueryOptions ¶ added in v0.2.0
type QueryOptions struct { // If set, wait until query exceeds given index. Must be provided // with MaxQueryTime. MinQueryIndex uint64 // Provided with MinQueryIndex to wait for change. MaxQueryTime time.Duration // If set, any follower can service the request. Results // may be arbitrarily stale. AllowStale bool // If set, the leader must verify leadership prior to // servicing the request. Prevents a stale read. RequireConsistent bool }
QueryOptions is used to specify various flags for read queries
func (QueryOptions) AllowStaleRead ¶ added in v0.2.0
func (q QueryOptions) AllowStaleRead() bool
func (QueryOptions) IsRead ¶ added in v0.2.0
func (q QueryOptions) IsRead() bool
QueryOption only applies to reads, so always true
type RegisterRequest ¶
type RegisterRequest struct { Datacenter string Node string Address string Service *NodeService Check *HealthCheck WriteRequest }
RegisterRequest is used for the Catalog.Register endpoint to register a node as providing a service. If no service is provided, the node is registered.
func (*RegisterRequest) RequestDatacenter ¶ added in v0.2.0
func (r *RegisterRequest) RequestDatacenter() string
type ServiceNode ¶
type ServiceNode struct { Node string Address string ServiceID string ServiceName string ServiceTags []string ServicePort int }
ServiceNode represents a node that is part of a service
type ServiceNodes ¶
type ServiceNodes []ServiceNode
type ServiceSpecificRequest ¶
type ServiceSpecificRequest struct { Datacenter string ServiceName string ServiceTag string TagFilter bool // Controls tag filtering QueryOptions }
ServiceSpecificRequest is used to query about a specific node
func (*ServiceSpecificRequest) RequestDatacenter ¶ added in v0.2.0
func (r *ServiceSpecificRequest) RequestDatacenter() string
type Services ¶
Used to return information about a provided services. Maps service name to available tags
type WriteRequest ¶ added in v0.2.0
type WriteRequest struct{}
func (WriteRequest) AllowStaleRead ¶ added in v0.2.0
func (w WriteRequest) AllowStaleRead() bool
func (WriteRequest) IsRead ¶ added in v0.2.0
func (w WriteRequest) IsRead() bool
WriteRequest only applies to writes, always false