consul

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckServiceNode

type CheckServiceNode struct {
	Node    *Node
	Service *NodeService
	Checks  HealthChecks
}

type CheckType

type CheckType struct {
	CheckID string
	Name    string
	Status  string
	Notes   string

	ScriptArgs        []string
	HTTP              string
	Header            map[string][]string
	Method            string
	TCP               string
	Interval          time.Duration
	DockerContainerID string
	Shell             string
	TLSSkipVerify     bool
	Timeout           time.Duration
	TTL               time.Duration

	// DeregisterCriticalServiceAfter, if >0, will cause the associated
	// service, if any, to be deregistered if this check is critical for
	// longer than this duration.
	DeregisterCriticalServiceAfter time.Duration
}

type CheckTypes

type CheckTypes []*CheckType

type Config

type Config struct {
	Address []string
	Token   string
	// additional message:tsf namespaceid and tencent appid if exsist
	AppID       string
	NamespaceID string

	Catalog bool
}

type Consul

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

func DefaultConsul

func DefaultConsul() *Consul

func New

func New(conf *Config) *Consul

func (*Consul) Catalog

func (c *Consul) Catalog()

func (*Consul) Deregister

func (c *Consul) Deregister(ins *naming.Instance) (err error)

func (*Consul) Fetch

func (c *Consul) Fetch(svc naming.Service) (nodes []naming.Instance, initialized bool)

func (*Consul) Register

func (c *Consul) Register(ins *naming.Instance) (err error)

func (*Consul) Scheme

func (c *Consul) Scheme() string

func (*Consul) Subscribe

func (c *Consul) Subscribe(svc naming.Service) naming.Watcher

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
	ServiceTags []string // optional service tags

	RaftIndex
}

HealthCheck represents a single check on a given node

type HealthChecks

type HealthChecks []*HealthCheck

type Node

type Node struct {
	ID              string
	Node            string
	Address         string
	Datacenter      string
	TaggedAddresses map[string]string
	Meta            map[string]string

	RaftIndex
}

Used to return information about a node

type NodeService

type NodeService struct {
	ID                string
	Service           string
	Tags              []string
	Address           string
	Meta              map[string]string
	Port              int
	EnableTagOverride bool

	RaftIndex
}

NodeService is a service provided by a node

type RaftIndex

type RaftIndex struct {
	CreateIndex uint64
	ModifyIndex uint64
}

RaftIndex is used to track the index used while creating or modifying a given struct type.

type ServiceDefinition

type ServiceDefinition struct {
	ID                string
	Name              string
	Tags              []string
	Address           string
	Meta              map[string]string
	Port              int
	Check             CheckType
	Checks            CheckTypes
	Token             string
	EnableTagOverride bool
}

type Watcher

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

func (*Watcher) Close

func (w *Watcher) Close()

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context) (nodes []naming.Instance, err error)

Jump to

Keyboard shortcuts

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