Documentation
¶
Index ¶
- Constants
- type InstanceProperties
- type InstancesFilter
- type InstancesRegistry
- type LocalRegistry
- type Proxy
- func (p *Proxy) LoadInstances(svcKey *model.ServiceKey) (*common.Notifier, error)
- func (p *Proxy) LoadServiceRateLimitRule(key *model.ServiceKey) (*common.Notifier, error)
- func (p *Proxy) LoadServiceRouteRule(key *model.ServiceKey) (*common.Notifier, error)
- func (p *Proxy) PersistMessage(file string, msg proto.Message) error
- func (p *Proxy) SetRealPlugin(plug plugin.Plugin, engine model.Engine)
- func (p *Proxy) UpdateInstances(req *ServiceUpdateRequest) error
- type RuleFilter
- type RuleRegistry
- type ServiceUpdateRequest
Constants ¶
View Source
const ( // PropertyCircuitBreakerStatus InstanceProperties中Properties的key,熔断结果状态 PropertyCircuitBreakerStatus = "CircuitBreakerStatus" // PropertyHealthCheckStatus InstanceProperties中Properties的key,健康探测结果状态 PropertyHealthCheckStatus = "HealthCheckStatus" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanceProperties ¶
type InstanceProperties struct {
Service *model.ServiceKey
ID string
Properties map[string]interface{}
}
InstanceProperties 待更新的实例属性
type InstancesFilter ¶
InstancesFilter 用于在向缓存获取实例时进行过滤
type InstancesRegistry ¶
type InstancesRegistry interface {
// GetInstances 非阻塞获取服务实例列表,只读取缓存
GetInstances(svcKey *model.ServiceKey, includeCache bool, isInternalRequest bool) model.ServiceInstances
// LoadInstances 非阻塞发起一次缓存远程加载操作
// 如果已经加载过了,那就直接进行notify
// 否则,加载完毕后调用notify函数
LoadInstances(svcKey *model.ServiceKey) (*common.Notifier, error)
// UpdateInstances 批量更新服务实例状态,properties存放的是状态值,当前支持2个key
// 1. ReadyToServe: 故障熔断标识,true or false
// 2. DynamicWeight:动态权重值
UpdateInstances(*ServiceUpdateRequest) error
// PersistMessage 对PB缓存进行持久化
PersistMessage(file string, msg proto.Message) error
// LoadPersistedMessage 从文件中加载PB缓存
LoadPersistedMessage(file string, msg proto.Message) error
}
InstancesRegistry 实例缓存
type LocalRegistry ¶
type LocalRegistry interface {
plugin.Plugin
InstancesRegistry
RuleRegistry
}
LocalRegistry 【扩展点接口】本地缓存扩展点
type Proxy ¶
type Proxy struct {
LocalRegistry
// contains filtered or unexported fields
}
Proxy of LocalRegistry
func (*Proxy) LoadInstances ¶
LoadInstances proxy LocalRegistry LoadInstances
func (*Proxy) LoadServiceRateLimitRule ¶
LoadServiceRateLimitRule proxy LocalRegistry LoadServiceRateLimitRule
func (*Proxy) LoadServiceRouteRule ¶
LoadServiceRouteRule proxy LocalRegistry LoadServiceRouteRule
func (*Proxy) PersistMessage ¶
PersistMessage proxy LocalRegistry PersistMessage
func (*Proxy) SetRealPlugin ¶
SetRealPlugin 设置
func (*Proxy) UpdateInstances ¶
func (p *Proxy) UpdateInstances(req *ServiceUpdateRequest) error
UpdateInstances proxy LocalRegistry UpdateInstances
type RuleRegistry ¶
type RuleRegistry interface {
// GetServiceRouteRule 非阻塞获取配置信息
GetServiceRouteRule(key *model.ServiceKey, includeCache bool) model.ServiceRule
// LoadServiceRouteRule 非阻塞发起配置加载
LoadServiceRouteRule(key *model.ServiceKey) (*common.Notifier, error)
// GetServiceRateLimitRule 非阻塞获取限流规则
GetServiceRateLimitRule(key *model.ServiceKey, includeCache bool) model.ServiceRule
// LoadServiceRateLimitRule 非阻塞发起限流规则加载
LoadServiceRateLimitRule(key *model.ServiceKey) (*common.Notifier, error)
// GetServicesByMeta 非阻塞获取批量服务
GetServicesByMeta(key *model.ServiceKey, includeCache bool) model.Services
// LoadServices 非阻塞加载批量服务
LoadServices(key *model.ServiceKey) (*common.Notifier, error)
// WatchService 添加服务监听标识
WatchService(svcEventKey model.ServiceEventKey)
// UnwatchService 取消服务监听标识
UnwatchService(svcEventKey model.ServiceEventKey)
}
RuleRegistry ConfigRegistry 配置缓存
type ServiceUpdateRequest ¶
type ServiceUpdateRequest struct {
model.ServiceKey
Properties []InstanceProperties
}
ServiceUpdateRequest 服务更新请求体
func (ServiceUpdateRequest) String ¶
func (s ServiceUpdateRequest) String() string
String ToString方法
Click to show internal directories.
Click to hide internal directories.