localregistry

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 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 {
	// GetServices 获取服务列表,返回结果为一个hashSet, key为类型plugin.ServiceKey
	GetServices() model.HashSet
	// 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
	// WatchService 服务订阅
	WatchService(svcKey *model.ServiceEventKey) error
}

InstancesRegistry 实例缓存

type LocalRegistry

type LocalRegistry interface {
	plugin.Plugin
	InstancesRegistry
	RuleRegistry
}

LocalRegistry 【扩展点接口】本地缓存扩展点

type Proxy

type Proxy struct {
	LocalRegistry
	// contains filtered or unexported fields
}

Proxy proxy of LocalRegistry

func (*Proxy) LoadInstances

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

LoadInstances proxy LocalRegistry LoadInstances

func (*Proxy) LoadMeshConfig

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

LoadMeshConfig 加载网格规则

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)

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)
	// GetMeshConfig 非阻塞获取网格规则
	GetMeshConfig(key *model.ServiceKey, includeCache bool) model.MeshConfig
	// LoadMeshConfig 非阻塞发起网格规则加载
	LoadMeshConfig(key *model.ServiceKey) (*common.Notifier, error)
	// GetMesh 非阻塞获取网格
	GetMesh(key *model.ServiceKey, includeCache bool) model.Mesh
	// LoadMesh 非阻塞发起网格加载
	LoadMesh(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)
}

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