// ID implements distributor.DistributionStratgey
332327
func (d *Distributor) ID(req *api.CollectorIDRequest) (*api.CollectorIDReply, error) {
	d.Lock()
	defer d.Unlock()

	if len(d.ids) == 0 {
		return nil, fmt.Errorf("No available collectors")
	}

	i, j := d.ids[0], d.ids[1:]
	d.ids = append(j, i)
	reply := &api.CollectorIDReply{Id: i}

	return reply, nil
}
1182318
func (t *TermsLookup) Id(id string) *TermsLookup {
	t.id = id
	return t
}
85852
func (item *MultiGetItem) Id(id string) *MultiGetItem {
	item.id = id
	return item
}
967040
func (m CustomMapper) ID(fields ...interface{}) (rowIDs []int64, err error) {
	return m.Mapper.ID(m.Func(fields...))
}
32063
func (s *XPackWatcherExecuteWatchService) Id(id string) *XPackWatcherExecuteWatchService {
	s.id = id
	return s
}
1035139
func (m BinaryIntMapper) ID(ii ...interface{}) (rowIDs []int64, err error) {
	// TODO implement (have to redo the Mapper interface to return slice)
	return []int64{0}, nil
}
796389
func (a *action) Id() string {
	return a.st.localID(a.doc.DocId)
}
700441
func (i *smallIndex) ID(val []byte) uint32 {
	i.mut.Lock()
	// intentionally avoiding defer here as we want this call to be as fast as
	// possible in the general case (folder ID already exists). The map lookup
	// with the conversion of []byte to string is compiler optimized to not
	// copy the []byte, which is why we don't assign it to a temp variable
	// here.
	if id, ok := i.val2id[string(val)]; ok {
		i.mut.Unlock()
		return id
	}

	id := i.nextID
	i.nextID++

	valStr := string(val)
	i.val2id[valStr] = id
	i.id2val[id] = valStr

	key := make([]byte, len(i.prefix)+8) // prefix plus uint32 id
	copy(key, i.prefix)
	binary.BigEndian.PutUint32(key[len(i.prefix):], id)
	i.db.Put(key, val, nil)

	i.mut.Unlock()
	return id
}
500995
func (g *Group) Id(name string) *Statement {
	s := Id(name)
	g.items = append(g.items, s)
	return s
}
1337247
func (m BoolMapper) ID(bi ...interface{}) (rowIDs []int64, err error) {
	return []int64{bi[0].(int64)}, nil
}
486580
func (s *GetTemplateService) Id(id string) *GetTemplateService {
	s.id = id
	return s
}
639224
func (e *Epoch) ID() EpochID {
	base := e.Base()
	var id EpochID
	binary.LittleEndian.PutUint64(id[:], base)
	id[7] = e.Level
	return id
}
471097
func (self *TempHumid) Id() string {
	return fmt.Sprintf("%02x:%02x", self.id>>8, self.id&0xff)
}
1236985
func (s *XPackWatcherGetWatchService) Id(id string) *XPackWatcherGetWatchService {
	s.id = id
	return s
}
1176741
func (s *Switch) ID() string {
	var b bytes.Buffer

	err := binary.Write(&b, binary.BigEndian, s.features.DatapathID)
	if err != nil {
		log.ErrorLog("switch/SWITCH_ID_ERR",
			"Failed serialize datapath identifier: ", err)

		return ""
	}

	id := fmt.Sprintf("%x", b.Bytes())
	var parts []string

	for i := 0; i < len(id); i += 2 {
		parts = append(parts, string(id[i:i+2]))
	}

	return strings.Join(parts, ":")
}
373470
func (r *BulkUpdateRequest) Id(id string) *BulkUpdateRequest {
	r.id = id
	r.source = nil
	return r
}
220618
func (m GridMapper) ID(xyi ...interface{}) (rowIDs []int64, err error) {
	x := xyi[0].(float64)
	y := xyi[1].(float64)
	externalID := m.Xres * m.Yres

	// bounds check
	if x < m.Xmin || x > m.Xmax || y < m.Ymin || y > m.Ymax {
		if m.allowExternal {
			return []int64{externalID}, nil
		}
		return []int64{0}, fmt.Errorf("point (%v, %v) out of range", x, y)
	}

	// compute x bin
	xInt := int64(float64(m.Xres) * (x - m.Xmin) / (m.Xmax - m.Xmin))
	// compute y bin
	yInt := int64(float64(m.Yres) * (y - m.Ymin) / (m.Ymax - m.Ymin))

	rowID := (m.Yres * xInt) + yInt
	return []int64{rowID}, nil

}