Documentation ¶
Index ¶
- Constants
- Variables
- func DelLock(key string) error
- func Delete(key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
- func Get(key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
- func GetLock(key string, id clientv3.LeaseID) (bool, error)
- func Grant(ttl int64) (*clientv3.LeaseGrantResponse, error)
- func IsValidAsKeyPath(s string) bool
- func NewEtcdTimeoutContext() (context.Context, context.CancelFunc)
- func Put(key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
- func PutWithModRev(key, val string, rev int64) (*clientv3.PutResponse, error)
- func PutWithTtl(key, val string, ttl int64) (*clientv3.PutResponse, error)
- func Revoke(id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
- func Watch(key string, opts ...clientv3.OpOption) clientv3.WatchChan
- type Client
- type ServerReg
- type Watcher
Constants ¶
View Source
const ( KeyEtcdLockProfile = keyEtcdProfile + "lock/" KeyEtcdLock = KeyEtcdLockProfile + "%s" )
Variables ¶
View Source
var ( ErrValueMayChanged = errors.New("The value has been changed by others on this time.") ErrEtcdNotInit = errors.New("etcd is not initialized") )
Functions ¶
func IsValidAsKeyPath ¶
func NewEtcdTimeoutContext ¶
func NewEtcdTimeoutContext() (context.Context, context.CancelFunc)
NewEtcdTimeoutContext return a new etcdTimeoutContext
func PutWithModRev ¶
func PutWithModRev(key, val string, rev int64) (*clientv3.PutResponse, error)
func PutWithTtl ¶
func PutWithTtl(key, val string, ttl int64) (*clientv3.PutResponse, error)
Types ¶
type ServerReg ¶
type ServerReg struct { Client *Client //time-to-live Ttl int64 // contains filtered or unexported fields }
etcd服务注册并租约
func NewServerReg ¶
func (*ServerReg) RevokeLease ¶
Click to show internal directories.
Click to hide internal directories.