// AddSeries adds the series one at a time along with its chunks.
351413
func (w *Writer) AddSeries(ref uint64, lset labels.Labels, chunks ...chunks.Meta) error {
	if err := w.ensureStage(idxStageSeries); err != nil {
		return err
	}
	if labels.Compare(lset, w.lastSeries) <= 0 {
		return errors.Errorf("out-of-order series added with label set %q", lset)
	}

	if _, ok := w.seriesOffsets[ref]; ok {
		return errors.Errorf("series with reference %d already added", ref)
	}
	// We add padding to 16 bytes to increase the addressable space we get through 4 byte
	// series references.
	if err := w.addPadding(16); err != nil {
		return errors.Errorf("failed to write padding bytes: %v", err)
	}

	if w.pos%16 != 0 {
		return errors.Errorf("series write not 16-byte aligned at %d", w.pos)
	}
	w.seriesOffsets[ref] = w.pos / 16

	w.buf2.Reset()
	w.buf2.PutUvarint(len(lset))

	for _, l := range lset {
		// here we have an index for the symbol file if v2, otherwise it's an offset
		index, ok := w.symbols[l.Name]
		if !ok {
			return errors.Errorf("symbol entry for %q does not exist", l.Name)
		}
		w.buf2.PutUvarint32(index)

		index, ok = w.symbols[l.Value]
		if !ok {
			return errors.Errorf("symbol entry for %q does not exist", l.Value)
		}
		w.buf2.PutUvarint32(index)
	}

	w.buf2.PutUvarint(len(chunks))

	if len(chunks) > 0 {
		c := chunks[0]
		w.buf2.PutVarint64(c.MinTime)
		w.buf2.PutUvarint64(uint64(c.MaxTime - c.MinTime))
		w.buf2.PutUvarint64(c.Ref)
		t0 := c.MaxTime
		ref0 := int64(c.Ref)

		for _, c := range chunks[1:] {
			w.buf2.PutUvarint64(uint64(c.MinTime - t0))
			w.buf2.PutUvarint64(uint64(c.MaxTime - c.MinTime))
			t0 = c.MaxTime

			w.buf2.PutVarint64(int64(c.Ref) - ref0)
			ref0 = int64(c.Ref)
		}
	}

	w.buf1.Reset()
	w.buf1.PutUvarint(w.buf2.Len())

	w.buf2.PutHash(w.crc32)

	if err := w.write(w.buf1.Get(), w.buf2.Get()); err != nil {
		return errors.Wrap(err, "write series data")
	}

	w.lastSeries = append(w.lastSeries[:0], lset...)

	return nil
}
574810
func (m *logMeasurement) seriesIDSet() *tsdb.SeriesIDSet {
	if m.seriesSet != nil {
		return m.seriesSet.CloneNoLock()
	}

	ss := tsdb.NewSeriesIDSet()
	for seriesID := range m.series {
		ss.AddNoLock(seriesID)
	}
	return ss
}
854750
func CompareSeries(a, b seriesKeyField) int {
	if a == nil {
		a = nilSeries
	}
	if b == nil {
		b = nilSeries
	}

	switch res := bytes.Compare(a.Key(), b.Key()); res {
	case 0:
		return bytes.Compare(a.Field(), b.Field())
	default:
		return res
	}
}
256307
func (b *Broadcaster) Add(sink Sink) error {
	return b.configure(b.adds, sink)
}
594951
func SeriesKeysSize(names [][]byte, tagsSlice []models.Tags) int {
	var n int
	for i := range names {
		n += SeriesKeySize(names[i], tagsSlice[i])
	}
	return n
}
677255
func (t *partitionTracker) AddSeriesDropped(n uint64) {
	if !t.enabled {
		return
	}

	labels := t.Labels()
	t.metrics.SeriesDropped.With(labels).Add(float64(n))
}
798986
func (f *SmartSampler) AddSpans(context context.Context, spans []*trace.Span, sink trace.Sink) error {
	return sink.AddSpans(context, spans)
}
295294
func (st *State) AddMachine(series string, jobs ...MachineJob) (*Machine, error) {
	ms, err := st.AddMachines(MachineTemplate{
		Series: series,
		Jobs:   jobs,
	})
	if err != nil {
		return nil, err
	}
	return ms[0], nil
}
1161089
public AbstractChart<T, S> addSeries(Serie... series) {
		Collection<Serie> chartSeries = getSeries();
		if (chartSeries == null) {
			chartSeries = new ArrayList<Serie>();
		}
		for (int i = series.length - 1; i >= 0; i--) {
			chartSeries.add(series[i]);
		}
		return this;

	}
984850
func (g *SeriesGrouper) Add(
	measurement string,
	tags map[string]string,
	tm time.Time,
	field string,
	fieldValue interface{},
) error {
	var err error
	id := groupID(measurement, tags, tm)
	metric := g.metrics[id]
	if metric == nil {
		metric, err = New(measurement, tags, map[string]interface{}{field: fieldValue}, tm)
		if err != nil {
			return err
		}
		g.metrics[id] = metric
		g.ordered = append(g.ordered, metric)
	} else {
		metric.AddField(field, fieldValue)
	}
	return nil
}
152253
func NewSeriesIDExprIterator(itr SeriesIDIterator, expr influxql.Expr) SeriesIDIterator {
	if itr == nil {
		return nil
	}

	return &SeriesIDExprIterator{
		itr:  itr,
		expr: expr,
	}
}
385558
def add_series(series)
      raise ArgumentError, "Invalid argument 'series' Expected ImageSeries or DoseVolume, got #{series.class}." unless [ImageSeries, DoseVolume].include?(series.class)
      @image_series << series
      @associated_series[series.uid] = series
    end
391745
func (m *MockUpgradeSeriesMachine) Series() string {
	ret := m.ctrl.Call(m, "Series")
	ret0, _ := ret[0].(string)
	return ret0
}
809271
func (p *ProvisionerAPI) Series(args params.Entities) (params.StringResults, error) {
	result := params.StringResults{
		Results: make([]params.StringResult, len(args.Entities)),
	}
	canAccess, err := p.getAuthFunc()
	if err != nil {
		return result, err
	}
	for i, entity := range args.Entities {
		tag, err := names.ParseMachineTag(entity.Tag)
		if err != nil {
			result.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}
		machine, err := p.getMachine(canAccess, tag)
		if err == nil {
			result.Results[i].Result = machine.Series()
		}
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}
225543
func (p *SeriesPartition) Series(id SeriesID) ([]byte, models.Tags) {
	key := p.SeriesKey(id)
	if key == nil {
		return nil, nil
	}
	return ParseSeriesKey(key)
}
307612
func (f *LogFile) AddSeriesList(seriesSet *tsdb.SeriesIDSet, collection *tsdb.SeriesCollection) ([]tsdb.SeriesID, error) {
	var writeRequired bool
	var entries []LogEntry

	var i int // Track the index of the point in the batch
	seriesSet.RLock()
	for iter := collection.Iterator(); iter.Next(); {
		seriesID := iter.SeriesID()

		if seriesSet.ContainsNoLock(seriesID) {
			i++
			continue
		}
		writeRequired = true

		// lazy allocation of entries to avoid common case of no new series
		if entries == nil {
			entries = make([]LogEntry, 0, collection.Length())
		}

		entries = append(entries, LogEntry{
			SeriesID: seriesID,
			name:     iter.Name(),
			tags:     iter.Tags(),
			cached:   true,
			batchidx: i,
		})
		i++
	}
	seriesSet.RUnlock()

	// Exit if all series already exist.
	if !writeRequired {
		return nil, nil
	}

	f.mu.Lock()
	defer f.mu.Unlock()

	seriesSet.Lock()
	defer seriesSet.Unlock()
	var seriesIDs []tsdb.SeriesID
	for i := range entries { // NB - this doesn't evaluate all series ids returned from series file.
		entry := &entries[i]
		if seriesSet.ContainsNoLock(entry.SeriesID) {
			// We don't need to allocate anything for this series.
			continue
		}
		if err := f.appendEntry(entry); err != nil {
			return nil, err
		}
		f.execEntry(entry)
		seriesSet.AddNoLock(entry.SeriesID)

		if seriesIDs == nil {
			seriesIDs = make([]tsdb.SeriesID, collection.Length())
		}
		seriesIDs[entry.batchidx] = entry.SeriesID
	}

	// Flush buffer and sync to disk.
	if err := f.FlushAndSync(); err != nil {
		return nil, err
	}
	return seriesIDs, nil
}
111672
func Convert_core_EventSeries_To_v1_EventSeries(in *core.EventSeries, out *v1.EventSeries, s conversion.Scope) error {
	return autoConvert_core_EventSeries_To_v1_EventSeries(in, out, s)
}