etcdv2

package
v0.0.0-...-45fc0ec Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout 默认查询超时
	DefaultTimeout = 5 * time.Second
)

Functions

func NewClient

func NewClient(cfg *model.Config) (clientv2 model.EtcdSdk, err error)

NewClient 创建etcd连接

Types

type EtcdV2Sdk

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

EtcdV2Sdk etcd v2版

func (*EtcdV2Sdk) Add

func (sdk *EtcdV2Sdk) Add(path string, data []byte) (err error)

Add 添加key

func (*EtcdV2Sdk) Close

func (sdk *EtcdV2Sdk) Close() error

Close 关闭连接

func (*EtcdV2Sdk) Del

func (sdk *EtcdV2Sdk) Del(path string) (err error)

Del 删除key

func (*EtcdV2Sdk) List

func (sdk *EtcdV2Sdk) List(path string) (list []*model.Node, err error)

List 显示当前path下所有key

func (*EtcdV2Sdk) Members

func (sdk *EtcdV2Sdk) Members() (members []*model.Member, err error)

Members 获取节点列表

func (*EtcdV2Sdk) Put

func (sdk *EtcdV2Sdk) Put(path string, data []byte) (err error)

Put 修改key

func (*EtcdV2Sdk) Val

func (sdk *EtcdV2Sdk) Val(path string) (data *model.Node, err error)

Val 获取path的值

Jump to

Keyboard shortcuts

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