consul

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDatacenterRetries = 10

Variables

This section is empty.

Functions

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"`
	DisableGenerateID bool                           `json:"disableGenerateID"`
	DatacenterRetries int                            `json:"datacenterRetries"`
	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"`
	AllDatacenters bool             `json:"allDatacenters"`
	QueryOptions   api.QueryOptions `json:"queryOptions"`
}

Jump to

Keyboard shortcuts

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