Documentation ¶
Index ¶
- Constants
- Variables
- func NodeJsonFormat(prefix string, list []*Node) (interface{}, error)
- type Etcd3Client
- func (c *Etcd3Client) Delete(key string) error
- func (c *Etcd3Client) GetRecursiveValue(key string) (list []*Node, err error)
- func (c *Etcd3Client) List(key string) (nodes []*Node, err error)
- func (c *Etcd3Client) Members() ([]*Member, error)
- func (c *Etcd3Client) Put(key string, value string, mustEmpty bool) error
- func (c *Etcd3Client) Value(key string) (val *Node, err error)
- type Member
- type Node
Constants ¶
View Source
const ( ROLE_LEADER = "leader" ROLE_FOLLOWER = "follower" STATUS_HEALTHY = "healthy" STATUS_UNHEALTHY = "unhealthy" )
View Source
const (
DEFAULT_DIR_VALUE = "etcdv3_dir_$2H#%gRe3*t"
)
Variables ¶
View Source
var ( ErrorPutKey = errors.New("key is not under a directory or key is a directory or key is not empty") ErrorKeyNotFound = errors.New("key has not been set") ErrorListKey = errors.New("can only list a directory") )
错误类型
Functions ¶
func NodeJsonFormat ¶
node 列表格式化成json
Types ¶
type Etcd3Client ¶
Etcd3Client etcd v3客户端
func GetEtcdCli ¶
func GetEtcdCli(etcdCfg *config.EtcdServer) (*Etcd3Client, error)
GetEtcdCli 获取一个etcd cli对象
func NewEtcdCli ¶
func NewEtcdCli(etcdCfg *config.EtcdServer) (*Etcd3Client, error)
NewEtcdCli 创建一个etcd客户端
func (*Etcd3Client) GetRecursiveValue ¶
func (c *Etcd3Client) GetRecursiveValue(key string) (list []*Node, err error)
GetRecursiveValue 获取前缀下的所有key
func (*Etcd3Client) List ¶
func (c *Etcd3Client) List(key string) (nodes []*Node, err error)
List 获取目录下列表
Click to show internal directories.
Click to hide internal directories.