router

package
v0.0.0-...-9c04300 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() abstract.Router

创建路由器

Types

type Bus

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

路由总线

func NewBus

func NewBus() *Bus

创建路由总线

func (*Bus) ByKey

func (bus *Bus) ByKey(key Key) Node

根据KEY查询节点

func (*Bus) ByKeys

func (bus *Bus) ByKeys(keys []Key) []Node

根据KEY列表查询节点列表

func (*Bus) ByLoad

func (bus *Bus) ByLoad() Node

根据负载查询节点

func (*Bus) Expired

func (bus *Bus) Expired()

设置负载均衡过期

func (*Bus) Insert

func (bus *Bus) Insert(node Node)

插入节点

func (*Bus) Nodes

func (bus *Bus) Nodes() []Node

查询节点列表

func (*Bus) Remove

func (bus *Bus) Remove(node Node)

删除节点

type Credit

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

均衡记录

type Credits

type Credits []*Credit

均衡列表

func (Credits) Len

func (cred Credits) Len() int

func (Credits) Less

func (cred Credits) Less(i, j int) bool

func (Credits) Swap

func (cred Credits) Swap(i, j int)

type ID

type ID = proto.NodeID

type Key

type Key = proto.NodeKey

type Mesh

type Mesh = abstract.Mesh

type Node

type Node = abstract.Node

type Router

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

路由器

func (*Router) ByID

func (rt *Router) ByID(id ID) Node

根据ID查询节点

func (*Router) ByIDList

func (rt *Router) ByIDList(list []ID) []Node

根据ID列表查询节点列表

func (*Router) ByKey

func (rt *Router) ByKey(typo Type, key Key) Node

根据KEY查询节点

func (*Router) ByKeys

func (rt *Router) ByKeys(typo Type, keys []Key) []Node

根据KEY列表查询节点列表

func (*Router) ByLoad

func (rt *Router) ByLoad(typo Type) Node

根据负载查询节点

func (*Router) ByType

func (rt *Router) ByType(typo Type) []Node

根据TYPE查询节点列表

func (*Router) Expired

func (rt *Router) Expired(typo Type)

设置总线状态过期

func (*Router) Insert

func (rt *Router) Insert(node Node)

添加节点

func (*Router) Remove

func (rt *Router) Remove(id ID)

移除节点

type Type

type Type = proto.NodeType

Jump to

Keyboard shortcuts

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