Documentation ¶
Index ¶
- Constants
- Variables
- func ReleaseEtcdCache(cache *EtcdCtl)
- type EtcdCtl
- func (this *EtcdCtl) Del(key string, attrs ...*OperationAttr) *Result.ErrorResult
- func (this *EtcdCtl) DelLease(key clientv3.LeaseID) *Result.ErrorResult
- func (this *EtcdCtl) Get(key string, attrs ...*OperationAttr) *Result.ErrorResult
- func (this *EtcdCtl) KeepAlive(LeaseID clientv3.LeaseID)
- func (this *EtcdCtl) KeepAliveWithContext(ctx context.Context, LeaseID clientv3.LeaseID)
- func (this *EtcdCtl) Lease(time int64) clientv3.LeaseID
- func (this *EtcdCtl) LoadService(name string) []LoadBalance.NodeBalance
- func (this *EtcdCtl) Lock(lockName string, fn func(params ...any), params ...any) error
- func (this *EtcdCtl) Name() string
- func (this *EtcdCtl) Put(key string, value string, attrs ...*OperationAttr) Result.Any
- func (this *EtcdCtl) RegService(info ServiceInfo)
- func (this *EtcdCtl) Seletor(Services LoadBalance.NodeBalanceSlice, selectType int, ip string) (LoadBalance.NodeBalance, error)
- func (this *EtcdCtl) UnregService(id string)
- type OperationAttr
- type OperationAttrs
- type ServiceInfo
Constants ¶
View Source
const ( ATTR_WithPrevKV = "WithPrevKV" //过期时间 ATTR_Lease = "Lease" // setnx ATTR_WithTime = "WithTime" // setxx )
可添加的属性
Variables ¶
View Source
var LB = LoadBalance.New()
Functions ¶
func ReleaseEtcdCache ¶
func ReleaseEtcdCache(cache *EtcdCtl)
Types ¶
type EtcdCtl ¶
type EtcdCtl struct { EtcdClient *clientv3.Client `inject:"-"` // contains filtered or unexported fields }
func (*EtcdCtl) Del ¶
func (this *EtcdCtl) Del(key string, attrs ...*OperationAttr) *Result.ErrorResult
删除操作
func (*EtcdCtl) DelLease ¶
func (this *EtcdCtl) DelLease(key clientv3.LeaseID) *Result.ErrorResult
删除租约
func (*EtcdCtl) Get ¶
func (this *EtcdCtl) Get(key string, attrs ...*OperationAttr) *Result.ErrorResult
取值
func (*EtcdCtl) KeepAliveWithContext ¶
func (*EtcdCtl) LoadService ¶
func (this *EtcdCtl) LoadService(name string) []LoadBalance.NodeBalance
取得数据
func (*EtcdCtl) Seletor ¶
func (this *EtcdCtl) Seletor(Services LoadBalance.NodeBalanceSlice, selectType int, ip string) (LoadBalance.NodeBalance, error)
选择器
type OperationAttr ¶
type OperationAttr struct { Name string Value any }
属性
func WithLease ¶
func WithLease(Lease clientv3.LeaseID) *OperationAttr
func WithPrevKV ¶
func WithPrevKV() *OperationAttr
func WithTime ¶
func WithTime(time int64) *OperationAttr
type OperationAttrs ¶
type OperationAttrs []*OperationAttr
func (OperationAttrs) Find ¶
func (this OperationAttrs) Find(name string) *Result.ErrorResult
查找对应属性限制传入的参数
type ServiceInfo ¶
type ServiceInfo struct { ServiceID string ServiceName string ServiceAddr string ServiceType string ServiceHost string *LoadBalance.DefaultBalance }
func (*ServiceInfo) GetNode ¶
func (this *ServiceInfo) GetNode() interface{}
Click to show internal directories.
Click to hide internal directories.