Documentation ¶
Index ¶
- Constants
- func InitFlowEngine(flowEngine *Engine, initContext plugin.InitContext) error
- type CircuitBreakerFlow
- func (e *CircuitBreakerFlow) Check(resource model.Resource) (*model.CheckResult, error)
- func (e *CircuitBreakerFlow) MakeFunctionDecorator(f model.CustomerFunction, reqCtx *model.RequestContext) model.DecoratorFunction
- func (e *CircuitBreakerFlow) MakeInvokeHandler(reqCtx *model.RequestContext) model.InvokeHandler
- func (e *CircuitBreakerFlow) Report(reportStat *model.ResourceStat) error
- type CombineNotifyContext
- type ContextKey
- type DefaultFunctionalDecorator
- type DefaultInvokeHandler
- type Engine
- func (e *Engine) AsyncGetQuota(request *model.QuotaRequestImpl) (*model.QuotaFutureImpl, error)
- func (e *Engine) Check(resource model.Resource) (*model.CheckResult, error)
- func (e *Engine) CircuitBreakerFlow() *CircuitBreakerFlow
- func (e *Engine) Destroy() error
- func (e *Engine) FlowQuotaAssistant() *quota.FlowQuotaAssistant
- func (e *Engine) GetContext() model.ValueContext
- func (e *Engine) InitCalleeService(req *model.InitCalleeServiceRequest) error
- func (e *Engine) LoadFlowRouteChain() error
- func (e *Engine) MakeFunctionDecorator(f model.CustomerFunction, reqCtx *model.RequestContext) model.DecoratorFunction
- func (e *Engine) MakeInvokeHandler(reqCtx *model.RequestContext) model.InvokeHandler
- func (e *Engine) PluginSupplier() plugin.Supplier
- func (e *Engine) ProcessLoadBalance(req *model.ProcessLoadBalanceRequest) (*model.OneInstanceResponse, error)
- func (e *Engine) ProcessRouters(req *model.ProcessRoutersRequest) (*model.InstancesResponse, error)
- func (e *Engine) Report(reportStat *model.ResourceStat) error
- func (e *Engine) ScheduleTask(task *model.PeriodicTask) (chan<- *model.PriorityTask, model.TaskValues)
- func (e *Engine) ServiceEventCallback(event *common.PluginEvent) error
- func (e *Engine) Start() error
- func (e *Engine) SyncCreateConfigFile(namespace, fileGroup, fileName, content string) error
- func (e *Engine) SyncDeregister(instance *model.InstanceDeRegisterRequest) error
- func (e *Engine) SyncGetAllInstances(req *model.GetAllInstancesRequest) (*model.InstancesResponse, error)
- func (e *Engine) SyncGetConfigFile(req *model.GetConfigFileRequest) (model.ConfigFile, error)
- func (e *Engine) SyncGetConfigGroup(namespace, fileGroup string) (model.ConfigFileGroup, error)
- func (e *Engine) SyncGetInstances(req *model.GetInstancesRequest) (*model.InstancesResponse, error)
- func (e *Engine) SyncGetOneInstance(req *model.GetOneInstanceRequest) (*model.OneInstanceResponse, error)
- func (e *Engine) SyncGetResources(req model.CacheValueQuery) error
- func (e *Engine) SyncGetServiceRule(eventType model.EventType, req *model.GetServiceRuleRequest) (*model.ServiceRuleResponse, error)
- func (e *Engine) SyncGetServices(eventType model.EventType, req *model.GetServicesRequest) (*model.ServicesResponse, error)
- func (e *Engine) SyncHeartbeat(instance *model.InstanceHeartbeatRequest) error
- func (e *Engine) SyncPublishConfigFile(namespace, fileGroup, fileName string) error
- func (e *Engine) SyncRegister(instance *model.InstanceRegisterRequest) (*model.InstanceRegisterResponse, error)
- func (e *Engine) SyncReportStat(typ model.MetricType, stat model.InstanceGauge) error
- func (e *Engine) SyncUpdateConfigFile(namespace, fileGroup, fileName, content string) error
- func (e *Engine) SyncUpdateServiceCallResult(result *model.ServiceCallResult) error
- func (e *Engine) WatchAllInstances(request *model.WatchAllInstancesRequest) (*model.WatchAllInstancesResponse, error)
- func (e *Engine) WatchAllServices(request *model.WatchAllServicesRequest) (*model.WatchAllServicesResponse, error)
- func (e *Engine) WatchService(req *model.WatchServiceRequest) (*model.WatchServiceResponse, error)
- type LongPullContext
- type NotifyUpdateContext
- type SingleNotifyContext
- type WatchContext
- type WatchEngine
- func (w *WatchEngine) CancelWatch(watchId uint64)
- func (w *WatchEngine) ServiceEventCallback(event *common.PluginEvent) error
- func (w *WatchEngine) WatchAllInstances(request *model.WatchAllInstancesRequest) (*model.WatchAllInstancesResponse, error)
- func (w *WatchEngine) WatchAllServices(request *model.WatchAllServicesRequest) (*model.WatchAllServicesResponse, error)
Constants ¶
const (
AllNamespace = "*"
)
Variables ¶
This section is empty.
Functions ¶
func InitFlowEngine ¶
func InitFlowEngine(flowEngine *Engine, initContext plugin.InitContext) error
InitFlowEngine 初始化flowEngine实例
Types ¶
type CircuitBreakerFlow ¶
type CircuitBreakerFlow struct {
// contains filtered or unexported fields
}
func (*CircuitBreakerFlow) Check ¶
func (e *CircuitBreakerFlow) Check(resource model.Resource) (*model.CheckResult, error)
func (*CircuitBreakerFlow) MakeFunctionDecorator ¶
func (e *CircuitBreakerFlow) MakeFunctionDecorator(f model.CustomerFunction, reqCtx *model.RequestContext) model.DecoratorFunction
func (*CircuitBreakerFlow) MakeInvokeHandler ¶
func (e *CircuitBreakerFlow) MakeInvokeHandler(reqCtx *model.RequestContext) model.InvokeHandler
func (*CircuitBreakerFlow) Report ¶
func (e *CircuitBreakerFlow) Report(reportStat *model.ResourceStat) error
type CombineNotifyContext ¶
type CombineNotifyContext struct {
// contains filtered or unexported fields
}
CombineNotifyContext 复合的回调上下文,等待所有的子回调都返回才会触发回调
func NewCombineNotifyContext ¶
func NewCombineNotifyContext(svcKey *model.ServiceKey, notifiers []*SingleNotifyContext) *CombineNotifyContext
NewCombineNotifyContext 创建复合回调上下文
func (*CombineNotifyContext) Errs ¶
func (c *CombineNotifyContext) Errs() map[ContextKey]model.SDKError
Errs 获取错误信息集合
type ContextKey ¶
type ContextKey struct { // 服务信息 ServiceKey *model.ServiceKey // 操作信息 Operation string }
ContextKey 上下文标识
type DefaultFunctionalDecorator ¶
type DefaultFunctionalDecorator struct {
// contains filtered or unexported fields
}
func (*DefaultFunctionalDecorator) Decorator ¶
func (df *DefaultFunctionalDecorator) Decorator(ctx context.Context, args interface{}) (interface{}, *model.CallAborted, error)
type DefaultInvokeHandler ¶
type DefaultInvokeHandler struct {
// contains filtered or unexported fields
}
func (*DefaultInvokeHandler) AcquirePermission ¶
func (h *DefaultInvokeHandler) AcquirePermission() (bool, *model.CallAborted, error)
func (*DefaultInvokeHandler) OnError ¶
func (h *DefaultInvokeHandler) OnError(respCtx *model.ResponseContext)
func (*DefaultInvokeHandler) OnSuccess ¶
func (h *DefaultInvokeHandler) OnSuccess(respCtx *model.ResponseContext)
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine 编排调度引擎,API相关逻辑在这里执行
func (*Engine) AsyncGetQuota ¶
func (e *Engine) AsyncGetQuota(request *model.QuotaRequestImpl) (*model.QuotaFutureImpl, error)
AsyncGetQuota 异步获取配额信息
func (*Engine) CircuitBreakerFlow ¶
func (e *Engine) CircuitBreakerFlow() *CircuitBreakerFlow
func (*Engine) FlowQuotaAssistant ¶
func (e *Engine) FlowQuotaAssistant() *quota.FlowQuotaAssistant
FlowQuotaAssistant 获取流程辅助类
func (*Engine) InitCalleeService ¶
func (e *Engine) InitCalleeService(req *model.InitCalleeServiceRequest) error
InitCalleeService 初始化服务运行中需要的被调服务
func (*Engine) LoadFlowRouteChain ¶
LoadFlowRouteChain 加载服务路由链插件
func (*Engine) MakeFunctionDecorator ¶
func (e *Engine) MakeFunctionDecorator(f model.CustomerFunction, reqCtx *model.RequestContext) model.DecoratorFunction
MakeFunctionDecorator
func (*Engine) MakeInvokeHandler ¶
func (e *Engine) MakeInvokeHandler(reqCtx *model.RequestContext) model.InvokeHandler
MakeInvokeHandler
func (*Engine) PluginSupplier ¶
PluginSupplier 获取插件工厂
func (*Engine) ProcessLoadBalance ¶ added in v1.2.0
func (e *Engine) ProcessLoadBalance(req *model.ProcessLoadBalanceRequest) (*model.OneInstanceResponse, error)
ProcessLoadBalance 执行负载均衡策略,返回负载均衡后的实例
func (*Engine) ProcessRouters ¶ added in v1.2.0
func (e *Engine) ProcessRouters(req *model.ProcessRoutersRequest) (*model.InstancesResponse, error)
ProcessRouters 执行路由链过滤,返回经过路由后的实例列表
func (*Engine) ScheduleTask ¶
func (e *Engine) ScheduleTask(task *model.PeriodicTask) (chan<- *model.PriorityTask, model.TaskValues)
ScheduleTask 调度任务
func (*Engine) ServiceEventCallback ¶
func (e *Engine) ServiceEventCallback(event *common.PluginEvent) error
ServiceEventCallback serviceUpdate消息订阅回调
func (*Engine) SyncCreateConfigFile ¶ added in v1.5.5
SyncCreateConfigFile 同步创建配置文件
func (*Engine) SyncDeregister ¶
func (e *Engine) SyncDeregister(instance *model.InstanceDeRegisterRequest) error
SyncDeregister 同步进行服务反注册
func (*Engine) SyncGetAllInstances ¶
func (e *Engine) SyncGetAllInstances(req *model.GetAllInstancesRequest) (*model.InstancesResponse, error)
SyncGetAllInstances 同步获取服务实例
func (*Engine) SyncGetConfigFile ¶ added in v1.1.0
func (e *Engine) SyncGetConfigFile(req *model.GetConfigFileRequest) (model.ConfigFile, error)
SyncGetConfigFile 同步获取配置文件
func (*Engine) SyncGetConfigGroup ¶ added in v1.5.6
func (e *Engine) SyncGetConfigGroup(namespace, fileGroup string) (model.ConfigFileGroup, error)
SyncGetConfigGroup 同步获取配置文件
func (*Engine) SyncGetInstances ¶
func (e *Engine) SyncGetInstances(req *model.GetInstancesRequest) (*model.InstancesResponse, error)
SyncGetInstances 同步获取服务实例
func (*Engine) SyncGetOneInstance ¶
func (e *Engine) SyncGetOneInstance(req *model.GetOneInstanceRequest) (*model.OneInstanceResponse, error)
SyncGetOneInstance 同步获取服务实例
func (*Engine) SyncGetResources ¶
func (e *Engine) SyncGetResources(req model.CacheValueQuery) error
SyncGetResources 同步加载资源
func (*Engine) SyncGetServiceRule ¶
func (e *Engine) SyncGetServiceRule( eventType model.EventType, req *model.GetServiceRuleRequest) (*model.ServiceRuleResponse, error)
SyncGetServiceRule 同步获取服务规则
func (*Engine) SyncGetServices ¶
func (e *Engine) SyncGetServices(eventType model.EventType, req *model.GetServicesRequest) (*model.ServicesResponse, error)
SyncGetServices 获取服务列表
func (*Engine) SyncHeartbeat ¶
func (e *Engine) SyncHeartbeat(instance *model.InstanceHeartbeatRequest) error
SyncHeartbeat 同步进行心跳上报
func (*Engine) SyncPublishConfigFile ¶ added in v1.5.5
SyncPublishConfigFile 同步发布配置文件
func (*Engine) SyncRegister ¶
func (e *Engine) SyncRegister(instance *model.InstanceRegisterRequest) (*model.InstanceRegisterResponse, error)
SyncRegister 同步进行服务注册
func (*Engine) SyncReportStat ¶
func (e *Engine) SyncReportStat(typ model.MetricType, stat model.InstanceGauge) error
SyncReportStat 上报统计数据到统计插件中
func (*Engine) SyncUpdateConfigFile ¶ added in v1.5.5
SyncUpdateConfigFile 同步更新配置文件
func (*Engine) SyncUpdateServiceCallResult ¶
func (e *Engine) SyncUpdateServiceCallResult(result *model.ServiceCallResult) error
SyncUpdateServiceCallResult 同步上报调用结果信息
func (*Engine) WatchAllInstances ¶ added in v1.4.0
func (e *Engine) WatchAllInstances(request *model.WatchAllInstancesRequest) (*model.WatchAllInstancesResponse, error)
WatchAllInstances 监听所有的实例
func (*Engine) WatchAllServices ¶ added in v1.4.1
func (e *Engine) WatchAllServices(request *model.WatchAllServicesRequest) (*model.WatchAllServicesResponse, error)
WatchAllServices 监听所有的服务列表
func (*Engine) WatchService ¶
func (e *Engine) WatchService(req *model.WatchServiceRequest) (*model.WatchServiceResponse, error)
WatchService watch service
type LongPullContext ¶ added in v1.4.0
type LongPullContext struct {
// contains filtered or unexported fields
}
func NewLongPullContext ¶ added in v1.4.0
func NewLongPullContext( id uint64, waitIndex uint64, waitTime time.Duration, svcEventKey model.ServiceEventKey) *LongPullContext
func (*LongPullContext) Cancel ¶ added in v1.4.0
func (l *LongPullContext) Cancel()
func (*LongPullContext) OnInstances ¶ added in v1.4.1
func (l *LongPullContext) OnInstances(value model.ServiceInstances)
func (*LongPullContext) OnServices ¶ added in v1.4.1
func (l *LongPullContext) OnServices(value model.Services)
func (*LongPullContext) ServiceEventKey ¶ added in v1.4.0
func (l *LongPullContext) ServiceEventKey() model.ServiceEventKey
func (*LongPullContext) Start ¶ added in v1.4.0
func (l *LongPullContext) Start()
type NotifyUpdateContext ¶ added in v1.4.0
type NotifyUpdateContext struct {
// contains filtered or unexported fields
}
func (*NotifyUpdateContext) Cancel ¶ added in v1.4.0
func (l *NotifyUpdateContext) Cancel()
func (*NotifyUpdateContext) OnInstances ¶ added in v1.4.1
func (l *NotifyUpdateContext) OnInstances(value model.ServiceInstances)
func (*NotifyUpdateContext) OnServices ¶ added in v1.4.1
func (l *NotifyUpdateContext) OnServices(value model.Services)
func (*NotifyUpdateContext) ServiceEventKey ¶ added in v1.4.0
func (l *NotifyUpdateContext) ServiceEventKey() model.ServiceEventKey
type SingleNotifyContext ¶
type SingleNotifyContext struct {
// contains filtered or unexported fields
}
SingleNotifyContext 同步调用回调上下文
func NewSingleNotifyContext ¶
func NewSingleNotifyContext(name *ContextKey, notifier *common.Notifier) *SingleNotifyContext
NewSingleNotifyContext 创建回调上下文
func (*SingleNotifyContext) Err ¶
func (s *SingleNotifyContext) Err() model.SDKError
Err 返回异常信息返回异常信息
type WatchContext ¶ added in v1.4.0
type WatchContext interface { ServiceEventKey() model.ServiceEventKey OnInstances(value model.ServiceInstances) OnServices(value model.Services) Cancel() }
type WatchEngine ¶ added in v1.4.0
type WatchEngine struct {
// contains filtered or unexported fields
}
func NewWatchEngine ¶ added in v1.4.0
func NewWatchEngine(registry localregistry.LocalRegistry) *WatchEngine
func (*WatchEngine) CancelWatch ¶ added in v1.4.0
func (w *WatchEngine) CancelWatch(watchId uint64)
func (*WatchEngine) ServiceEventCallback ¶ added in v1.4.0
func (w *WatchEngine) ServiceEventCallback(event *common.PluginEvent) error
ServiceEventCallback serviceUpdate消息订阅回调
func (*WatchEngine) WatchAllInstances ¶ added in v1.4.0
func (w *WatchEngine) WatchAllInstances( request *model.WatchAllInstancesRequest) (*model.WatchAllInstancesResponse, error)
func (*WatchEngine) WatchAllServices ¶ added in v1.4.1
func (w *WatchEngine) WatchAllServices( request *model.WatchAllServicesRequest) (*model.WatchAllServicesResponse, error)