Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ZeroDistance denotes the same resource. ZeroDistance = 0 // InfiniteDistance denotes inifinite distance. InfiniteDistance = ^uint16(0) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map map[string]*entity
Map parses a yaml config containing a nested entity tree topology, describing distances between resources. A typical entity tree contains a collection of datacenter entities at the top layer, nested with collections of entities depicting racks at the next layer, followed by hosts. However, the number of levels can be arbitrary. See dist_test.go for additional examples.
func (Map) FindDistance ¶
func (m Map) FindDistance(sourceResource, targetResource string) (forwardDistance, reverseDistance uint16, err error)
FindDistance finds the forward and reverse distances.
func (Map) FindResources ¶
func (m Map) FindResources(poolResources, sourceResources []string, targetType string, count int, minDistance, maxDistance uint16) (targetResources []string, err error)
FindResources finds a set of target resources of specified type with distance satisfying [minDistance, maxDistance) from each of the sources as well as between each target.
Click to show internal directories.
Click to hide internal directories.