chain

package
v1.5.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvokerCache added in v1.5.5

type InvokerCache struct {
	// contains filtered or unexported fields
}

Cache caches all addresses relevant info for a snapshot of received invokers. It keeps a snapshot of the received address list, and also keeps address pools and address metadata from routers based on the same address snapshot, if the router implements Poolable.

func BuildCache added in v1.5.5

func BuildCache(invokers []protocol.Invoker) *InvokerCache

BuildCache builds address cache from the given invokers.

func (*InvokerCache) FindAddrMeta added in v1.5.5

func (c *InvokerCache) FindAddrMeta(p router.Poolable) router.AddrMetadata

FindAddrMeta finds address metadata for a poolable router.

func (*InvokerCache) FindAddrPool added in v1.5.5

func (c *InvokerCache) FindAddrPool(p router.Poolable) router.AddrPool

FindAddrPool finds address pool for a poolable router.

func (*InvokerCache) GetInvokers added in v1.5.5

func (c *InvokerCache) GetInvokers() []protocol.Invoker

GetInvokers get invokers snapshot.

func (*InvokerCache) SetAddrMeta added in v1.5.5

func (c *InvokerCache) SetAddrMeta(name string, meta router.AddrMetadata)

SetAddrMeta sets address metadata for a poolable router, for unit test only

func (*InvokerCache) SetAddrPool added in v1.5.5

func (c *InvokerCache) SetAddrPool(name string, pool router.AddrPool)

SetAddrPool sets address pool for a poolable router, for unit test only

type RouterChain

type RouterChain struct {
	// contains filtered or unexported fields
}

RouterChain Router chain

func NewRouterChain

func NewRouterChain(url *common.URL) (*RouterChain, error)

NewRouterChain Use url to init router chain Loop routerFactories and call NewRouter method

func (*RouterChain) AddRouters

func (c *RouterChain) AddRouters(routers []router.PriorityRouter)

AddRouters Add routers to router chain New a array add builtinRouters which is not sorted in RouterChain and routers Sort the array Replace router array in RouterChain

func (*RouterChain) GetNotifyChan added in v1.5.6

func (c *RouterChain) GetNotifyChan() chan struct{}

func (*RouterChain) Route

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

Route Loop routers in RouterChain and call Route method to determine the target invokers list.

func (*RouterChain) SetInvokers added in v1.5.1

func (c *RouterChain) SetInvokers(invokers []protocol.Invoker)

SetInvokers receives updated invokers from registry center. If the times of notification exceeds countThreshold and time interval exceeds timeThreshold since last cache update, then notify to update the cache.

func (*RouterChain) URL added in v1.5.0

func (c *RouterChain) URL() *common.URL

URL Return URL in RouterChain

Jump to

Keyboard shortcuts

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