etcd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configuration{}

Functions

func AddFunc

func AddFunc(key string, initFunc InitFunc, watchFunc WatchFunc)

func Restart

func Restart()

func Start

func Start()

Types

type Client

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

func GlobalClient

func GlobalClient() *Client

func (*Client) AddFunc

func (c *Client) AddFunc(key string, initFunc InitFunc, watchFunc WatchFunc)

AddFunc 添加监听函数

func (*Client) Close

func (c *Client) Close() error

func (*Client) Ctx

func (c *Client) Ctx() context.Context

func (*Client) DelValue

func (c *Client) DelValue(key string) (*clientv3.DeleteResponse, error)

DelValue 返回删除了几条数据

func (*Client) DelValueWithPrefix

func (c *Client) DelValueWithPrefix(prefix string) (*clientv3.DeleteResponse, error)

DelValueWithPrefix 按照前缀删除

func (*Client) GetValue

func (c *Client) GetValue(key string) (*clientv3.GetResponse, error)

GetValue 查询

func (*Client) GetValueWithPrefix

func (c *Client) GetValueWithPrefix(prefix string) (*clientv3.GetResponse, error)

GetValueWithPrefix 获取前缀

func (*Client) Open

func (c *Client) Open(etcdUrl []string, userName, passWord string, dialTimeout time.Duration) error

func (*Client) PutValue

func (c *Client) PutValue(key, value string) (*clientv3.PutResponse, error)

PutValue 添加键值对

func (*Client) Restart

func (c *Client) Restart()

func (*Client) Start

func (c *Client) Start()

Start 重新监听

func (*Client) WatchWithPrefix

func (c *Client) WatchWithPrefix(prefix string, revision int64) clientv3.WatchChan

WatchWithPrefix 监测前缀创建事件

type Configuration

type Configuration struct {
	Url         []string
	UserName    string
	Password    string
	DialTimeout int // second
}

func (*Configuration) Close

func (c *Configuration) Close() error

func (*Configuration) Init

func (c *Configuration) Init() error

func (*Configuration) Name

func (c *Configuration) Name() string

type InitFunc

type InitFunc func(ctx context.Context, res *clientv3.GetResponse)

type WatchFunc

type WatchFunc func(ctx context.Context, res *clientv3.WatchResponse)

Jump to

Keyboard shortcuts

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