consul

package module
v0.0.0-...-c4dba0f Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

func WithAddr

func WithAddr(addr string) Option

WithAddr 设置客户端连接地址

func WithClient

func WithClient(client *api.Client) Option

WithClient 设置外部客户端

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置context

func WithDeregisterCriticalServiceAfter

func WithDeregisterCriticalServiceAfter(after int) Option

WithDeregisterCriticalServiceAfter 设置健康检测失败后自动注销服务时间

func WithEnableHealthCheck

func WithEnableHealthCheck(enable bool) Option

WithEnableHealthCheck 设置是否启用健康检查

func WithEnableHeartbeatCheck

func WithEnableHeartbeatCheck(enable bool) Option

WithEnableHeartbeatCheck 设置是否启用心跳检查

func WithHealthCheckInterval

func WithHealthCheckInterval(interval int) Option

WithHealthCheckInterval 设置健康检查时间间隔

func WithHealthCheckTimeout

func WithHealthCheckTimeout(timeout int) Option

WithHealthCheckTimeout 设置健康检查超时时间

func WithHeartbeatCheckInterval

func WithHeartbeatCheckInterval(interval int) Option

WithHeartbeatCheckInterval 设置心跳检查时间间隔

type Registry

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

func NewRegistry

func NewRegistry(opts ...Option) *Registry

func (*Registry) Deregister

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

Deregister 解注册服务实例

func (*Registry) Register

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

Register 注册服务实例

func (*Registry) Services

func (r *Registry) Services(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error)

Services 获取服务实例列表

func (*Registry) Watch

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

Watch 监听服务

Jump to

Keyboard shortcuts

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