Documentation ¶
Index ¶
- Constants
- Variables
- func Backup(fpath string)
- func Create(key, value string) error
- func CreateContext(ctx context.Context, key, value string) error
- func CreateDir(key string) error
- func CreateDirContext(ctx context.Context, key string) error
- func Delete(key string) error
- func DeleteContext(ctx context.Context, key string) error
- func EnsureKey(key string) (string, string, error)
- func MembersHandler() (interface{}, error)
- func Put(key, value string) error
- func PutContext(ctx context.Context, key, value string) error
- func SetEtcd(ctx context.Context, endpoint []string, Prefix string, tls *tls.Config)
- func Watch(fn func(key, reallyKey, value []byte, revision int64, t string) error)
- type Clienter
- 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"
)
View Source
const WATCH_EVENT_DELETE = "DELETE"
Variables ¶
View Source
var ( ErrorInvalidRootKey = errors.New("root key should not be empty or end with /") ErrorInvalidKey = errors.New("key should start with /") 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 MembersHandler ¶
func MembersHandler() (interface{}, error)
Types ¶
type Clienter ¶
type Clienter interface { Get(key string) (*Node, error) GetContext(ctx context.Context, key string) (*Node, error) List(key string) ([]*Node, error) ListContext(ctx context.Context, key string) ([]*Node, error) Put(key, value string) error PutContext(ctx context.Context, key, value string) error Create(key, value string) error CreateContext(ctx context.Context, key, value string) error CreateDir(key string) error CreateDirContext(ctx context.Context, key string) error Delete(key string) error DeleteContext(ctx context.Context, key string) error MembersHandler() (interface{}, error) Watch(fn func(key, reallyKey, value []byte, revision int64, t string) error) EnsureKey(key string) (string, string, error) Backup(filepath string) Close() }
var EtcdClient Clienter
type Member ¶
type Member struct { *etcdserverpb.Member Role string `json:"role"` Status string `json:"status"` DbSize int64 `json:"db_size"` }
Click to show internal directories.
Click to hide internal directories.