Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶
type IClient ¶
type IClient interface { // Close 关闭客户端 Close() // Put 保存KV Put(key, value string) (*Header, error) // PutLease 保存KV,同时赋加租约 PutLease(key, value string, leaseId LeaseID) (*Header, error) // PutJson 保存KV(data转成json) PutJson(key string, data any) (*Header, error) // PutJsonLease 保存KV(data转成json),同时赋加租约 PutJsonLease(key string, data any, leaseId LeaseID) (*Header, error) // Get 获取Value值 Get(key string) (*KeyValue, error) // GetPrefixKey 根据KEY前缀获取Value值 GetPrefixKey(prefixKey string) (map[string]*KeyValue, error) // Delete 删除KEY Delete(key string) (*Header, error) // DeletePrefixKey 根据KEY前缀来删除 DeletePrefixKey(prefixKey string) (*Header, error) // Exists 判断是否存在KEY Exists(key string) bool // Watch 监听KEY Watch(ctx context.Context, key string, watchFunc func(event WatchEvent)) // WatchPrefixKey 根据KEY前缀来监听 WatchPrefixKey(ctx context.Context, prefixKey string, watchFunc func(event WatchEvent)) // LeaseGrant 创建租约,ttl:租约的时间(单位s),keys:要赋加租约的KEY LeaseGrant(ttl int64, keys ...string) (LeaseID, error) // LeaseKeepAlive 续租(持续) LeaseKeepAlive(ctx context.Context, leaseId LeaseID) error // LeaseKeepAliveOnce 续租一次 LeaseKeepAliveOnce(leaseId LeaseID) error // LeaseRevoke 删除租约(会使当前租约的所关联的key-value失效) LeaseRevoke(leaseId LeaseID) (*Header, error) // LeaseInfo 查询租约信息 LeaseInfo(leaseId LeaseID) (*LeaseInfo, error) // Lock 添加锁 Lock(lockKey string, lockTTL int) (UnLock, error) // Original 原客户端对象 Original() *etcdClient }
type KeyValue ¶
type KeyValue struct { Header *Header // key 保存到etcd的KEY Key string // 创建KEY时的集群Revision(此后这个版本号不会再变) CreateRevision int64 // 修改改这个 key 时的集群Revision(每次修改都会重新获取最新的集群Revision) ModRevision int64 // 对KEY的任何修改,都会导致版本号增加(默认为1) Version int64 // value Value string // 租约ID Lease int64 }
KeyValue KV信息
type Module ¶
type Module struct { }
func (Module) DependsModule ¶
func (module Module) DependsModule() []modules.FarseerModule
func (Module) Initialize ¶
func (module Module) Initialize()
type WatchEvent ¶
WatchEvent 监听事件
Click to show internal directories.
Click to hide internal directories.