Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type ConsulClient
- func (c *ConsulClient) Get(serviceId string) []*InstanceInfo
- func (c *ConsulClient) GetInternalRegistryStore() *InsInfoArrSyncMap
- func (c *ConsulClient) QueryServices() ([]*InstanceInfo, error)
- func (c *ConsulClient) Register() error
- func (c *ConsulClient) SetInternalRegistryStore(registry *InsInfoArrSyncMap)
- func (c *ConsulClient) StartPeriodicalRefresh() error
- func (c *ConsulClient) UnRegister() error
- type EmptyClient
- func (e EmptyClient) Get(string) []*InstanceInfo
- func (e EmptyClient) GetInternalRegistryStore() *InsInfoArrSyncMap
- func (e EmptyClient) QueryServices() ([]*InstanceInfo, error)
- func (e EmptyClient) Register() error
- func (e EmptyClient) SetInternalRegistryStore(*InsInfoArrSyncMap)
- func (e EmptyClient) StartPeriodicalRefresh() error
- func (e EmptyClient) UnRegister() error
- type EurekaClient
- func (c *EurekaClient) Get(serviceId string) []*InstanceInfo
- func (c *EurekaClient) GetInternalRegistryStore() *InsInfoArrSyncMap
- func (c *EurekaClient) QueryServices() ([]*InstanceInfo, error)
- func (c *EurekaClient) Register() error
- func (c *EurekaClient) SetInternalRegistryStore(registry *InsInfoArrSyncMap)
- func (c *EurekaClient) StartPeriodicalRefresh() error
- func (c *EurekaClient) UnRegister() error
- type InsInfoArrSyncMap
- type InsLbClientSyncMap
- type InstanceInfo
Constants ¶
View Source
const REGISTRY_REFRESH_INTERVAL = 30
Variables ¶
View Source
var DoNothingClient = new(EmptyClient)
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.2.5
type Client interface { // 直接向远程注册中心查询所有服务实例 QueryServices() ([]*InstanceInfo, error) // 注册自己 Register() error // 取消注册自己 UnRegister() error // 从本地缓存中查询指定服务的全部实例信息 Get(string) []*InstanceInfo // 启动注册信息定时刷新逻辑 StartPeriodicalRefresh() error // 获取内部保存的注册表 GetInternalRegistryStore() *InsInfoArrSyncMap // 更新内部保存的注册表 SetInternalRegistryStore(*InsInfoArrSyncMap) }
服务发现客户端接口
func NewConsulClient ¶ added in v1.2.5
func NewEurekaClient ¶ added in v1.2.5
type ConsulClient ¶ added in v1.2.5
type ConsulClient struct {
// contains filtered or unexported fields
}
func (*ConsulClient) Get ¶ added in v1.3.0
func (c *ConsulClient) Get(serviceId string) []*InstanceInfo
func (*ConsulClient) GetInternalRegistryStore ¶ added in v1.3.0
func (c *ConsulClient) GetInternalRegistryStore() *InsInfoArrSyncMap
func (*ConsulClient) QueryServices ¶ added in v1.2.5
func (c *ConsulClient) QueryServices() ([]*InstanceInfo, error)
func (*ConsulClient) Register ¶ added in v1.2.5
func (c *ConsulClient) Register() error
func (*ConsulClient) SetInternalRegistryStore ¶ added in v1.3.0
func (c *ConsulClient) SetInternalRegistryStore(registry *InsInfoArrSyncMap)
func (*ConsulClient) StartPeriodicalRefresh ¶ added in v1.3.0
func (c *ConsulClient) StartPeriodicalRefresh() error
func (*ConsulClient) UnRegister ¶ added in v1.2.5
func (c *ConsulClient) UnRegister() error
type EmptyClient ¶ added in v1.3.0
type EmptyClient struct { }
func (EmptyClient) Get ¶ added in v1.3.0
func (e EmptyClient) Get(string) []*InstanceInfo
func (EmptyClient) GetInternalRegistryStore ¶ added in v1.3.0
func (e EmptyClient) GetInternalRegistryStore() *InsInfoArrSyncMap
func (EmptyClient) QueryServices ¶ added in v1.3.0
func (e EmptyClient) QueryServices() ([]*InstanceInfo, error)
func (EmptyClient) Register ¶ added in v1.3.0
func (e EmptyClient) Register() error
func (EmptyClient) SetInternalRegistryStore ¶ added in v1.3.0
func (e EmptyClient) SetInternalRegistryStore(*InsInfoArrSyncMap)
func (EmptyClient) StartPeriodicalRefresh ¶ added in v1.3.0
func (e EmptyClient) StartPeriodicalRefresh() error
func (EmptyClient) UnRegister ¶ added in v1.3.0
func (e EmptyClient) UnRegister() error
type EurekaClient ¶ added in v1.2.5
type EurekaClient struct {
// contains filtered or unexported fields
}
func (*EurekaClient) Get ¶ added in v1.3.0
func (c *EurekaClient) Get(serviceId string) []*InstanceInfo
func (*EurekaClient) GetInternalRegistryStore ¶ added in v1.3.0
func (c *EurekaClient) GetInternalRegistryStore() *InsInfoArrSyncMap
func (*EurekaClient) QueryServices ¶ added in v1.2.5
func (c *EurekaClient) QueryServices() ([]*InstanceInfo, error)
查询所有服务
func (*EurekaClient) Register ¶ added in v1.2.5
func (c *EurekaClient) Register() error
func (*EurekaClient) SetInternalRegistryStore ¶ added in v1.3.0
func (c *EurekaClient) SetInternalRegistryStore(registry *InsInfoArrSyncMap)
func (*EurekaClient) StartPeriodicalRefresh ¶ added in v1.3.0
func (c *EurekaClient) StartPeriodicalRefresh() error
向eureka查询注册列表, 刷新本地列表
func (*EurekaClient) UnRegister ¶ added in v1.2.5
func (c *EurekaClient) UnRegister() error
type InsInfoArrSyncMap ¶ added in v1.3.0
type InsInfoArrSyncMap struct {
// contains filtered or unexported fields
}
封装sync.map, 提供类型安全的方法调用
func NewInsInfoArrSyncMap ¶ added in v1.3.0
func NewInsInfoArrSyncMap() *InsInfoArrSyncMap
func (*InsInfoArrSyncMap) Each ¶ added in v1.3.0
func (ism *InsInfoArrSyncMap) Each(eachFunc func(key string, val []*InstanceInfo) bool)
func (*InsInfoArrSyncMap) Get ¶ added in v1.3.0
func (ism *InsInfoArrSyncMap) Get(key string) ([]*InstanceInfo, bool)
func (*InsInfoArrSyncMap) GetMap ¶ added in v1.3.0
func (ism *InsInfoArrSyncMap) GetMap() *sync.Map
func (*InsInfoArrSyncMap) Put ¶ added in v1.3.0
func (ism *InsInfoArrSyncMap) Put(key string, val []*InstanceInfo)
type InsLbClientSyncMap ¶ added in v1.3.0
type InsLbClientSyncMap struct {
// contains filtered or unexported fields
}
封装sync.map, 提供类型安全的方法调用
func NewInsMetaLbClientSyncMap ¶ added in v1.3.0
func NewInsMetaLbClientSyncMap() *InsLbClientSyncMap
Click to show internal directories.
Click to hide internal directories.