Documentation ¶
Index ¶
- type Client
- func (c *Client) Deregister(_ context.Context, serviceID string) error
- func (c *Client) Register(_ context.Context, svc *registry.ServiceInstance, enableHealthCheck bool) error
- func (c *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(ctx context.Context, name string) (services []*registry.ServiceInstance, err error)
- func (r *Registry) ListServices() (allServices map[string][]*registry.ServiceInstance, err error)
- func (r *Registry) Name() string
- func (r *Registry) Register(ctx context.Context, svc *registry.ServiceInstance) error
- func (r *Registry) ServerConfigs() string
- func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)
- type ServiceResolver
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 (*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.
func WithHealthCheckInterval ¶
WithHealthCheckInterval with healthcheck interval in seconds.
func WithHeartbeat ¶
WithHeartbeat enable or disable heartbeat
func WithServiceResolver ¶
func WithServiceResolver(fn ServiceResolver) Option
WithServiceResolver with endpoint function 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(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) ServerConfigs ¶
type ServiceResolver ¶
type ServiceResolver func(ctx context.Context, entries []*api.ServiceEntry) []*registry.ServiceInstance
ServiceResolver is used to resolve service endpoints
Click to show internal directories.
Click to hide internal directories.