Documentation ¶
Overview ¶
Package consul is registered as a service using consul.
Index ¶
- func NewRegistry(consulAddr string, id string, instanceName string, instanceEndpoints []string) (registry.Registry, *registry.ServiceInstance, error)
- type Client
- func (d *Client) Deregister(_ context.Context, serviceID string) error
- func (d *Client) Register(_ context.Context, svc *registry.ServiceInstance, enableHealthCheck bool) error
- func (d *Client) Service(ctx context.Context, service string, index uint64, passingOnly bool) ([]*registry.ServiceInstance, uint64, error)
- type Config
- type Option
- type Registry
- func (r *Registry) Deregister(ctx context.Context, svc *registry.ServiceInstance) error
- func (r *Registry) GetService(_ context.Context, name string) (services []*registry.ServiceInstance, err error)
- func (r *Registry) ListServices() (allServices map[string][]*registry.ServiceInstance, err error)
- func (r *Registry) Register(ctx context.Context, svc *registry.ServiceInstance) error
- func (r *Registry) Watch(_ context.Context, name string) (registry.Watcher, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is consul client config
func (*Client) Deregister ¶
Deregister deregister service by service ID
type Option ¶
type Option func(*Registry)
Option is consul registry option.
func WithHealthCheck ¶
WithHealthCheck with registry health check option.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is consul registry
func (*Registry) Deregister ¶
Deregister deregister service
func (*Registry) GetService ¶
func (r *Registry) GetService(_ 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.
Click to show internal directories.
Click to hide internal directories.