router

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

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

Graph holds the adjacency list for BFS/Dijkstra.

func Build

func Build() *Graph

Build constructs the format graph from all registered backends.

func (*Graph) Find

func (g *Graph) Find(src, dst string) (*Route, error)

Find returns the lowest-cost route from src to dst, or ErrNoRoute.

func (*Graph) Nodes

func (g *Graph) Nodes() []string

Nodes returns all format IDs that appear in the graph.

type Route

type Route struct {
	Steps []Step
}

Route is an ordered sequence of steps from source to target format.

func (*Route) TotalCost

func (r *Route) TotalCost() int

TotalCost returns the sum of edge costs across all steps.

type Step

type Step struct {
	From    string
	To      string
	Backend backend.Backend
}

Step is a single conversion hop in a route.

Jump to

Keyboard shortcuts

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