Documentation ¶
Index ¶
- func CountryLen() int
- func CreateLinkTable() (distanceLatency [12][12]int)
- func CreateSetLatencyTableWeights(distanceLatency [12][12]int) [12][12]int
- func GetCountryBins() map[string]GeoBin
- func GetCountryList() []string
- func OrderNodeTeam(nodes []*id.ID, countries map[id.ID]string, countryToBins map[string]GeoBin, ...) ([]*id.ID, int, error)
- func Permute(items []*id.ID) [][]*id.ID
- type GeoBin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountryLen ¶
func CountryLen() int
CountryLen returns the number of countries in the countryBins list.
func CreateLinkTable ¶
func CreateLinkTable() (distanceLatency [12][12]int)
CreateLinkTable creates a latency table that maps different region's latencies to all other defined regions. Latency is derived through educated guesses right now without any real world data.
TODO: This table needs better real-world accuracy. Once data is collected
this table can be updated for better accuracy and selection.
func GetCountryBins ¶
GetCountryBins returns a copy of the countryBins map.
func GetCountryList ¶
func GetCountryList() []string
GetCountryList returns a list of all country alpha-2 codes.
func OrderNodeTeam ¶
func Permute ¶
Permute is based off of Heap's algorithm found here: https://en.wikipedia.org/wiki/Heap%27s_algorithm.
It runs n! time, but in place in terms of space. As of writing, we use this for permuting all orders of a team, of which team size is small, justifying the high complexity.
Types ¶
type GeoBin ¶
type GeoBin uint8
GeoBin is the numerical representation of a geographical regional.
func GetCountryBin ¶
GetCountryBin return the bin for the given country alpha-2 code.
func (GeoBin) MarshalJSON ¶
MarshalJSON allows a GeoBin to be marshaled into JSON. This functions satisfies the json.Marshaler interface.
func (GeoBin) String ¶
String returns the string representation of the GeoBin. This functions satisfies the fmt.Stringer interface.
func (*GeoBin) UnmarshalJSON ¶
UnmarshalJSON and allows a GeoBin to be marshaled into JSON. This functions satisfies the json.Unmarshaler interface.