etcd

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const KeyPrefix = "tiger/tgrpc"

Variables

This section is empty.

Functions

func NewETCDRegister

func NewETCDRegister(opts ...Option) (discov.Discovery, error)

Types

type Option

type Option func(o *Options)

定义一系列修改options的方法,作为插销,后续一个个运行

func WithDialTimeout

func WithDialTimeout(dialTimeout time.Duration) Option

func WithEndpoints

func WithEndpoints(endpoints []string) Option

func WithKeepAliveInterval

func WithKeepAliveInterval(ttl int64) Option

func WithRegisterServiceOrKeepAliveInterval

func WithRegisterServiceOrKeepAliveInterval(t time.Duration) Option

func WithSyncFlushCacheInterval

func WithSyncFlushCacheInterval(t time.Duration) Option

type Options

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

type Register

type Register struct {
	Options // etcd的一些信息
	// contains filtered or unexported fields
}

Register

func (*Register) AddListener

func (r *Register) AddListener(ctx context.Context, f func())

func (*Register) GetService

func (r *Register) GetService(ctx context.Context, name string) *discov.Service

这里会更新一下 downServices

func (*Register) Init

func (r *Register) Init(ctx context.Context) error

初始化cli,同时开启监听Register中唯二的队列

func (*Register) KeepAlive

func (r *Register) KeepAlive(ctx context.Context, service *registerService)

func (*Register) Name

func (r *Register) Name() string

---------------------------------------------- 以下Register实现Discovery ----------------------------------------------

func (*Register) NotifyListeners

func (r *Register) NotifyListeners()

func (*Register) Register

func (r *Register) Register(ctx context.Context, service *discov.Service)

func (*Register) UnRegister

func (r *Register) UnRegister(ctx context.Context, service *discov.Service)

Jump to

Keyboard shortcuts

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