/*
Returns the ids array in arbitrary order. Valid ids start at offset
of 0 and end at a limit of size() - 1

Note: This is a destructive operation. clear() must be called in
order to reuse this BytesRefHash instance.
*/
769654
func (h *BytesRefHash) compact() []int {
	assert2(h.bytesStart != nil, "bytesStart is nil - not initialized")
	upto := 0
	for i := 0; i < h.hashSize; i++ {
		if h.ids[i] != -1 {
			if upto < i {
				h.ids[upto] = h.ids[i]
				h.ids[i] = -1
			}
			upto++
		}
	}

	assert(upto == h.count)
	h.lastCount = h.count
	return h.ids
}
711291
func (offers Slice) IDs() []mesos.OfferID {
	ids := make([]mesos.OfferID, len(offers))
	for i := range offers {
		ids[i] = offers[i].ID
	}
	return ids
}
1220796
func HashIdToHash(id byte) (h crypto.Hash, ok bool) {
	for _, m := range hashToHashIdMapping {
		if m.id == id {
			return m.hash, true
		}
	}
	return 0, false
}
584853
func GetLedgerIDs() ([]string, error) {
	lock.Lock()
	defer lock.Unlock()
	if !initialized {
		return nil, ErrLedgerMgmtNotInitialized
	}
	return ledgerProvider.List()
}
1215915
func (q MoreLikeThisQuery) Ids(ids ...string) MoreLikeThisQuery {
	q.ids = append(q.ids, ids...)
	return q
}
427157
func (q *Query) IDs() ([]string, error) {
	tx := q.pool.NewTransaction()
	ids := []string{}
	newTransactionQuery(q.query, tx).IDs(&ids)
	if err := tx.Exec(); err != nil {
		return nil, err
	}
	return ids, nil
}
1017541
func (p *LogPrefix) getIDFromPrefix() HashID {
	if p.Prefix == "" {
		panic("empty prefix")
	}
	return makeHashID(p.Prefix)
}
706789
func (c *lruCache) IDs() []uint64 {
	a := make([]uint64, 0, len(c.counts))
	for id := range c.counts {
		a = append(a, id)
	}
	sort.Sort(uint64Slice(a))
	return a
}
1185739
func (i *Idm) GetIDInRange(start, end uint64, serial bool) (uint64, error) {
	if i.handle == nil {
		return 0, errors.New("ID set is not initialized")
	}

	if start < i.start || end > i.end {
		return 0, errors.New("Requested range does not belong to the set")
	}

	ordinal, err := i.handle.SetAnyInRange(start-i.start, end-i.start, serial)

	return i.start + ordinal, err
}
427563
func (f *FilterOp) Ids(ids ...interface{}) *FilterOp {
	f.IdsProp = &IdsFilter{Values: ids}
	return f
}
677137
func (flf *fileLedgerFactory) ChainIDs() []string {
	chainIDs, err := flf.blkstorageProvider.List()
	if err != nil {
		logger.Panic(err)
	}
	return chainIDs
}
631390
func ExtractHostID(id string) (string, error) {
	ids := strings.SplitN(id, "-", 2)
	if len(ids) != 2 || ids[0] == "" || ids[1] == "" {
		return "", errors.New("invalid ID")
	}
	return ids[0], nil
}
465831
func (u User) GetReferencedIDs() []jsonapi.ReferenceID {
	result := []jsonapi.ReferenceID{}
	for _, chocolateID := range u.ChocolatesIDs {
		result = append(result, jsonapi.ReferenceID{
			ID:   chocolateID,
			Type: "chocolates",
			Name: "sweets",
		})
	}

	return result
}
1103234
func (d *Daemon) containerExecIds() map[string]struct{} {
	ids := map[string]struct{}{}
	for _, c := range d.containers.List() {
		for _, id := range c.ExecCommands.List() {
			ids[id] = struct{}{}
		}
	}
	return ids
}
1339226
func (q *TagQuery) getInitialIds() (chan schema.MKey, chan struct{}) {
	idCh := make(chan schema.MKey, 1000)
	stopCh := make(chan struct{})
	q.wg.Add(1)

	switch q.startWith {
	case EQUAL:
		query := q.equal[0]
		q.equal = q.equal[1:]
		go q.getInitialByEqual(query, idCh, stopCh)
	case PREFIX:
		query := q.prefix[0]
		q.prefix = q.prefix[1:]
		go q.getInitialByPrefix(query, idCh, stopCh)
	case MATCH:
		query := q.match[0]
		q.match = q.match[1:]
		go q.getInitialByMatch(query, idCh, stopCh)
	case PREFIX_TAG:
		go q.getInitialByTagPrefix(idCh, stopCh)
	case MATCH_TAG:
		go q.getInitialByTagMatch(idCh, stopCh)
	}

	return idCh, stopCh
}
463199
func IDs(ids []ArticleID) QueryOpt {
	return QueryOpt{func(o *QueryOptions) {
		o.IDs = ids
	}}
}
535593
func RetrieveAllVinDbIDs(db *sql.DB) (vinDbIDs []uint64, err error) {
	var rows *sql.Rows
	rows, err = db.Query(internal.SelectVinIDsALL)
	if err != nil {
		return
	}
	defer closeRows(rows)

	for rows.Next() {
		var id uint64
		err = rows.Scan(&id)
		if err != nil {
			break
		}

		vinDbIDs = append(vinDbIDs, id)
	}

	return
}