Documentation ¶
Index ¶
- type EtcdClient
- func (cli *EtcdClient) Close() error
- func (cli *EtcdClient) Delete(key string, timeout time.Duration) error
- func (cli *EtcdClient) GetMetadata(key string, timeout time.Duration) (string, error)
- func (cli *EtcdClient) GetNodes(key string, timeout time.Duration) ([]string, error)
- func (cli *EtcdClient) Lock(key, val string, ttl int64) (*LockResult, error)
- func (cli *EtcdClient) Put(key, metadata string, timeout time.Duration) error
- func (cli *EtcdClient) Unlock(res *LockResult)
- func (cli *EtcdClient) Update(key, update string, timeout time.Duration) (string, error)
- func (cli *EtcdClient) Watch(key string, cb func(int32, string, string))
- type EtcdConfig
- type LockResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcdClient ¶
type EtcdClient struct {
// contains filtered or unexported fields
}
func InitEtcdClient ¶
func InitEtcdClient(c *EtcdConfig) (*EtcdClient, error)
func (*EtcdClient) Close ¶
func (cli *EtcdClient) Close() error
func (*EtcdClient) GetMetadata ¶
func (*EtcdClient) Lock ¶
func (cli *EtcdClient) Lock(key, val string, ttl int64) (*LockResult, error)
etcd 分布式锁
func (*EtcdClient) Put ¶
func (cli *EtcdClient) Put(key, metadata string, timeout time.Duration) error
func (*EtcdClient) Unlock ¶
func (cli *EtcdClient) Unlock(res *LockResult)
type EtcdConfig ¶
type LockResult ¶
type LockResult struct { IsLock bool LeaseID clientv3.LeaseID Cancel context.CancelFunc }
Click to show internal directories.
Click to hide internal directories.