consul

package
v1.11.9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultDatacenterRetries = 10

Variables

This section is empty.

Functions

func Metrics added in v1.11.9

func Metrics() []xmetrics.Metric

Metrics returns the Metrics relevant to this package

func NewEnvironment

func NewEnvironment(l log.Logger, registrationScheme string, co Options, eo ...service.Option) (service.Environment, error)

func NewInstancer

func NewInstancer(o InstancerOptions) sd.Instancer

func NewRegistrar

func NewRegistrar(c gokitconsul.Client, u ttlUpdater, r *api.AgentServiceRegistration, logger log.Logger) (sd.Registrar, error)

NewRegistrar creates an sd.Registrar, binding any TTL checks to the Register/Deregister lifecycle as needed.

Types

type Client

type Client interface {
	gokitconsul.Client

	// Datacenters returns the known datacenters from the catalog
	Datacenters() ([]string, error)
}

Client extends the go-kit consul Client interface with behaviors specific to XMiDT

func NewClient

func NewClient(c *api.Client) Client

NewClient constructs a Client object which wraps the given hashicorp consul client. This factory function is the analog to go-kit's sd/consul.NewClient function.

type Environment

type Environment interface {
	service.Environment

	// Client returns the custom consul Client interface exposed by this package
	Client() Client
}

Environment is a consul-specific interface for the service discovery environment. A primary use case is obtaining access to the underlying consul client for use in direct API calls.

type InstancerOptions

type InstancerOptions struct {
	Client       Client
	Logger       log.Logger
	Service      string
	Tags         []string
	PassingOnly  bool
	QueryOptions api.QueryOptions
}

type Options

type Options struct {
	Client                  *api.Config                    `json:"client"`
	Chrysom                 chrysom.ClientConfig           `json:"chrysom"`
	DisableGenerateID       bool                           `json:"disableGenerateID"`
	DatacenterRetries       int                            `json:"datacenterRetries"`
	DatacenterWatchInterval time.Duration                  `json:"datacenterWatchInterval"`
	Registrations           []api.AgentServiceRegistration `json:"registrations,omitempty"`
	Watches                 []Watch                        `json:"watches,omitempty"`
}

type Watch

type Watch struct {
	Service         string           `json:"service,omitempty"`
	Tags            []string         `json:"tags,omitempty"`
	PassingOnly     bool             `json:"passingOnly"`
	CrossDatacenter bool             `json:"crossDatacenter"`
	QueryOptions    api.QueryOptions `json:"queryOptions"`
}

Jump to

Keyboard shortcuts

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