Help us shape the future of Go! Take the 2026 Go Developer Survey

structs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2014 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HealthUnknown  = "unknown"
	HealthPassing  = "passing"
	HealthWarning  = "warning"
	HealthCritical = "critical"
)
View Source
const (
	KVSSet        KVSOp = "set"
	KVSDelete           = "delete"
	KVSDeleteTree       = "delete-tree"
	KVSCAS              = "cas" // Check-and-set
)

Variables

View Source
var (
	ErrNoLeader  = fmt.Errorf("No cluster leader")
	ErrNoDCPath  = fmt.Errorf("No path to datacenter")
	ErrNoServers = fmt.Errorf("No known Consul servers")
)

Functions

func Decode

func Decode(buf []byte, out interface{}) error

Decode is used to decode a MsgPack encoded object

func Encode

func Encode(t MessageType, msg interface{}) ([]byte, error)

Encode is used to encode a MsgPack object with type prefix

Types

type BlockingQuery

type BlockingQuery struct {
	// If set, wait until query exceeds given index
	MinQueryIndex uint64

	// Provided with MinQueryIndex to wait for change
	MaxQueryTime time.Duration
}

BlockingQuery is used to block on a query and wait for a change. Either both fields, or neither must be provided.

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
	BlockingQuery
}

ChecksInStateRequest is used to query for nodes in a state

type DCSpecificRequest

type DCSpecificRequest struct {
	Datacenter string
	BlockingQuery
}

DCSpecificRequest is used to query about a specific DC

type DeregisterRequest

type DeregisterRequest struct {
	Datacenter string
	Node       string
	ServiceID  string
	CheckID    string
}

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.

type DirEntries

type DirEntries []*DirEntry

type DirEntry

type DirEntry struct {
	CreateIndex uint64
	ModifyIndex uint64
	Key         string
	Flags       uint64
	Value       []byte
}

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
	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 {
	Index uint64
	Nodes CheckServiceNodes
}

type IndexedDirEntries

type IndexedDirEntries struct {
	Index   uint64
	Entries DirEntries
}

type IndexedHealthChecks

type IndexedHealthChecks struct {
	Index        uint64
	HealthChecks HealthChecks
}

type IndexedNodeServices

type IndexedNodeServices struct {
	Index        uint64
	NodeServices *NodeServices
}

type IndexedNodes

type IndexedNodes struct {
	Index uint64
	Nodes Nodes
}

type IndexedServiceNodes

type IndexedServiceNodes struct {
	Index        uint64
	ServiceNodes ServiceNodes
}

type IndexedServices

type IndexedServices struct {
	Index    uint64
	Services Services
}

type KVSOp

type KVSOp string

type KVSRequest

type KVSRequest struct {
	Datacenter string
	Op         KVSOp    // Which operation are we performing
	DirEnt     DirEntry // Which directory entry
}

KVSRequest is used to operate on the Key-Value store

type KeyRequest

type KeyRequest struct {
	Datacenter string
	Key        string
	BlockingQuery
}

KeyRequest is used to request a key, or key prefix

type MessageType

type MessageType uint8
const (
	RegisterRequestType MessageType = iota
	DeregisterRequestType
	KVSRequestType
)

type Node

type Node struct {
	Node    string
	Address string
}

Used to return information about a node

type NodeService

type NodeService struct {
	ID      string
	Service string
	Tags    []string
	Port    int
}

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
	BlockingQuery
}

NodeSpecificRequest is used to request the information about a single node

type Nodes

type Nodes []Node

type RegisterRequest

type RegisterRequest struct {
	Datacenter string
	Node       string
	Address    string
	Service    *NodeService
	Check      *HealthCheck
}

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.

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
	BlockingQuery
}

ServiceSpecificRequest is used to query about a specific node

type Services

type Services map[string][]string

Used to return information about a provided services. Maps service name to available tags

Jump to

Keyboard shortcuts

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