localregistry

package
v1.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 6 Imported by: 0

Documentation

Index

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 待更新的实例属性

func (InstanceProperties) String

func (i InstanceProperties) String() string

String ToString方法

type InstancesFilter

type InstancesFilter struct {
	Service           string
	Namespace         string
	IsInternalRequest bool
}

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

func (p *Proxy) LoadInstances(svcKey *model.ServiceKey) (*common.Notifier, error)

LoadInstances proxy LocalRegistry LoadInstances

func (*Proxy) LoadServiceRateLimitRule

func (p *Proxy) LoadServiceRateLimitRule(key *model.ServiceKey) (*common.Notifier, error)

LoadServiceRateLimitRule proxy LocalRegistry LoadServiceRateLimitRule

func (*Proxy) LoadServiceRouteRule

func (p *Proxy) LoadServiceRouteRule(key *model.ServiceKey) (*common.Notifier, error)

LoadServiceRouteRule proxy LocalRegistry LoadServiceRouteRule

func (*Proxy) PersistMessage

func (p *Proxy) PersistMessage(file string, msg proto.Message) error

PersistMessage proxy LocalRegistry PersistMessage

func (*Proxy) SetRealPlugin

func (p *Proxy) SetRealPlugin(plug plugin.Plugin, engine model.Engine)

SetRealPlugin 设置

func (*Proxy) UpdateInstances

func (p *Proxy) UpdateInstances(req *ServiceUpdateRequest) error

UpdateInstances proxy LocalRegistry UpdateInstances

type RuleFilter

type RuleFilter struct {
	model.ServiceEventKey
}

RuleFilter 配置获取的过滤器

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方法

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL