Esempio n. 1
0
// lookupZoneConfig returns the zone config matching the range.
func lookupZoneConfig(g *gossip.Gossip, repl *Replica) (config.ZoneConfig, error) {
	zoneMap, err := g.GetZoneConfig()
	if err != nil {
		return config.ZoneConfig{}, util.Errorf("unable to lookup zone config for range %s: %s", repl, err)
	}
	prefixConfig := zoneMap.MatchByPrefix(repl.Desc().StartKey)
	return *prefixConfig.Config.GetValue().(*config.ZoneConfig), nil
}