multipath

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathID

type PathID string

PathID 路径唯一标识

func GeneratePathID

func GeneratePathID(parentPathID PathID, nodeID, vrf, inPort, outPort string) PathID

GeneratePathID 生成路径ID

type PathRelation

type PathRelation struct {
	ParentPathID PathID   // 父路径
	ChildPathIDs []PathID // 子路径(分支)
	MergePathID  PathID   // 合并到的路径(如果与其他路径合并)
}

PathRelation 路径关系

type PathState

type PathState int

PathState 路径状态

const (
	PathStatePending PathState = iota
	PathStateRunning
	PathStateSuccess
	PathStateFailed
	PathStateMerged
)

func (PathState) String

func (ps PathState) String() string

type PathStateInfo

type PathStateInfo struct {
	PathID       PathID
	State        PathState
	ParentPathID PathID // 父路径ID(如果是从父路径分支)
	BranchIndex  int    // 分支索引(同一节点的多个分支)
	StartTime    time.Time
	EndTime      time.Time
	Error        error
	NodeCount    int  // 路径上的节点数量
	IsECMP       bool // 是否为ECMP路径
}

PathStateInfo 路径状态信息

type PathTracker

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

PathTracker 路径跟踪器

func NewPathTracker

func NewPathTracker() *PathTracker

NewPathTracker 创建路径跟踪器

func (*PathTracker) AddNodeResult

func (pt *PathTracker) AddNodeResult(pathID PathID, nodeKey string, result interface{})

AddNodeResult 添加节点处理结果

func (*PathTracker) AddNodeToPath

func (pt *PathTracker) AddNodeToPath(pathID PathID, nodeKey string)

AddNodeToPath 将节点添加到路径

func (*PathTracker) CheckNodeVisited

func (pt *PathTracker) CheckNodeVisited(pathID PathID, nodeKey string) bool

CheckNodeVisited 检查节点是否在特定路径上已访问

func (*PathTracker) CompletePath

func (pt *PathTracker) CompletePath(pathID PathID, success bool, err error)

CompletePath 完成路径(成功或失败)

func (*PathTracker) GetNodePaths

func (pt *PathTracker) GetNodePaths(nodeKey string) []PathID

GetNodePaths 获取访问过节点的所有路径

func (*PathTracker) GetPathDepth

func (pt *PathTracker) GetPathDepth(pathID PathID) int

GetPathDepth 获取路径深度

func (*PathTracker) GetPathInfo

func (pt *PathTracker) GetPathInfo(pathID PathID) (*PathStateInfo, error)

GetPathInfo 获取路径信息

func (*PathTracker) GetPathState

func (pt *PathTracker) GetPathState(pathID PathID) (PathState, error)

GetPathState 获取路径状态

func (*PathTracker) GetStats

func (pt *PathTracker) GetStats() *PathTrackerStats

GetStats 获取路径统计信息

func (*PathTracker) MergeNodeResults

func (pt *PathTracker) MergeNodeResults(nodeKey string) interface{}

MergeNodeResults 合并节点在不同路径上的结果

func (*PathTracker) StartPath

func (pt *PathTracker) StartPath(pathID PathID, parentPathID PathID, isECMP bool)

StartPath 开始跟踪一条新路径

type PathTrackerStats

type PathTrackerStats struct {
	TotalPaths    int
	SuccessPaths  int
	FailedPaths   int
	ECMPPaths     int
	MergedNodes   int     // 合并的节点数量
	MaxPathDepth  int     // 最大路径深度
	AvgPathLength float64 // 平均路径长度
}

PathTrackerStats 路径跟踪统计

Jump to

Keyboard shortcuts

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