// Clusters implements the lingo.AnnotationFixer interface.
556380
func (p *Tagger) Clusters() (map[string]lingo.Cluster, error) {
	if p.clusters == nil {
		return nil, componentUnavailable("clusters")
	}
	return p.clusters, nil
}
889597
func sizeToClusters(s *BDRVState, size uint64) uint64 {
	return (size + uint64(s.ClusterSize-1)) >> uint(s.ClusterBits)
}
654076
func (c *RESTClientset) ListClusters(options metav1.ListOptions) (*kops.ClusterList, error) {
	return c.KopsClient.Clusters(metav1.NamespaceAll).List(options)
}
562894
func (c *Cluster) AllocIDs(n int) []uint64 {
	c.Lock()
	defer c.Unlock()

	var ids []uint64
	for len(ids) < n {
		ids = append(ids, c.allocID())
	}
	return ids
}
751570
func (s *ClusterHealthService) Indices(indices ...string) *ClusterHealthService {
	s.indices = make([]string, 0)
	s.indices = append(s.indices, indices...)
	return s
}
924288
func Clusters(clusters map[string]cluster.Cluster) []cluster.Cluster {
	cs := make([]cluster.Cluster, 0, len(clusters))
	for _, cls := range clusters {
		cs = append(cs, cls)
	}
	return cs
}
1259797
func (s *ClusterStateService) Indices(indices ...string) *ClusterStateService {
	s.indices = make([]string, 0)
	s.indices = append(s.indices, indices...)
	return s
}
1292656
func (g *Cloud) ListClusters(ctx context.Context) ([]string, error) {
	allClusters := []string{}

	for _, zone := range g.managedZones {
		clusters, err := g.listClustersInZone(zone)
		if err != nil {
			return nil, err
		}
		// TODO: Scoping?  Do we need to qualify the cluster name?
		allClusters = append(allClusters, clusters...)
	}

	return allClusters, nil
}
979226
func cluster(clusters []*Cluster, distancer ClusterDistancer, threshold float64) []*Cluster {
	if len(clusters) < 2 {
		return clusters
	}

	count := 0
	for _, cluster := range clusters {
		count += len(cluster.Pointers)
	}

	clusters, found := clusterClusters(
		clusters,
		// Default initialization, TODO: better bucketing/prefiltering will greatly increase performance.
		initClusterDistances(clusters, distancer, threshold),
		distancer,
		threshold,
	)

	result := make([]*Cluster, 0, found)
	for _, cluster := range clusters {
		if cluster != nil {
			result = append(result, cluster)
		}
	}

	return result
}
1201299
func (cm *ClusterMesh) NumReadyClusters() int {
	cm.mutex.RLock()
	defer cm.mutex.RUnlock()

	nready := 0
	for _, cm := range cm.clusters {
		if cm.isReady() {
			nready++
		}
	}

	return nready
}
185273
func (o *VCenterDataCenter) VCenterClusters(info *bambou.FetchingInfo) (VCenterClustersList, *bambou.Error) {

	var list VCenterClustersList
	err := bambou.CurrentSession().FetchChildren(o, VCenterClusterIdentity, &list, info)
	return list, err
}
334482
func newCluster(conn Connection) (Cluster, error) {
	if conn == nil {
		return nil, WithStack(InvalidArgumentError{Message: "conn is nil"})
	}
	return &cluster{
		conn: conn,
	}, nil
}
229914
func parseClusteringKeys(ckStr string) ([]*ClusteringKey, error) {
	ckStr = strings.TrimSpace(ckStr)
	cks := strings.Split(ckStr, ",")
	var clusteringKeys []*ClusteringKey
	for _, ck := range cks {
		fields := strings.Fields(ck)
		if len(fields) == 0 {
			continue
		}
		if len(fields) > 2 {
			return nil, fmt.Errorf("Clustering key definition %q should look like \"name[ asc/desc]\"",
				ck)
		}
		descending := false
		if len(fields) == 2 {
			switch strings.ToLower(fields[1]) {
			case desc:
				descending = true
			case asc:
				descending = false
			default:
				return nil, fmt.Errorf("invalid clustering key order %q in %q", fields[1], ck)
			}

		}

		clusteringKeys = append(clusteringKeys, &ClusteringKey{Name: strings.TrimSpace(fields[0]), Descending: descending})
	}
	return clusteringKeys, nil
}
1236008
func (s *DescribeClusterSubnetGroupsOutput) SetClusterSubnetGroups(v []*ClusterSubnetGroup) *DescribeClusterSubnetGroupsOutput {
	s.ClusterSubnetGroups = v
	return s
}
69604
func (s *ClusterService) NewListClustersParams() *ListClustersParams {
	p := &ListClustersParams{}
	p.p = make(map[string]interface{})
	return p
}
808620
func (s *ListClustersOutput) SetClusters(v []*ClusterSummary) *ListClustersOutput {
	s.Clusters = v
	return s
}
1025854
func (c *client) Cluster(ctx context.Context) (Cluster, error) {
	role, err := c.ServerRole(ctx)
	if err != nil {
		return nil, WithStack(err)
	}
	if role == ServerRoleSingle || role == ServerRoleSingleActive || role == ServerRoleSinglePassive {
		// Standalone server, this is wrong
		return nil, WithStack(newArangoError(412, 0, "Cluster expected, found SINGLE server"))
	}
	cl, err := newCluster(c.conn)
	if err != nil {
		return nil, WithStack(err)
	}
	return cl, nil
}