router

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndpoint

func NewEndpoint(target string, path []RulePath) *tEndpoint

NewEndpoint 创建路由树的端点

Types

type ICreateHelper

type ICreateHelper interface {
	Less(i, j string) bool
}

ICreateHelper ICreateHelper实现了指标类型排序中的Less方法

type IEndPoint

type IEndPoint interface {
	CMDs() []string
	Get(CMD string) (checker.Checker, bool)
	Target() string
	EndPoint() string
}

type IRouter

type IRouter interface {
	Router(source ISource) (endpoint IEndPoint, has bool)
}

IRouter 实现了Router方法

func NewNodeShut

func NewNodeShut(next IRouter, endpoint IEndPoint) IRouter

NewNodeShut 创建NewNodeShut,暂未用到

func ParseRouter

func ParseRouter(rules []Rule, helper ICreateHelper) (IRouter, error)

ParseRouter parse rule to IRouter

type ISource

type ISource interface {
	Get(cmd string) (string, bool)
}

ISource 实现了从源对象中获取相应指标的值的方法

type Node

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

Node 路由树中指标节点结构体

func (*Node) Router

func (n *Node) Router(source ISource) (IEndPoint, bool)

Router 路由方法

type NodeShut

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

NodeShut NodeShut

func (*NodeShut) Router

func (n *NodeShut) Router(source ISource) (IEndPoint, bool)

Router 路由方法

type PathSort

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

PathSort 指标排序结构体,实现了sort接口,用于对路由路径上的指标进行排序

func (*PathSort) Len

func (p *PathSort) Len() int

func (*PathSort) Less

func (p *PathSort) Less(i, j int) bool

func (*PathSort) Swap

func (p *PathSort) Swap(i, j int)

type Routers

type Routers []IRouter

Routers 路由树结构体

func (Routers) Router

func (rs Routers) Router(source ISource) (IEndPoint, bool)

Router 路由获得端点

type Rule

type Rule struct {
	Path   []RulePath
	Target string
}

Rule 路由路径结构体,包含路径上的指标和目标服务

type RulePath

type RulePath struct {
	CMD     string
	Checker checker.Checker
}

RulePath 路由路径上的指标结构体,包含指标和相应的检查器

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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