in util/util.go [99:128]
func SingleNodeCluster(hostport string, hostMap map[string][]string) bool {
// If the map contains more than one host then clearly there is more than
// one address so we can't be a single node cluster.
if len(hostMap) > 1 {
return false
}
host := CaptureHost(hostport)
// If hostport is not even in the map at all then it's not possible for
// us to be a single node cluster.
_, ok := hostMap[host]
if !ok {
return false
}
// Same as above; there is most than one host
if len(hostMap[host]) > 1 {
return false
}
// There is a single hostport in the map; check that it matches
if hostMap[host][0] == hostport {
return true
}
// There is a single hostport in the map but it doesn't match the given
// hostport.
return false
}