registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is consul client config

func NewClient

func NewClient(cli *api.Client) *Client

NewClient creates consul client

func (*Client) Deregister

func (d *Client) Deregister(ctx context.Context, serviceID string) error

Deregister deregister service by service ID

func (*Client) Register

func (d *Client) Register(ctx context.Context, svc *registry.ServiceInstance, enableHealthCheck bool) error

Register register service instacen to consul

func (*Client) Service

func (d *Client) Service(ctx context.Context, service string, index uint64, passingOnly bool) ([]*registry.ServiceInstance, uint64, error)

Service get services from consul

type Config

type Config struct {
	*api.Config
}

Config is consul registry config

type Option

type Option func(*Registry)

Option is consul registry option.

func WithHealthCheck

func WithHealthCheck(enable bool) Option

WithHealthCheck with registry health check option.

type Registry

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

Registry is consul registry

func New

func New(apiClient *api.Client, opts ...Option) *Registry

New creates consul registry

func (*Registry) Deregister

func (r *Registry) Deregister(ctx context.Context, svc *registry.ServiceInstance) error

Deregister deregister service

func (*Registry) GetService

func (r *Registry) GetService(ctx context.Context, name string) (services []*registry.ServiceInstance, err error)

GetService return service by name

func (*Registry) ListServices

func (r *Registry) ListServices() (allServices map[string][]*registry.ServiceInstance, err error)

ListServices return service list.

func (*Registry) Register

func (r *Registry) Register(ctx context.Context, svc *registry.ServiceInstance) error

Register register service

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)

Watch resolve service by name

Jump to

Keyboard shortcuts

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