// ISR returns the broker IDs of the current in-sync replica set for the partition
491860
func (p *Partition) ISR() ([]int32, error) {
	if state, err := p.state(); err != nil {
		return nil, err
	} else {
		return state.ISR, nil
	}
}
839688
func IsMarshaler(err error) bool {
	_, ok := Cause(err).(MarshalerError)
	return ok
}
215067
func (n *BuilderNode) ReplicaPartitions(replica int) []int {
	n.builder.ring.FillReplicaToNodeToPartitions()
	partitions := make([]int, len(n.builder.ring.ReplicaToNodeToPartitions[replica][n.index]))
	for i, partition := range n.builder.ring.ReplicaToNodeToPartitions[replica][n.index] {
		partitions[i] = int(partition)
	}
	return partitions
}
688346
func (ps *peerSet) AllPeerIDs() []string {
	ps.lock.RLock()
	defer ps.lock.RUnlock()

	res := make([]string, len(ps.peers))
	idx := 0
	for id := range ps.peers {
		res[idx] = id
		idx++
	}
	return res
}
23616
func IsReseller(token string) (*models.Principal, error) {
	claims, err := parseAndCheckToken(token)
	if err == nil {
		if claims.Issuer == issuerName && claims.Id != "" {
			isReseller := false
			for _, role := range claims.Roles {
				if role == "reseller" {
					isReseller = true
					break
				}
			}
			if isReseller {
				return &models.Principal{
					Name: claims.Id,
				}, nil
			}
			return nil, errors.New(403, "Forbidden: insufficient API key privileges")
		}
	}
	return nil, errors.New(401, "Unauthorized: invalid API key token: %v", err)
}
883969
func IoR(t, nr, size uintptr) uintptr {
	return ioc(directionRead, t, nr, size)
}
1177545
func (fs *Filespace) IsDir(subPath string) bool {
	return disk.IsDir(fs.path + subPath)
}
814912
func (b *Builder) IsMoving(replica, partition int) bool {
	return b.ring.ReplicaToPartitionToWait[replica][partition] > 0
}
1067723
func (c *cluster) partitionNodes(partitionID int) []*Node {
	// Default replica count to between one and the number of nodes.
	// The replica count can be zero if there are no nodes.
	replicaN := c.ReplicaN
	if replicaN > len(c.nodes) {
		replicaN = len(c.nodes)
	} else if replicaN == 0 {
		replicaN = 1
	}

	// Determine primary owner node.
	nodeIndex := c.Hasher.Hash(uint64(partitionID), len(c.nodes))

	// Collect nodes around the ring.
	nodes := make([]*Node, replicaN)
	for i := 0; i < replicaN; i++ {
		nodes[i] = c.nodes[(nodeIndex+i)%len(c.nodes)]
	}

	return nodes
}
84492
func (i *Index) measurementSeriesIDIterator(name []byte) (tsdb.SeriesIDIterator, error) {
	itrs := make([]tsdb.SeriesIDIterator, 0, len(i.partitions))
	for _, p := range i.partitions {
		itr, err := p.MeasurementSeriesIDIterator(name)
		if err != nil {
			tsdb.SeriesIDIterators(itrs).Close()
			return nil, err
		} else if itr != nil {
			itrs = append(itrs, itr)
		}
	}
	return tsdb.MergeSeriesIDIterators(itrs...), nil
}
69598
func (t *Topic) marshalPartitions(partitions PartitionList) ([]byte, error) {
	tm := topicMetadata{Version: 1, Partitions: make(map[string][]int32, len(partitions))}
	for _, part := range partitions {
		tm.Partitions[fmt.Sprintf("%d", part.ID)] = part.Replicas
	}
	return json.Marshal(tm)
}
997388
func (c *cluster) isCoordinator() bool {
	c.mu.RLock()
	defer c.mu.RUnlock()
	return c.unprotectedIsCoordinator()
}
285250
func (_class ClusterClass) PoolResync(sessionID SessionRef, self ClusterRef) (_err error) {
	_method := "Cluster.pool_resync"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertClusterRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
466202
func (iter *Iter) Err() error {
	if iter.err == RadosErrorNotFound {
		return nil
	}
	return iter.err
}
401291
func IsHypervisor(t *testing.T) bool {
	t.Helper()

	cid, err := vsock.ContextID()
	if err != nil {
		SkipDeviceError(t, err)

		t.Fatalf("failed to retrieve context ID: %v", err)
	}

	return cid == vsock.Host
}
1218905
func (m *Manager) IsInOrgs(username string, globalIDs ...string) ([]string, error) {
	var wg sync.WaitGroup
	passed := make([]bool, len(globalIDs))
	errors := make([]error, len(globalIDs))
	for i, globalID := range globalIDs {
		wg.Add(1)
		go func(index int, gID string) {
			defer wg.Done()
			passed[index], errors[index] = m.isOwnerOrMember(gID, username, make(map[string]bool))
		}(i, globalID)
	}
	// Wait untill we are done
	wg.Wait()
	// Report if there was any error
	for _, err := range errors {
		if err != nil {
			return nil, err
		}
	}
	var result []string
	for i, p := range passed {
		if p {
			result = append(result, globalIDs[i])
		}
	}
	return result, nil
}
88056
func (f *FieldInfo) IsPtr() bool {
	_, ok := f.Type.(*ast.StarExpr)
	return ok
}