Documentation ¶
Index ¶
- Constants
- Variables
- func CreateChains(chainType string, handlerNameMap map[string]string) error
- func GetFallbackFun(cmd, t string, i *invocation.Invocation, cb invocation.ResponseCallBack, ...) func(error) error
- func GetFaultConfig(protocol, microServiceName, schemaID, operationID string) model.Fault
- func GetHystrixConfig(command, t string) hystrix.CommandConfig
- func NewHystrixCmd(sourceName, protype, servicename, schemaID, OperationID string) string
- func RegisterHandler(name string, f func() Handler) error
- func StrategyName(i *invocation.Invocation) string
- func StrategySessionTimeout(i *invocation.Invocation) int
- func StrategySuccessiveFailedTimes(i *invocation.Invocation) int
- type BizKeeperConsumerHandler
- type BizKeeperProviderHandler
- type Chain
- type ChainOption
- type ChainOptions
- type ConsumerRateLimiterHandler
- type FaultHandler
- type Handler
- type LBHandler
- type ProviderRateLimiterHandler
- type RouterHandler
- type TracingConsumerHandler
- type TracingProviderHandler
- type TransportHandler
Constants ¶
const ( Transport = "transport" Loadbalance = "loadbalance" BizkeeperConsumer = "bizkeeper-consumer" BizkeeperProvider = "bizkeeper-provider" TracingConsumer = "tracing-consumer" TracingProvider = "tracing-provider" RatelimiterConsumer = "ratelimiter-consumer" RatelimiterProvider = "ratelimiter-provider" Router = "router" FaultInject = "fault-inject" )
constant keys for handlers
const ( ProviderQPSLimit = "cse.flowcontrol.Provider.qps.limit" ProviderLimitKeyGlobal = "cse.flowcontrol.Provider.qps.global.limit" )
constant for provider qps limiter keys
const (
FaultHandlerName = "fault-inject"
)
constant for fault handler name
const (
Name = "bizkeeper-consumer"
)
constant for bizkeeper-consumer
Variables ¶
var ChainMap = make(map[string]*Chain)
ChainMap just concurrent read
var HandlerFuncMap = make(map[string]func() Handler)
HandlerFuncMap handler function map
Functions ¶
func CreateChains ¶
CreateChains is for to create the chains
func GetFallbackFun ¶
func GetFallbackFun(cmd, t string, i *invocation.Invocation, cb invocation.ResponseCallBack, isForce bool) func(error) error
GetFallbackFun get fallback function
func GetFaultConfig ¶
GetFaultConfig get faultconfig
func GetHystrixConfig ¶
func GetHystrixConfig(command, t string) hystrix.CommandConfig
GetHystrixConfig get hystrix config
func NewHystrixCmd ¶
NewHystrixCmd new hystrix command
func RegisterHandler ¶
RegisterHandler Let developer custom handler
func StrategySessionTimeout ¶
func StrategySessionTimeout(i *invocation.Invocation) int
StrategySessionTimeout strategy session timeout
func StrategySuccessiveFailedTimes ¶
func StrategySuccessiveFailedTimes(i *invocation.Invocation) int
StrategySuccessiveFailedTimes strategy successive failed times
Types ¶
type BizKeeperConsumerHandler ¶
type BizKeeperConsumerHandler struct{}
BizKeeperConsumerHandler bizkeeper consumer handler
func (*BizKeeperConsumerHandler) Handle ¶
func (bk *BizKeeperConsumerHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle function is for to handle the chain
func (*BizKeeperConsumerHandler) Name ¶
func (bk *BizKeeperConsumerHandler) Name() string
Name is for to represent the name of bizkeeper handler
type BizKeeperProviderHandler ¶
type BizKeeperProviderHandler struct{}
BizKeeperProviderHandler bizkeeper provider handler
func (*BizKeeperProviderHandler) Handle ¶
func (bk *BizKeeperProviderHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle handler for bizkeeper provider
func (*BizKeeperProviderHandler) Name ¶
func (bk *BizKeeperProviderHandler) Name() string
Name returns bizkeeper-provider string
type Chain ¶
Chain struct for service and handlers
func CreateChain ¶
CreateChain create consumer or provider's chain,the final handler is different
func (*Chain) Next ¶
func (c *Chain) Next(i *invocation.Invocation, f invocation.ResponseCallBack)
Next is for to handle next handler in the chain
type ChainOption ¶
type ChainOption func(*ChainOptions)
ChainOption is a function name
func WithChainName ¶
func WithChainName(name string) ChainOption
WithChainName returns the name of the chain option
type ConsumerRateLimiterHandler ¶
type ConsumerRateLimiterHandler struct{}
ConsumerRateLimiterHandler consumer rate limiter handler
func (*ConsumerRateLimiterHandler) GetOrCreate ¶
func (rl *ConsumerRateLimiterHandler) GetOrCreate(op *qpslimiter.OperationMeta)
GetOrCreate is for getting or creating qps limiter meta data
func (*ConsumerRateLimiterHandler) Handle ¶
func (rl *ConsumerRateLimiterHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is handles the consumer rate limiter APIs
func (*ConsumerRateLimiterHandler) Name ¶
func (rl *ConsumerRateLimiterHandler) Name() string
Name returns consumerratelimiter string
type FaultHandler ¶
type FaultHandler struct{}
FaultHandler handler
func (*FaultHandler) Handle ¶
func (rl *FaultHandler) Handle(chain *Chain, inv *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is to handle the API
func (*FaultHandler) Name ¶
func (rl *FaultHandler) Name() string
Name function returns fault-inject string
type Handler ¶
type Handler interface { // handle invocation transportation,and tr response Handle(*Chain, *invocation.Invocation, invocation.ResponseCallBack) Name() string }
Handler interface for handlers
func CreateHandler ¶
CreateHandler create a new handler by name your registered
func FaultHandle ¶
func FaultHandle() Handler
FaultHandle fault handle gives the object of FaultHandler
type LBHandler ¶
type LBHandler struct{}
LBHandler loadbalancer handler struct
func (*LBHandler) Handle ¶
func (lb *LBHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle to handle the load balancing
type ProviderRateLimiterHandler ¶
type ProviderRateLimiterHandler struct{}
ProviderRateLimiterHandler provider rate limiter handler
func (*ProviderRateLimiterHandler) Handle ¶
func (rl *ProviderRateLimiterHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is to handle provider rateLimiter things
func (*ProviderRateLimiterHandler) Name ¶
func (rl *ProviderRateLimiterHandler) Name() string
Name returns the name providerratelimiter
type RouterHandler ¶
type RouterHandler struct{}
RouterHandler router handler
func (*RouterHandler) Handle ¶
func (ph *RouterHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is to handle the router related things
type TracingConsumerHandler ¶
type TracingConsumerHandler struct{}
TracingConsumerHandler tracing consumer handler
func (*TracingConsumerHandler) Handle ¶
func (t *TracingConsumerHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is handle consumer tracing related things
func (*TracingConsumerHandler) Name ¶
func (t *TracingConsumerHandler) Name() string
Name returns tracing-consumer string
type TracingProviderHandler ¶
type TracingProviderHandler struct{}
TracingProviderHandler tracing provider handler
func (*TracingProviderHandler) Handle ¶
func (t *TracingProviderHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is to handle the provider tracing related things
func (*TracingProviderHandler) Name ¶
func (t *TracingProviderHandler) Name() string
Name returns tracing-provider string
type TransportHandler ¶
type TransportHandler struct{}
TransportHandler transport handler
func (*TransportHandler) Handle ¶
func (th *TransportHandler) Handle(chain *Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle is to handle transport related things
func (*TransportHandler) Name ¶
func (th *TransportHandler) Name() string
Name returns transport string