chain

package
Version: v3.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetVSAndDRConfigByte

func SetVSAndDRConfigByte(vs, dr []byte)

Types

type InvokerCache

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

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

BuildCache builds address cache from the given invokers.

func (*InvokerCache) FindAddrMeta

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

FindAddrMeta finds address metadata for a poolable router.

func (*InvokerCache) FindAddrPool

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

FindAddrPool finds address pool for a poolable router.

func (*InvokerCache) GetInvokers

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

GetInvokers get invokers snapshot.

func (*InvokerCache) SetAddrMeta

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

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

func (*InvokerCache) SetAddrPool

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

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to