consul

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package consul provides Instancer and Registrar implementations for Consul.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Register a service with the local agent.
	Register(r *consul.AgentServiceRegistration) error

	// Deregister a service with the local agent.
	Deregister(r *consul.AgentServiceRegistration) error

	// Service
	Service(service, tag string, passingOnly bool, queryOpts *consul.QueryOptions) ([]*consul.ServiceEntry, *consul.QueryMeta, error)
}

Client is a wrapper around the Consul API.

func NewClient

func NewClient(c *consul.Client) Client

NewClient returns an implementation of the Client interface, wrapping a concrete Consul client.

type Instancer added in v0.5.0

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

Instancer yields instances for a service in Consul.

func NewInstancer added in v0.5.0

func NewInstancer(client Client, logger log.Logger, service string, tags []string, passingOnly bool) *Instancer

NewInstancer returns a Consul instancer that publishes instances for the requested service. It only returns instances for which all of the passed tags are present.

func (*Instancer) Deregister added in v0.5.0

func (s *Instancer) Deregister(ch chan<- sd.Event)

Deregister implements Instancer.

func (*Instancer) Register added in v0.5.0

func (s *Instancer) Register(ch chan<- sd.Event)

Register implements Instancer.

func (*Instancer) Stop added in v0.5.0

func (s *Instancer) Stop()

Stop terminates the instancer.

type Registrar

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

Registrar registers service instance liveness information to Consul.

func NewRegistrar

func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger log.Logger) *Registrar

NewRegistrar returns a Consul Registrar acting on the provided catalog registration.

func (*Registrar) Deregister

func (p *Registrar) Deregister()

Deregister implements sd.Registrar interface.

func (*Registrar) Register

func (p *Registrar) Register()

Register implements sd.Registrar interface.

Jump to

Keyboard shortcuts

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