2019-04-10 22:53:02 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2019-04-17 23:11:09 +00:00
|
|
|
"context"
|
|
|
|
|
2019-04-10 22:53:02 +00:00
|
|
|
"github.com/influxdata/influxdb"
|
2019-04-17 23:11:09 +00:00
|
|
|
"github.com/influxdata/influxdb/tsdb/cursors"
|
2019-04-10 22:53:02 +00:00
|
|
|
"github.com/influxdata/influxql"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TagKeys returns an iterator where the values are tag keys for the bucket
|
|
|
|
// matching the predicate within the time range (start, end].
|
2019-05-02 16:45:38 +00:00
|
|
|
//
|
|
|
|
// TagKeys will always return a StringIterator if there is no error.
|
2019-04-19 23:26:29 +00:00
|
|
|
func (e *Engine) TagKeys(ctx context.Context, orgID, bucketID influxdb.ID, start, end int64, predicate influxql.Expr) (cursors.StringIterator, error) {
|
|
|
|
e.mu.RLock()
|
|
|
|
defer e.mu.RUnlock()
|
|
|
|
if e.closing == nil {
|
|
|
|
return cursors.EmptyStringIterator, nil
|
|
|
|
}
|
2019-04-18 14:31:15 +00:00
|
|
|
|
2019-04-19 23:26:29 +00:00
|
|
|
return e.engine.TagKeys(ctx, orgID, bucketID, start, end, predicate)
|
2019-04-10 22:53:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TagValues returns an iterator which enumerates the values for the specific
|
|
|
|
// tagKey in the given bucket matching the predicate within the
|
|
|
|
// time range (start, end].
|
2019-05-02 16:45:38 +00:00
|
|
|
//
|
|
|
|
// TagValues will always return a StringIterator if there is no error.
|
2019-04-17 23:11:09 +00:00
|
|
|
func (e *Engine) TagValues(ctx context.Context, orgID, bucketID influxdb.ID, tagKey string, start, end int64, predicate influxql.Expr) (cursors.StringIterator, error) {
|
|
|
|
e.mu.RLock()
|
|
|
|
defer e.mu.RUnlock()
|
|
|
|
if e.closing == nil {
|
|
|
|
return cursors.EmptyStringIterator, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return e.engine.TagValues(ctx, orgID, bucketID, tagKey, start, end, predicate)
|
2019-04-10 22:53:02 +00:00
|
|
|
}
|