router

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROUTE_PATTERN = `([&!=,]*)\\s*([^&!=,\\s]+)`
	FORCE         = "force"
	PRIORITY      = "priority"
)

Variables

This section is empty.

Functions

func MatchCondition

func MatchCondition(pairs map[string]MatchPair, url *common.URL, param *common.URL, invocation protocol.Invocation) (bool, error)

MatchCondition MatchCondition

func NewConditionRouterFactory

func NewConditionRouterFactory() cluster.RouterFactory

Types

type ConditionRouter

type ConditionRouter struct {
	Pattern       string
	Url           *common.URL
	Priority      int64
	Force         bool
	WhenCondition map[string]MatchPair
	ThenCondition map[string]MatchPair
}

ConditionRouter condition router struct

func (*ConditionRouter) MatchThen

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

MatchThen MatchThen

func (*ConditionRouter) MatchWhen

func (c *ConditionRouter) MatchWhen(url common.URL, invocation protocol.Invocation) (bool, error)

func (*ConditionRouter) Route

func (c *ConditionRouter) Route(invokers []protocol.Invoker, url common.URL, invocation protocol.Invocation) []protocol.Invoker

Router determine the target server list.

type ConditionRouterFactory

type ConditionRouterFactory struct{}

func (ConditionRouterFactory) Router

type MatchPair

type MatchPair struct {
	Matches    *gxset.HashSet
	Mismatches *gxset.HashSet
}

Jump to

Keyboard shortcuts

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