Documentation ¶
Index ¶
- Constants
- func InitEtcd(cli *clientv3.Client)
- type DidChangeFunc
- type EtcdLock
- type EtcdTool
- func (etcd *EtcdTool) Delete(key string) (err error)
- func (etcd *EtcdTool) DeletePrefix(prefixKey string) (datas []string, err error)
- func (etcd *EtcdTool) Get(key string) (data string, err error)
- func (etcd *EtcdTool) GetPrefix(prefixKey string) (datas map[string]string, err error)
- func (etcd *EtcdTool) Put(key, value string) (err error)
- func (etcd *EtcdTool) PutWithLeaseId(key, value string, leaseId int64) (err error)
- func (etcd *EtcdTool) PutWithTimeOut(key, value string, timeout int) (err error)
- func (etcd *EtcdTool) RegistKeyAndKeepAlive(key, value string, ctx context.Context, callBack WatchHandleCallBack) (err error)
- func (etcd *EtcdTool) WatchKey(watchKey string, ctx context.Context, changeFunc DidChangeFunc) (err error)
- func (etcd *EtcdTool) WatchPrefix(prefixKey string, ctx context.Context, changeFunc DidChangeFunc) (err error)
- type WatchHandleCallBack
Constants ¶
View Source
const ( EtcdKeyDelete = "DELETE" EtcdKeyCreate = "CREATE" EtcdKeyModify = "MODIFY" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DidChangeFunc ¶
type DidChangeFunc func(status, key, value string)
监控一个key 发送变化 回调, status 取值 EtcdKeyDelete ,EtcdKeyCreate , EtcdKeyModify
type EtcdLock ¶
type EtcdLock struct {
// contains filtered or unexported fields
}
type EtcdTool ¶
func GetEtcdTool ¶
func GetEtcdTool() *EtcdTool
func (*EtcdTool) DeletePrefix ¶
func (*EtcdTool) PutWithLeaseId ¶
put
func (*EtcdTool) PutWithTimeOut ¶
put 值
func (*EtcdTool) RegistKeyAndKeepAlive ¶
func (etcd *EtcdTool) RegistKeyAndKeepAlive(key, value string, ctx context.Context, callBack WatchHandleCallBack) (err error)
注册一个key 并且 使用租约保活
func (*EtcdTool) WatchKey ¶
func (etcd *EtcdTool) WatchKey(watchKey string, ctx context.Context, changeFunc DidChangeFunc) (err error)
监控一个带前缀的key
func (*EtcdTool) WatchPrefix ¶
func (etcd *EtcdTool) WatchPrefix(prefixKey string, ctx context.Context, changeFunc DidChangeFunc) (err error)
监控一个带前缀的key
type WatchHandleCallBack ¶
leaseId 租约id ,保活使用
Click to show internal directories.
Click to hide internal directories.