// MatchTagValueSeriesIDIterator returns a series iterator for tags which match value.
// If matches is false, returns iterators which do not match value.
348123
func (i *Index) MatchTagValueSeriesIDIterator(name, key []byte, value *regexp.Regexp, matches bool) (tsdb.SeriesIDIterator, error) {
	release := i.sfile.Retain()
	defer release()

	itr, err := i.matchTagValueSeriesIDIterator(name, key, value, matches)
	if err != nil {
		return nil, err
	}
	return tsdb.FilterUndeletedSeriesIDIterator(i.sfile, itr), nil
}
1009446
func (i *Index) tagValueSeriesIDIterator(name, key, value []byte) (tsdb.SeriesIDIterator, error) {
	// Check series ID set cache...
	if i.config.SeriesIDSetCacheSize > 0 { // Cache enabled.
		if ss := i.tagValueCache.Get(name, key, value); ss != nil {
			// Return a clone because the set is mutable.
			return tsdb.NewSeriesIDSetIterator(ss.Clone()), nil
		}
	}

	a := make([]tsdb.SeriesIDIterator, 0, len(i.partitions))
	for _, p := range i.partitions {
		itr, err := p.TagValueSeriesIDIterator(name, key, value)
		if err != nil {
			return nil, err
		} else if itr != nil {
			a = append(a, itr)
		}
	}

	itr := tsdb.MergeSeriesIDIterators(a...)
	if i.config.SeriesIDSetCacheSize == 0 { // Cache disabled.
		return itr, nil
	}

	// Check if the iterator contains only series id sets. Cache them...
	if ssitr, ok := itr.(tsdb.SeriesIDSetIterator); ok {
		ss := ssitr.SeriesIDSet()
		ss.SetCOW(true) // This is important to speed the clone up.
		i.tagValueCache.Put(name, key, value, ss)
	}
	return itr, nil
}
940250
func (mvl *MetricsList) GetTagValue(tag string) (value string, e error) {
	if value, ok := mvl.tags[tag]; !ok {
		return value, errors.New("Tag unknown!")
	} else {
		return value, e
	}
}
778074
func (s *DescribeHsmClientCertificatesInput) SetTagValues(v []*string) *DescribeHsmClientCertificatesInput {
	s.TagValues = v
	return s
}
743813
func NewTSDBTagValueIteratorAdapter(itr TagValueIterator) tsdb.TagValueIterator {
	if itr == nil {
		return nil
	}
	return &tsdbTagValueIteratorAdapter{itr: itr}
}
261325
func (f *IndexFile) TagValueIterator(name, key []byte) TagValueIterator {
	tblk := f.tblks[string(name)]
	if tblk == nil {
		return nil
	}

	// Find key element.
	ke := tblk.TagKeyElem(key)
	if ke == nil {
		return nil
	}

	// Merge all value series iterators together.
	return ke.TagValueIterator()
}
380575
func (f *SeriesFile) SeriesIDIterator() SeriesIDIterator {
	var ids []SeriesID
	for _, p := range f.partitions {
		ids = p.AppendSeriesIDs(ids)
	}
	sort.Slice(ids, func(i, j int) bool { return ids[i].Less(ids[j]) })
	return NewSeriesIDSliceIterator(ids)
}
1041873
func (s *DescribeClusterSnapshotsInput) SetTagValues(v []*string) *DescribeClusterSnapshotsInput {
	s.TagValues = v
	return s
}
390247
func (p tagKeyMergeElem) TagValueIterator() TagValueIterator {
	if len(p) == 0 {
		return nil
	}

	a := make([]TagValueIterator, 0, len(p))
	for _, e := range p {
		itr := e.TagValueIterator()

		a = append(a, itr)
		if e.Deleted() {
			break
		}
	}
	return MergeTagValueIterators(a...)
}
200814
func (s *DescribeEventSubscriptionsInput) SetTagValues(v []*string) *DescribeEventSubscriptionsInput {
	s.TagValues = v
	return s
}
223313
func MatchImageStreamTag(label labels.Selector, field fields.Selector) kstorage.SelectionPredicate {
	return kstorage.SelectionPredicate{
		Label: label,
		Field: field,
		GetAttrs: func(o runtime.Object) (labels.Set, fields.Set, bool, error) {
			obj, ok := o.(*imageapi.ImageStreamTag)
			if !ok {
				return nil, nil, false, fmt.Errorf("not an ImageStreamTag")
			}
			return labels.Set(obj.Labels), SelectableFields(obj), obj.Initializers != nil, nil
		},
	}
}
696580
func (fs *FileSet) TagValueIterator(name, key []byte) TagValueIterator {
	a := make([]TagValueIterator, 0, len(fs.files))
	for _, f := range fs.files {
		itr := f.TagValueIterator(name, key)
		if itr != nil {
			a = append(a, itr)
		}
	}
	return MergeTagValueIterators(a...)
}
846177
func (it *Comparison) TagResults(dst map[string]graph.Value) {
	it.tags.TagResult(dst, it.Result())

	it.subIt.TagResults(dst)
}
244593
func (p *Partition) TagValueIterator(name, key []byte) (tsdb.TagValueIterator, error) {
	fs, err := p.FileSet()
	if err != nil {
		return nil, err
	}
	return newFileSetTagValueIterator(fs,
		NewTSDBTagValueIteratorAdapter(fs.TagValueIterator(name, key))), nil
}
624177
func (s *DescribeTagsInput) SetTagValues(v []*string) *DescribeTagsInput {
	s.TagValues = v
	return s
}
1169235
func (it *Or) TagResults(dst map[string]graph.Value) {
	it.tags.TagResult(dst, it.Result())

	it.internalIterators[it.currentIterator].TagResults(dst)
}
1339096
func MergeTagValueIterators(itrs ...TagValueIterator) TagValueIterator {
	if len(itrs) == 0 {
		return nil
	} else if len(itrs) == 1 {
		return itrs[0]
	}

	return &tagValueMergeIterator{
		buf:  make([][]byte, len(itrs)),
		itrs: itrs,
	}
}