Documentation ¶
Index ¶
- Variables
- func Depth(t *Tree) int
- func GetFirstFreeNode(nodes []string, mp map[string][]string, curNode string) ([]string, map[string][]string, string)
- func PrintTreeNode(t *Tree)
- func TrimTree(newRoot *Tree, oldRoot *Tree, bhMap map[string]bool)
- type Float64Slice
- type Graph
- type Tree
- func ColorTree(nodeNames []string, hostAddr []string, hostsPerNode int, bf int, startM string, ...) (*Tree, []string, error)
- func TreeFromList(nodeNames []string, hostsPerNode int, bf int, startMachine ...string) (*Tree, []string, int, error)
- func TrimLastIncompleteLevel(root *Tree, hosts []string, depths []int, bf int) (*Tree, []string)
Constants ¶
This section is empty.
Variables ¶
var ErrNoHosts = errors.New("Can't have 0 hosts per node")
var ErrNoNodesGiven = errors.New("No Nodes Given as argument")
var TRIM bool = false
Functions ¶
func GetFirstFreeNode ¶
func GetFirstFreeNode(nodes []string, mp map[string][]string, curNode string) ( []string, map[string][]string, string)
Go through list of nodes(machines) and choose a hostName on the first node that still has room for more hosts on it and is != curNode If such a machine does not exist, loop through the map from machine names to their available host names, and choose a name on the first free machine != curNode Return updated nodes and map (completely full nodes are deleted ) and the chosen hostName
func PrintTreeNode ¶
func PrintTreeNode(t *Tree)
Types ¶
type Float64Slice ¶
func MakeFloat64Slice ¶
func MakeFloat64Slice(A []float64) Float64Slice
func (Float64Slice) Len ¶
func (p Float64Slice) Len() int
func (Float64Slice) Less ¶
func (p Float64Slice) Less(i, j int) bool
func (Float64Slice) Sort ¶
func (p Float64Slice) Sort()
func (Float64Slice) Swap ¶
func (p Float64Slice) Swap(i, j int)
type Graph ¶
func (*Graph) BestConnector ¶
return the index of the best connector
func (*Graph) LoadEdgeList ¶
takes in a byte array representing an edge list and loads the graph
type Tree ¶
type Tree struct { Name string `json:"name"` // hex encoded public and private keys PriKey string `json:"prikey,omitempty"` PubKey string `json:"pubkey,omitempty"` Children []*Tree `json:"children,omitempty"` }
tree easy to deal with default json encoding can be read as the Tree section of a config file
func TreeFromList ¶
func TreeFromList(nodeNames []string, hostsPerNode int, bf int, startMachine ...string) ( *Tree, []string, int, error)
Given a list of machine names, a number of hosts per machine(node), and a branching factor Return a Tree that meets the branching factor restriction, and has no two adjacent nodes in the Tree running as hosts on the same machine Also returns a list of the host names created and their ports