common

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

LoadedPluginTypes 要加载的插件类型

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier 通知回调器的函数

func NewNotifier

func NewNotifier() *Notifier

NewNotifier 创建通知器

func (*Notifier) GetContext

func (n *Notifier) GetContext() context.Context

GetContext 获取回调上下文

func (*Notifier) GetError

func (n *Notifier) GetError() model.SDKError

GetError 获取回调错误

func (*Notifier) Notify

func (n *Notifier) Notify(sdkErr model.SDKError)

Notify 执行回调通知

type PluginEvent

type PluginEvent struct {
	// 事件类型
	EventType PluginEventType
	// 事件对象
	EventObject interface{}
}

PluginEvent 插件事件

type PluginEventHandler

type PluginEventHandler struct {
	Callback func(event *PluginEvent) error
}

PluginEventHandler 触发插件事件的回调

type PluginEventType

type PluginEventType int

PluginEventType .

const (
	// OnInstanceLocalValueCreated 本地缓存实例创建后触发的时机
	OnInstanceLocalValueCreated PluginEventType = 0x8001
	// OnContextStarted 在所有插件创建完毕后触发的事件
	OnContextStarted PluginEventType = 0x8002
	// OnServiceAdded sdk内存中添加了一个服务(实例或路由)触发的事件
	OnServiceAdded PluginEventType = 0x8003
	// OnServiceUpdated sdk内存中更新了一个服务(实例或路由)触发的事件
	OnServiceUpdated PluginEventType = 0x8004
	// OnServiceDeleted sdk内存中删除了一个服务(实例或路由)触发的事件
	OnServiceDeleted PluginEventType = 0x8005
	// OnRoutedClusterReturned 一个经过路由的cluster返回给用户
	OnRoutedClusterReturned PluginEventType = 0x8006
	// OnServiceLocalValueCreated 一个服务的localvalue创建触发的事件
	OnServiceLocalValueCreated PluginEventType = 0x8007
	// OnRateLimitWindowCreated 一个限流规则的限流窗口创建时触发的事件
	OnRateLimitWindowCreated PluginEventType = 0x8008
	// OnRateLimitWindowDeleted 一个限流规则的限流窗口被删除时触发的事件
	OnRateLimitWindowDeleted PluginEventType = 0x8009
)

type RateLimitDiffInfo

type RateLimitDiffInfo struct {
	// 哪些规则的版本变化了,key为ruleID,value为RevisionChange
	UpdatedRules map[string]*RevisionChange
	// 哪些规则被删除了,key为ruleID,value为revision
	DeletedRules map[string]string
}

RateLimitDiffInfo 限流规则的变化信息

type RevisionChange

type RevisionChange struct {
	OldRevision string
	NewRevision string
}

RevisionChange 版本号变化

type RunContext

type RunContext struct {
	// contains filtered or unexported fields
}

RunContext 控制插件启动销毁的运行上下文

func NewRunContext

func NewRunContext() *RunContext

NewRunContext 创建插件运行上下文

func (*RunContext) Destroy

func (c *RunContext) Destroy() error

Destroy 销毁运行上下文

func (*RunContext) Done

func (c *RunContext) Done() <-chan struct{}

Done 获取控制channel

func (*RunContext) IsDestroyed

func (c *RunContext) IsDestroyed() bool

IsDestroyed 判断是否已经销毁

type ServiceEventObject

type ServiceEventObject struct {
	// 事件对象信息
	SvcEventKey model.ServiceEventKey
	// 缓存中已有的对象,如果是新增,则为nil
	OldValue interface{}
	// 新加入缓存的对象,如果是删除,则为nil
	NewValue interface{}
}

ServiceEventObject 服务变更对象,对于OnServiceAdded,OnServiceUpdated,OnServiceDeleted的事件,会传递该对象

type Type

type Type uint32

Type 插件类型,每个扩展点有自己独立的插件类型

const (
	// TypePluginBase .
	TypePluginBase Type = 0x1000
	// TypeServerConnector 注册中心连接器扩展点
	TypeServerConnector Type = 0x1001
	// TypeLocalRegistry 本地缓存扩展点
	TypeLocalRegistry Type = 0x1002
	// TypeServiceRouter 服务路由扩展点
	TypeServiceRouter Type = 0x1003
	// TypeLoadBalancer 负载均衡扩展点
	TypeLoadBalancer Type = 0x1004
	// TypeHealthCheck 健康探测扩展点
	TypeHealthCheck Type = 0x1005
	// TypeCircuitBreaker 节点熔断扩展点
	TypeCircuitBreaker Type = 0x1006
	// TypeWeightAdjuster 动态权重调整扩展点
	TypeWeightAdjuster Type = 0x1007
	// TypeStatReporter 统计上报扩展点
	TypeStatReporter Type = 0x1008
	// TypeRateLimiter 限流扩展点
	TypeRateLimiter Type = 0x1010
	// TypeLocationProvider 实例地理信息获取扩展点
	TypeLocationProvider Type = 0x1012
	// TypeConfigConnector extend point of config file connector
	TypeConfigConnector Type = 0x1014
	// TypeConfigFilter extend point of config file filter
	TypeConfigFilter Type = 0x1015
)

func (Type) String

func (t Type) String() string

ToString方法

Jump to

Keyboard shortcuts

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