consul

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyService added in v1.6.6

func CopyService(service *servicediscovery.Service) *servicediscovery.Service

func NewServerDiscovery

func NewServerDiscovery(option Option) servicediscovery.IServiceDiscovery

func UseServiceDiscovery

func UseServiceDiscovery(serviceCollection *dependencyinjection.ServiceCollection)

Types

type Client

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

func NewClient

func NewClient(op Option) *Client

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

func (*Client) Deregister

func (c *Client) Deregister(r *consul.AgentServiceRegistration) error

func (*Client) GetService

func (c *Client) GetService(service, tag string, passingOnly bool, queryOpts *consul.QueryOptions) ([]*consul.ServiceEntry, *consul.QueryMeta, error)

func (*Client) GetServices added in v1.6.6

func (c *Client) GetServices(queryOpts *consul.QueryOptions) []string

func (*Client) Register

func (c *Client) Register(r *consul.AgentServiceRegistration) error

type Option

type Option struct {
	ENV     *abstractions.HostEnvironment
	Address string   `mapstructure:"address" config:"address"`
	Token   string   `mapstructure:"token" config:"token"`
	Tags    []string `mapstructure:"tags" config:"tags"`
	Health  string   `mapstructure:"health_check" config:"health_check"`
}

type Registrar

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

func (*Registrar) Destroy

func (registrar *Registrar) Destroy() error

func (*Registrar) GetAllInstances

func (registrar *Registrar) GetAllInstances(serviceName string) []servicediscovery.ServiceInstance

func (*Registrar) GetAllServices added in v1.6.6

func (registrar *Registrar) GetAllServices() ([]*servicediscovery.Service, error)

func (*Registrar) GetHealthyInstances

func (registrar *Registrar) GetHealthyInstances(serviceName string) []servicediscovery.ServiceInstance

func (*Registrar) GetName

func (registrar *Registrar) GetName() string

func (*Registrar) Register

func (registrar *Registrar) Register() error

func (*Registrar) Unregister

func (registrar *Registrar) Unregister() error

func (*Registrar) Update

func (registrar *Registrar) Update() error

func (*Registrar) Watch added in v1.6.6

func (registrar *Registrar) Watch(opts ...servicediscovery.WatchOption) (servicediscovery.Watcher, error)

type Watcher added in v1.6.6

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

func (*Watcher) Next added in v1.6.6

func (cw *Watcher) Next() (*servicediscovery.Result, error)

func (*Watcher) Stop added in v1.6.6

func (cw *Watcher) Stop()

Jump to

Keyboard shortcuts

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