Documentation
¶
Index ¶
- Constants
- Variables
- func ReleaseEtcdCache(cache *EtcdCtl)
- type EtcdCtl
- func (this *EtcdCtl) Del(key string, attrs ...*OperationAttr) (*clientv3.DeleteResponse, error)
- func (this *EtcdCtl) DelLease(key clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
- func (this *EtcdCtl) Get(key string, attrs ...*OperationAttr) (*clientv3.GetResponse, error)
- func (this *EtcdCtl) KeepAlive(LeaseID clientv3.LeaseID) error
- func (this *EtcdCtl) KeepAliveWithContext(ctx context.Context, LeaseID clientv3.LeaseID) error
- func (this *EtcdCtl) Lease(time int64) clientv3.LeaseID
- func (this *EtcdCtl) LoadService(name string) ([]*ServiceInfo, error)
- func (this *EtcdCtl) Lock(lockName string, fn func(params ...interface{}), params ...interface{}) error
- func (this *EtcdCtl) Name() string
- func (this *EtcdCtl) Put(key string, value string, attrs ...*OperationAttr) interface{}
- func (this *EtcdCtl) RegService(info ServiceInfo)
- func (this *EtcdCtl) Seletor(Services []*ServiceInfo, selectType int, ip string) (LoadBalance.NodeBalance, error)
- func (this *EtcdCtl) UnregService(id string) error
- 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) (*clientv3.DeleteResponse, error)
func (*EtcdCtl) Get ¶
func (this *EtcdCtl) Get(key string, attrs ...*OperationAttr) (*clientv3.GetResponse, error)
func (*EtcdCtl) KeepAliveWithContext ¶
func (*EtcdCtl) LoadService ¶
func (this *EtcdCtl) LoadService(name string) ([]*ServiceInfo, error)
func (*EtcdCtl) Put ¶
func (this *EtcdCtl) Put(key string, value string, attrs ...*OperationAttr) interface{}
func (*EtcdCtl) Seletor ¶
func (this *EtcdCtl) Seletor(Services []*ServiceInfo, selectType int, ip string) (LoadBalance.NodeBalance, error)
type OperationAttr ¶
type OperationAttr struct { Name string Value interface{} }
属性
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 ServiceWight int Status string CWeight int }
func (*ServiceInfo) GetCWeight ¶
func (this *ServiceInfo) GetCWeight() int
func (*ServiceInfo) GetNode ¶
func (this *ServiceInfo) GetNode() interface{}
func (*ServiceInfo) GetStatus ¶
func (this *ServiceInfo) GetStatus() string
func (*ServiceInfo) GetWeight ¶
func (this *ServiceInfo) GetWeight() int
func (*ServiceInfo) SetCWeight ¶
func (this *ServiceInfo) SetCWeight(val int)
Click to show internal directories.
Click to hide internal directories.