Documentation
¶
Index ¶
Constants ¶
View Source
const ( ETCD_VERSION_V2 = "v2" ETCD_VERSION_V3 = "v3" )
View Source
const ( ROLE_LEADER = "leader" ROLE_FOLLOWER = "follower" STATUS_HEALTHY = "healthy" STATUS_UNHEALTHY = "unhealthy" )
Variables ¶
View Source
var ( ERR_CONFIG_ISNIL = errors.New("Config is nil") ERR_TLS_CONFIG_ISNIL = errors.New("TLSConfig is nil") ERR_ETCD_ADDRESS_EMPTY = errors.New("Etcd connection address cannot be empty") ERR_UNSUPPORTED_VERSION = errors.New("Unsupported etcd version") ERR_ADD_KEY = errors.New("Add key error") ERR_KEY_NOT_FOUND = errors.New("Key does not exist") ERR_KEY_NOT_DIR = errors.New("Key is not a directory") )
etcd 错误定义
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
EtcdId int32 `json:"etcd_id,omitempty"`
Version string `json:"version,omitempty"`
Address []string `json:"address,omitempty"`
TlsEnable bool `json:"tls_enable,omitempty"`
CertFile string `json:"cert_file,omitempty"`
KeyFile string `json:"key_file,omitempty"`
CaFile string `json:"ca_file,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
Config etcd 连接配置
type EtcdSdk ¶
type EtcdSdk interface {
List(path string) (list []*Node, err error) // 显示当前path下所有key
Val(path string) (data *Node, err error) // 获取path的值
Add(path string, data []byte) (err error) // 添加key
Put(path string, data []byte) (err error) // 修改key
Del(path string) (err error) // 删除key
Members() (members []*Member, err error) // 获取节点列表
Close() (err error) // 关闭连接
}
EtcdSdk 统一操作etcd接口
Click to show internal directories.
Click to hide internal directories.