Documentation ¶
Overview ¶
Package consul implements service Registry and Discovery using consul.
Index ¶
- Constants
- func New(opts ...Option) (gsvc.Registry, error)
- type Option
- type Registry
- func (r *Registry) Deregister(ctx context.Context, service gsvc.Service) error
- func (r *Registry) GetAddress() string
- func (r *Registry) Register(ctx context.Context, service gsvc.Service) (gsvc.Service, error)
- func (r *Registry) Search(ctx context.Context, in gsvc.SearchInput) ([]gsvc.Service, error)
- func (r *Registry) Watch(ctx context.Context, key string) (gsvc.Watcher, error)
- type Watcher
Constants ¶
View Source
const ( // DefaultTTL is the default TTL for service registration DefaultTTL = 20 * time.Second // DefaultHealthCheckInterval is the default interval for health check DefaultHealthCheckInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(r *Registry)
Option is the configuration option type for registry.
func WithAddress ¶
WithAddress sets the address for consul client.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry implements gsvc.Registry interface using consul.
func (*Registry) Deregister ¶
Deregister deregisters a service from consul.
func (*Registry) GetAddress ¶
GetAddress returns the consul address
Click to show internal directories.
Click to hide internal directories.