xetcd

package
v0.0.0-...-9493ce7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceRegisterDiscovery

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

ServiceRegisterDiscovery 服务注册发现

func NewServiceRegisterDiscovery

func NewServiceRegisterDiscovery(xetcd *XETCD,
	servicePrefix string) *ServiceRegisterDiscovery

NewServiceRegisterDiscovery 工厂方法

func (*ServiceRegisterDiscovery) Register

func (object *ServiceRegisterDiscovery) Register(name, config string) (err error)

Register 注册

func (*ServiceRegisterDiscovery) RunAsServer

func (object *ServiceRegisterDiscovery) RunAsServer(onlineHook func(key, value []byte),
	offlineHook func(key []byte))

RunAsServer 运行于服务状态

type XETCD

type XETCD struct {
	C *clientv3.Client // 客户端
	// contains filtered or unexported fields
}

XETCD ETCD客户端

func NewXETCD

func NewXETCD(cfg *clientv3.Config) (c *XETCD, err error)

NewXETCD 工厂方法

func (*XETCD) Close

func (object *XETCD) Close()

Close 关闭

func (*XETCD) GetClient

func (object *XETCD) GetClient() *clientv3.Client

GetClient 获取Client

func (*XETCD) GetWithPrefix

func (object *XETCD) GetWithPrefix(key string, timeout time.Duration) (values map[string][]byte, err error)

GetWithPrefix 获取满足前缀的所有

func (*XETCD) IsClosed

func (object *XETCD) IsClosed() bool

IsClosed 是否已经关闭

func (*XETCD) KeepAlive

func (object *XETCD) KeepAlive(key, value string,
	ttl int64,
	timeout time.Duration) (err error)

KeepAlive 保活

func (*XETCD) PutWithTTL

func (object *XETCD) PutWithTTL(key, value string,
	ttl int64,
	timeout time.Duration) (err error)

PutWithTTL 放入

func (*XETCD) Watch

func (object *XETCD) Watch(ctx context.Context,
	key string,
	callback func(event *clientv3.Event))

Watch 监视

func (*XETCD) WatchPrefix

func (object *XETCD) WatchPrefix(ctx context.Context,
	key string,
	callback func(event *clientv3.Event))

WatchPrefix 监视前缀

Jump to

Keyboard shortcuts

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