circlemaster

package
v0.0.0-...-f5e034e Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const EdgeTimeout = time.Duration(30 * time.Second)
View Source
const MaxNodes = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	ObjectiveFunction string
	Destination       int

	Edges [MaxNodes][MaxNodes]time.Time
	// contains filtered or unexported fields
}

func (*Graph) FormsLoop

func (graph *Graph) FormsLoop(from int, to int, now time.Time) bool

* Works by trying to find a path from 'to' to 'from', if that exists we would have a loop by adding 'from' to 'to' * edge.

func (*Graph) ReleaseEdge

func (graph *Graph) ReleaseEdge(from int, to int)

func (*Graph) RequestEdge

func (graph *Graph) RequestEdge(from int, to int) time.Time

type GraphManager

type GraphManager struct {
	Graphs map[string]map[int]*Graph // ObjectiveFunction -> Destination -> Graph
}

func NewGraphManager

func NewGraphManager() *GraphManager

func (*GraphManager) GetGraph

func (gm *GraphManager) GetGraph(objectiveFunction string, destination int) *Graph

func (*GraphManager) ReleaseEdge

func (gm *GraphManager) ReleaseEdge(objectiveFunction string, destination int, from int, to int)

func (*GraphManager) RequestEdge

func (gm *GraphManager) RequestEdge(objectiveFunction string, destination int, from int, to int) time.Time

type NetworkManager

type NetworkManager struct {
	GraphManagers sync.Map // networkId -> graphManager
}

func NewNetworkManager

func NewNetworkManager() *NetworkManager

func (*NetworkManager) GetGraphManager

func (nm *NetworkManager) GetGraphManager(networkId string) *GraphManager

Jump to

Keyboard shortcuts

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