MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / newClusters

Function newClusters

scope.go:817–830  ·  view source on GitHub ↗
(cfg []config.Cluster)

Source from the content-addressed store, hash-verified

815}
816
817func newClusters(cfg []config.Cluster) (map[string]*cluster, error) {
818 clusters := make(map[string]*cluster, len(cfg))
819 for _, c := range cfg {
820 if _, ok := clusters[c.Name]; ok {
821 return nil, fmt.Errorf("duplicate config for cluster %q", c.Name)
822 }
823 tmpC, err := newCluster(c)
824 if err != nil {
825 return nil, fmt.Errorf("cannot initialize cluster %q: %w", c.Name, err)
826 }
827 clusters[c.Name] = tmpC
828 }
829 return clusters, nil
830}
831
832// getReplica returns least loaded + round-robin replica from the cluster.
833//

Callers 1

applyConfigMethod · 0.85

Calls 1

newClusterFunction · 0.85

Tested by

no test coverage detected