Documentation ¶
Index ¶
- type AppRouter
- func (l *AppRouter) Priority() int64
- func (l *AppRouter) Process(event *config_center.ConfigChangeEvent)
- func (l *AppRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
- func (l *AppRouter) RouterRule() *RouterRule
- func (l *AppRouter) URL() common.URL
- type AppRouterFactory
- type ConditionRouter
- func (c *ConditionRouter) Enabled() bool
- func (c *ConditionRouter) MatchThen(url *common.URL, param *common.URL) bool
- func (c *ConditionRouter) MatchWhen(url *common.URL, invocation protocol.Invocation) bool
- func (c *ConditionRouter) Priority() int64
- func (c *ConditionRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
- func (c *ConditionRouter) URL() common.URL
- type ConditionRouterFactory
- type FileConditionRouter
- func (l *FileConditionRouter) Priority() int64
- func (l *FileConditionRouter) Process(event *config_center.ConfigChangeEvent)
- func (l *FileConditionRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
- func (l *FileConditionRouter) RouterRule() *RouterRule
- func (f *FileConditionRouter) URL() common.URL
- type MatchPair
- type RouterRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppRouter ¶
type AppRouter struct {
// contains filtered or unexported fields
}
AppRouter For listen application router with config center
func NewAppRouter ¶
NewAppRouter Init AppRouter by url
func (*AppRouter) Priority ¶
func (l *AppRouter) Priority() int64
Priority Return Priority in listenable router
func (*AppRouter) Process ¶
func (l *AppRouter) Process(event *config_center.ConfigChangeEvent)
Process Process config change event, generate routers and set them to the listenableRouter instance
func (*AppRouter) Route ¶
func (l *AppRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
Route Determine the target invokers list.
func (*AppRouter) RouterRule ¶
func (l *AppRouter) RouterRule() *RouterRule
RouterRule Get RouterRule instance from listenableRouter
type AppRouterFactory ¶
type AppRouterFactory struct{}
AppRouterFactory Application router factory
func (*AppRouterFactory) NewPriorityRouter ¶ added in v1.5.0
func (c *AppRouterFactory) NewPriorityRouter(url *common.URL) (router.PriorityRouter, error)
NewPriorityRouter creates AppRouterFactory by URL
type ConditionRouter ¶
type ConditionRouter struct { Pattern string Force bool WhenCondition map[string]MatchPair ThenCondition map[string]MatchPair // contains filtered or unexported fields }
ConditionRouter Condition router struct
func NewConditionRouter ¶
func NewConditionRouter(url *common.URL) (*ConditionRouter, error)
NewConditionRouter Init condition router by URL
func NewConditionRouterWithRule ¶
func NewConditionRouterWithRule(rule string) (*ConditionRouter, error)
NewConditionRouterWithRule Init condition router by raw rule
func (*ConditionRouter) Enabled ¶
func (c *ConditionRouter) Enabled() bool
Enabled Return is condition router is enabled true: enabled false: disabled
func (*ConditionRouter) MatchWhen ¶
func (c *ConditionRouter) MatchWhen(url *common.URL, invocation protocol.Invocation) bool
MatchWhen MatchWhen
func (*ConditionRouter) Priority ¶
func (c *ConditionRouter) Priority() int64
Priority Return Priority in condition router
func (*ConditionRouter) Route ¶
func (c *ConditionRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
Route Determine the target invokers list.
func (*ConditionRouter) URL ¶
func (c *ConditionRouter) URL() common.URL
URL Return URL in condition router
type ConditionRouterFactory ¶
type ConditionRouterFactory struct{}
ConditionRouterFactory Condition router factory
func (*ConditionRouterFactory) NewFileRouter ¶
func (c *ConditionRouterFactory) NewFileRouter(content []byte) (router.PriorityRouter, error)
NewRouter Create FileRouterFactory by Content
func (*ConditionRouterFactory) NewPriorityRouter ¶ added in v1.5.0
func (c *ConditionRouterFactory) NewPriorityRouter(url *common.URL) (router.PriorityRouter, error)
NewPriorityRouter creates ConditionRouterFactory by URL
type FileConditionRouter ¶
type FileConditionRouter struct {
// contains filtered or unexported fields
}
FileConditionRouter Use for parse config file of condition router
func NewFileConditionRouter ¶
func NewFileConditionRouter(content []byte) (*FileConditionRouter, error)
NewFileConditionRouter Create file condition router instance with content ( from config file)
func (*FileConditionRouter) Priority ¶
func (l *FileConditionRouter) Priority() int64
Priority Return Priority in listenable router
func (*FileConditionRouter) Process ¶
func (l *FileConditionRouter) Process(event *config_center.ConfigChangeEvent)
Process Process config change event, generate routers and set them to the listenableRouter instance
func (*FileConditionRouter) Route ¶
func (l *FileConditionRouter) Route(invokers []protocol.Invoker, url *common.URL, invocation protocol.Invocation) []protocol.Invoker
Route Determine the target invokers list.
func (*FileConditionRouter) RouterRule ¶
func (l *FileConditionRouter) RouterRule() *RouterRule
RouterRule Get RouterRule instance from listenableRouter
func (*FileConditionRouter) URL ¶
func (f *FileConditionRouter) URL() common.URL
URL Return URL in file condition router n
type MatchPair ¶
type MatchPair struct { Matches *gxset.HashSet Mismatches *gxset.HashSet }
MatchPair Match key pair, condition process
type RouterRule ¶
type RouterRule struct { router.BaseRouterRule `yaml:",inline"` Conditions []string }
RouterRule RouterRule config read from config file or config center