condition

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

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

func NewAppRouter(url *common.URL) (*AppRouter, error)

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

func (*AppRouter) URL

func (l *AppRouter) URL() common.URL

URL Return URL in listenable router

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) MatchThen

func (c *ConditionRouter) MatchThen(url *common.URL, param *common.URL) bool

MatchThen MatchThen

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

Jump to

Keyboard shortcuts

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