route

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Infinity = WeightType(^uint(0) >> 1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BcastSendCallback

type BcastSendCallback func(info *rpc.RoutingRequest, ospAddrs []string)

type Channel

type Channel = structs.Edge

Channel describes a channel info

type Controller

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

Controller configs to handle onchain router-related event

func NewController

func NewController(
	nodeConfig common.GlobalNodeConfig,
	transactor *eth.Transactor,
	monitorService intfs.MonitorService,
	dal *storage.DAL,
	signer eth.Signer,
	bcastSendCallback BcastSendCallback,
	routingData []byte,
	rpcHost string,
	explorerUrl string) (*Controller, error)

NewController creates a new process for router controller

func (*Controller) AddEdge

func (c *Controller) AddEdge(p1, p2 ctype.Addr, cid ctype.CidType, tokenAddr ctype.Addr) error

func (*Controller) BuildTable

func (c *Controller) BuildTable(tokenAddr ctype.Addr) (map[ctype.Addr]ctype.CidType, error)

func (*Controller) GetAllNeighbors

func (c *Controller) GetAllNeighbors() map[ctype.Addr]*NeighborInfo

func (*Controller) RecvBcastRoutingInfo

func (c *Controller) RecvBcastRoutingInfo(info *rpc.RoutingRequest) error

New routing information arrived from another OSP. Enqueue it for a future route recomputation and, if needed, forward it to other peer OSPs in the broadcast.

func (*Controller) RemoveEdge

func (c *Controller) RemoveEdge(cid ctype.CidType) error

func (*Controller) Start

func (c *Controller) Start()

Start starts router process to instantiate OSP as a router.

type Data

type Data struct {
	EndBlockNumber uint64
	Channels       []*Channel
}

Data describes a data structure to store all valid channels and the end of block number

type Edge

type Edge = structs.Edge

Edge describes event happening to a channel.

type Forwarder

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

func NewForwarder

func NewForwarder(policy RoutingPolicy, dal *storage.DAL, gatewayOsp ctype.Addr) *Forwarder

func (*Forwarder) LookupEgressChannelOnPay

func (f *Forwarder) LookupEgressChannelOnPay(payID ctype.PayIDType) (ctype.CidType, ctype.Addr, error)

func (*Forwarder) LookupIngressChannelOnPay

func (f *Forwarder) LookupIngressChannelOnPay(payID ctype.PayIDType) (ctype.CidType, ctype.Addr, error)

func (*Forwarder) LookupNextChannelOnToken

func (f *Forwarder) LookupNextChannelOnToken(dest ctype.Addr, token ctype.Addr) (ctype.CidType, ctype.Addr, error)

type Graph

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

func NewGraph

func NewGraph() *Graph

type NeighborInfo

type NeighborInfo struct {
	// time of last route message update
	UpdateTime time.Time
	// tokens and cids of connected channels
	TokenCids map[ctype.Addr]ctype.CidType
}

type OspEdge

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

type OspInfo

type OspInfo struct {
	// block number of last onchain routerRegistry update
	RegistryBlock uint64
	// time of last route message update
	UpdateTime time.Time
}

type QueueElement

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

type RoutingPolicy

type RoutingPolicy int
const (
	NoRoutingPolicy       RoutingPolicy = 1 << iota
	GateWayPolicy         RoutingPolicy = 1 << iota
	ServiceProviderPolicy RoutingPolicy = 1 << iota
)

type VertexQueue

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

A VertexQueue is the priority queue for elements

func (*VertexQueue) Len

func (q *VertexQueue) Len() int

func (*VertexQueue) Less

func (q *VertexQueue) Less(i, j int) bool

func (*VertexQueue) Pop

func (q *VertexQueue) Pop() interface{}

func (*VertexQueue) Push

func (q *VertexQueue) Push(x interface{})

func (*VertexQueue) Swap

func (q *VertexQueue) Swap(i, j int)

type VertexType

type VertexType = string

type WeightType

type WeightType = int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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