Documentation ¶
Overview ¶
Package bintree creates a binary tree of Ip Addresses for use in the distributed mutex algorithm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByIP ¶
type ByIP []string
ByIP is a special type used for building the binary tree, specifically the initial sorting. Len, Swap, and Less functions are used in sorting the Ipaddrs prior to building the tree.
func (ByIP) Len ¶
Len returns the length of the binary tree and is used for building the binary tree.
type Tree ¶
type Tree struct { NumLeaves int // contains filtered or unexported fields }
Tree is used to store the root of the binary tree. Each node, including the root has pointers to its descendants so the rest of the tree is reached from this point.
func NewTree ¶
NewTree initializes the binary tree. It takes an array of strings representing Ip addresses. It will verify the entries in the array are Ip addresses, and then builds the tree and tree paths, returning the Tree type.