data

package
v1.5.8-beta.0 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: 20 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildControlParam

func BuildControlParam(
	provider ControlParamProvider, cfg config.Configuration, param *model.ControlParam)

BuildControlParam 为服务注册的请求设置默认值

func BuildInstancesResponse added in v1.4.0

func BuildInstancesResponse(
	dstService model.ServiceKey, cluster *model.Cluster, svcInstances model.ServiceInstances) *model.InstancesResponse

func CheckAddInstances added in v1.4.0

func CheckAddInstances(event *common.ServiceEventObject) *model.InstanceAddEvent

CheckAddInstances check if the instances are valid

func CheckDeleteInstances added in v1.4.0

func CheckDeleteInstances(event *common.ServiceEventObject) *model.InstanceDeleteEvent

CheckDeleteInstances check if the instances are valid

func CheckUpdateInstances added in v1.4.0

func CheckUpdateInstances(event *common.ServiceEventObject) *model.InstanceUpdateEvent

CheckUpdateInstances check if the instances are valid

func GetCircuitBreakers

func GetCircuitBreakers(
	cfg config.Configuration, supplier plugin.Supplier) ([]circuitbreaker.InstanceCircuitBreaker, error)

GetCircuitBreakers 获取熔断插件链

func GetConfigConnector added in v1.1.0

func GetConfigConnector(
	cfg config.Configuration, supplier plugin.Supplier) (configconnector.ConfigConnector, error)

GetConfigConnector 加载配置中心连接器插件

func GetConfigFilterChain added in v1.5.0

func GetConfigFilterChain(cfg config.Configuration, supplier plugin.Supplier) (configfilter.Chain, error)

GetConfigFilterChain 加载配置过滤链

func GetHealthCheckers

func GetHealthCheckers(cfg config.Configuration, supplier plugin.Supplier) ([]healthcheck.HealthChecker, error)

GetHealthCheckers 获取健康探测插件列表

func GetLoadBalancer

func GetLoadBalancer(cfg config.Configuration, supplier plugin.Supplier) (loadbalancer.LoadBalancer, error)

GetLoadBalancer 获取负载均衡插件

func GetLoadBalancerByLbType

func GetLoadBalancerByLbType(lbType string, supplier plugin.Supplier) (loadbalancer.LoadBalancer, error)

GetLoadBalancerByLbType 获取负载均衡插件

func GetRegistry

func GetRegistry(cfg config.Configuration, supplier plugin.Supplier) (localregistry.LocalRegistry, error)

GetRegistry 加载本地缓存插件

func GetServerConnector

func GetServerConnector(
	cfg config.Configuration, supplier plugin.Supplier) (serverconnector.ServerConnector, error)

GetServerConnector 加载连接器插件

func GetServiceRouterChain

func GetServiceRouterChain(cfg config.Configuration, supplier plugin.Supplier) (*servicerouter.RouterChain, error)

GetServiceRouterChain 获取服务路由插件链

func GetStatReporterChain

func GetStatReporterChain(cfg config.Configuration, supplier plugin.Supplier) ([]statreporter.StatReporter, error)

GetStatReporterChain 获取统计上报插件

func PoolPutCommonInstancesRequest

func PoolPutCommonInstancesRequest(request *CommonInstancesRequest)

PoolPutCommonInstancesRequest 归还到请求对象到池子

func PoolPutCommonRateLimitRequest

func PoolPutCommonRateLimitRequest(request *CommonRateLimitRequest)

PoolPutCommonRateLimitRequest 归还到请求对象到池子

func PoolPutCommonRuleRequest

func PoolPutCommonRuleRequest(request *CommonRuleRequest)

PoolPutCommonRuleRequest 归还到请求对象到池子

func PoolPutCommonServiceCallResultRequest

func PoolPutCommonServiceCallResultRequest(request *CommonServiceCallResultRequest)

PoolPutCommonServiceCallResultRequest 归还到请求对象到池子

func PoolPutServicesRequest

func PoolPutServicesRequest(request *ServicesRequest)

PoolPutServicesRequest 归还到请求对象到池子

func RetrySyncCall

func RetrySyncCall(name string, svcKey *model.ServiceKey,
	request interface{}, call SingleInvoke, param *model.ControlParam) (interface{}, model.SDKError)

RetrySyncCall 通用的带重试的同步调用逻辑

Types

type AllEqualsComparable

type AllEqualsComparable struct {
}

AllEqualsComparable 全相同的比较器

func (*AllEqualsComparable) CompareTo

func (a *AllEqualsComparable) CompareTo(value interface{}) int

CompareTo 比较

func (*AllEqualsComparable) EnsureDeleted

func (a *AllEqualsComparable) EnsureDeleted(value interface{}) bool

EnsureDeleted 最终校验是否可以删除该任务

type BaseRequest

type BaseRequest struct {
	FlowID       uint64
	DstService   model.ServiceKey
	SrcService   model.ServiceKey
	Trigger      model.NotifyTrigger
	ControlParam model.ControlParam
	CallResult   model.APICallResult
}

BaseRequest 通用的请求对象基类,实现了基本的方法, 具体请求可继承此类,根据情况实现具体方法

func (*BaseRequest) GetCallResult

func (br *BaseRequest) GetCallResult() *model.APICallResult

GetCallResult 获取结果

func (*BaseRequest) GetControlParam

func (br *BaseRequest) GetControlParam() *model.ControlParam

GetControlParam 获取ControlParam

func (*BaseRequest) GetDstService

func (br *BaseRequest) GetDstService() *model.ServiceKey

GetDstService 获取DstService

func (*BaseRequest) GetNotifierTrigger

func (br *BaseRequest) GetNotifierTrigger() *model.NotifyTrigger

GetNotifierTrigger 获取Trigger

func (*BaseRequest) GetSrcService

func (br *BaseRequest) GetSrcService() *model.ServiceKey

GetSrcService 获取SrcService

func (*BaseRequest) SetDstInstances

func (br *BaseRequest) SetDstInstances(instances model.ServiceInstances)

SetDstInstances 设置实例

func (*BaseRequest) SetDstRateLimit

func (br *BaseRequest) SetDstRateLimit(rule model.ServiceRule)

SetDstRateLimit 设置ratelimit

func (*BaseRequest) SetDstRoute

func (br *BaseRequest) SetDstRoute(rule model.ServiceRule)

SetDstRoute 设置路由规则

func (*BaseRequest) SetServices added in v1.2.0

func (br *BaseRequest) SetServices(mc model.Services)

SetServices 设置网格规则

func (*BaseRequest) SetSrcRoute

func (br *BaseRequest) SetSrcRoute(rule model.ServiceRule)

SetSrcRoute 设置route

type CommonInstancesRequest

type CommonInstancesRequest struct {
	FlowID          uint64
	DstService      model.ServiceKey
	SrcService      model.ServiceKey
	Trigger         model.NotifyTrigger
	HasSrcService   bool
	DoLoadBalance   bool
	RouteInfo       servicerouter.RouteInfo
	DstInstances    model.ServiceInstances
	Criteria        loadbalancer.Criteria
	FetchAll        bool
	SkipRouteFilter bool
	ControlParam    model.ControlParam
	CallResult      model.APICallResult

	// 负载均衡算法
	LbPolicy string
	// 路由插件列表
	Routers []servicerouter.ServiceRouter
	// contains filtered or unexported fields
}

CommonInstancesRequest 通用请求对象,主要用于在消息过程减少GC

func PoolGetCommonInstancesRequest

func PoolGetCommonInstancesRequest(plugins plugin.Supplier) *CommonInstancesRequest

PoolGetCommonInstancesRequest 通过池子获取请求对象

func (*CommonInstancesRequest) BuildInstancesResponse

func (c *CommonInstancesRequest) BuildInstancesResponse(dstService model.ServiceKey, cluster *model.Cluster,
	instances []model.Instance, totalWeight int, svcInstances model.ServiceInstances) *model.InstancesResponse

BuildInstancesResponse 构建查询实例的应答

func (*CommonInstancesRequest) GetCallResult

func (c *CommonInstancesRequest) GetCallResult() *model.APICallResult

GetCallResult 获取接口调用统计结果

func (*CommonInstancesRequest) GetControlParam

func (c *CommonInstancesRequest) GetControlParam() *model.ControlParam

GetControlParam 获取API调用控制参数

func (*CommonInstancesRequest) GetDstService

func (c *CommonInstancesRequest) GetDstService() *model.ServiceKey

GetDstService 获取目标服务

func (*CommonInstancesRequest) GetNotifierTrigger

func (c *CommonInstancesRequest) GetNotifierTrigger() *model.NotifyTrigger

GetNotifierTrigger 获取缓存查询触发器

func (*CommonInstancesRequest) GetSrcService

func (c *CommonInstancesRequest) GetSrcService() *model.ServiceKey

GetSrcService 获取源服务

func (*CommonInstancesRequest) InitByGetAllRequest

func (c *CommonInstancesRequest) InitByGetAllRequest(request *model.GetAllInstancesRequest, cfg config.Configuration)

InitByGetAllRequest 通过获取全部请求初始化通用请求对象

func (*CommonInstancesRequest) InitByGetMultiRequest

func (c *CommonInstancesRequest) InitByGetMultiRequest(request *model.GetInstancesRequest, cfg config.Configuration)

InitByGetMultiRequest 通过获取多个请求初始化通用请求对象

func (*CommonInstancesRequest) InitByGetOneRequest

func (c *CommonInstancesRequest) InitByGetOneRequest(request *model.GetOneInstanceRequest, cfg config.Configuration)

InitByGetOneRequest 通过获取单个请求初始化通用请求对象

func (*CommonInstancesRequest) InitByProcessLoadBalanceRequest added in v1.2.0

func (c *CommonInstancesRequest) InitByProcessLoadBalanceRequest(
	request *model.ProcessLoadBalanceRequest, cfg config.Configuration)

func (*CommonInstancesRequest) InitByProcessRoutersRequest added in v1.2.0

func (c *CommonInstancesRequest) InitByProcessRoutersRequest(
	request *model.ProcessRoutersRequest, cfg config.Configuration, routers []servicerouter.ServiceRouter)

func (*CommonInstancesRequest) RefreshByRedirect

func (c *CommonInstancesRequest) RefreshByRedirect(redirectedService *model.ServiceInfo)

RefreshByRedirect 通过重定向服务来进行刷新

func (*CommonInstancesRequest) SetDstInstances

func (c *CommonInstancesRequest) SetDstInstances(instances model.ServiceInstances)

SetDstInstances 设置目标服务实例

func (*CommonInstancesRequest) SetDstRateLimit

func (c *CommonInstancesRequest) SetDstRateLimit(rule model.ServiceRule)

SetDstRateLimit 设置目标服务限流规则

func (*CommonInstancesRequest) SetDstRoute

func (c *CommonInstancesRequest) SetDstRoute(rule model.ServiceRule)

SetDstRoute 设置目标服务路由规则

func (*CommonInstancesRequest) SetServices added in v1.2.0

func (c *CommonInstancesRequest) SetServices(mc model.Services)

SetServices 设置网格规则

func (*CommonInstancesRequest) SetSrcRoute

func (c *CommonInstancesRequest) SetSrcRoute(rule model.ServiceRule)

SetSrcRoute 设置源服务路由规则

type CommonRateLimitRequest

type CommonRateLimitRequest struct {
	QuotaRequest  *model.QuotaRequestImpl
	DstService    model.ServiceKey
	Token         uint32
	Method        string
	Arguments     map[int]map[string]string
	RateLimitRule model.ServiceRule
	Trigger       model.NotifyTrigger
	ControlParam  model.ControlParam
	CallResult    model.APICallResult
}

CommonRateLimitRequest 通用限流接口的请求体

func PoolGetCommonRateLimitRequest

func PoolGetCommonRateLimitRequest() *CommonRateLimitRequest

PoolGetCommonRateLimitRequest 通过池子获取请求对象

func (*CommonRateLimitRequest) GetCallResult

func (cl *CommonRateLimitRequest) GetCallResult() *model.APICallResult

GetCallResult 获取接口调用统计结果

func (*CommonRateLimitRequest) GetControlParam

func (cl *CommonRateLimitRequest) GetControlParam() *model.ControlParam

GetControlParam 获取API调用控制参数

func (*CommonRateLimitRequest) GetDstService

func (cl *CommonRateLimitRequest) GetDstService() *model.ServiceKey

GetDstService 获取目标服务

func (*CommonRateLimitRequest) GetNotifierTrigger

func (cl *CommonRateLimitRequest) GetNotifierTrigger() *model.NotifyTrigger

GetNotifierTrigger 获取缓存查询触发器

func (*CommonRateLimitRequest) GetSrcService

func (cl *CommonRateLimitRequest) GetSrcService() *model.ServiceKey

GetSrcService 获取源服务

func (*CommonRateLimitRequest) InitByGetQuotaRequest

func (cl *CommonRateLimitRequest) InitByGetQuotaRequest(request *model.QuotaRequestImpl, cfg config.Configuration)

InitByGetQuotaRequest 初始化配额获取请求

func (*CommonRateLimitRequest) SetDstInstances

func (cl *CommonRateLimitRequest) SetDstInstances(instances model.ServiceInstances)

SetDstInstances 设置目标服务实例

func (*CommonRateLimitRequest) SetDstRateLimit

func (cl *CommonRateLimitRequest) SetDstRateLimit(rule model.ServiceRule)

SetDstRateLimit 设置目标服务限流规则

func (*CommonRateLimitRequest) SetDstRoute

func (cl *CommonRateLimitRequest) SetDstRoute(rule model.ServiceRule)

SetDstRoute 设置目标服务路由规则

func (*CommonRateLimitRequest) SetServices added in v1.2.0

func (cl *CommonRateLimitRequest) SetServices(mc model.Services)

SetServices 设置网格规则

func (*CommonRateLimitRequest) SetSrcRoute

func (cl *CommonRateLimitRequest) SetSrcRoute(rule model.ServiceRule)

SetSrcRoute 设置源服务路由规则

type CommonRuleRequest

type CommonRuleRequest struct {
	FlowID       uint64
	DstService   model.ServiceEventKey
	ControlParam model.ControlParam
	CallResult   model.APICallResult
	// contains filtered or unexported fields
}

CommonRuleRequest 通用规则查询请求

func PoolGetCommonRuleRequest

func PoolGetCommonRuleRequest() *CommonRuleRequest

PoolGetCommonRuleRequest 通过池子获取请求对象

func (*CommonRuleRequest) BuildServiceRuleResponse

func (cr *CommonRuleRequest) BuildServiceRuleResponse(rule model.ServiceRule) *model.ServiceRuleResponse

BuildServiceRuleResponse 构建规则查询应答

func (*CommonRuleRequest) GetCallResult

func (cr *CommonRuleRequest) GetCallResult() *model.APICallResult

GetCallResult 获取接口调用统计结果

func (*CommonRuleRequest) GetControlParam

func (cr *CommonRuleRequest) GetControlParam() *model.ControlParam

GetControlParam 获取API调用控制参数

func (*CommonRuleRequest) InitByGetRuleRequest

func (cr *CommonRuleRequest) InitByGetRuleRequest(
	eventType model.EventType, request *model.GetServiceRuleRequest, cfg config.Configuration)

InitByGetRuleRequest 通过获取路由规则请求初始化通用请求对象

type CommonServiceCallResultRequest

type CommonServiceCallResultRequest struct {
	CallResult model.APICallResult
}

CommonServiceCallResultRequest 公共服务调用结果请求

func PoolGetCommonServiceCallResultRequest

func PoolGetCommonServiceCallResultRequest(plugins plugin.Supplier) *CommonServiceCallResultRequest

PoolGetCommonServiceCallResultRequest 通过池子获取请求对象

func (*CommonServiceCallResultRequest) InitByServiceCallResult

func (c *CommonServiceCallResultRequest) InitByServiceCallResult(request *model.ServiceCallResult,
	cfg config.Configuration)

InitByServiceCallResult 初始化服务调用结果请求

type ConsumerInitCallServiceResultRequest

type ConsumerInitCallServiceResultRequest struct {
	CallResult model.APICallResult
}

ConsumerInitCallServiceResultRequest 初始化消费者调用服务结果请求

func (*ConsumerInitCallServiceResultRequest) InitByServiceCallResult

InitByServiceCallResult 初始化服务调用结果请求

type ControlParamProvider

type ControlParamProvider interface {
	// 获取超时值指针
	GetTimeoutPtr() *time.Duration
	// 设置超时时间间隔
	SetTimeout(duration time.Duration)
	// 获取重试次数指针
	GetRetryCountPtr() *int
	// 设置重试次数
	SetRetryCount(int)
}

ControlParamProvider 控制参数提供者

type ServiceKeyComparable

type ServiceKeyComparable struct {
	SvcKey model.ServiceKey
}

ServiceKeyComparable 服务主键比较器

func (*ServiceKeyComparable) CompareTo

func (a *ServiceKeyComparable) CompareTo(value interface{}) int

CompareTo 比较

func (*ServiceKeyComparable) EnsureDeleted

func (a *ServiceKeyComparable) EnsureDeleted(value interface{}) bool

EnsureDeleted 最终校验是否可以删除该任务

type ServicesRequest

type ServicesRequest struct {
	BaseRequest
	Services model.Services
}

ServicesRequest 获取服务列表请求

func PoolGetServicesRequest

func PoolGetServicesRequest() *ServicesRequest

PoolGetServicesRequest 获取对象池中请求

func (*ServicesRequest) BuildServicesResponse

func (cr *ServicesRequest) BuildServicesResponse(mesh model.Services) *model.ServicesResponse

BuildServicesResponse 构建答复

func (*ServicesRequest) GetServices

func (cr *ServicesRequest) GetServices() model.Services

GetServices 获取services

func (*ServicesRequest) InitByGetServicesRequest

func (cr *ServicesRequest) InitByGetServicesRequest(
	eventType model.EventType, request *model.GetServicesRequest, cfg config.Configuration)

InitByGetServicesRequest 初始化请求

func (*ServicesRequest) SetServices added in v1.2.0

func (cr *ServicesRequest) SetServices(mc model.Services)

SetServices 设置网格规则

type SingleInstancesOwner

type SingleInstancesOwner interface {
	// SingleInstances 获取单个实例数组引用
	SingleInstances() []model.Instance
}

SingleInstancesOwner 获取单个实例数组的持有者

type SingleInvoke

type SingleInvoke func(request interface{}) (interface{}, error)

SingleInvoke 同步调用的通用方法定义

Jump to

Keyboard shortcuts

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