-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13426 from influxdata/sgc/feat/13369
Implementation of storage schema TagValues API
- Loading branch information
Showing
30 changed files
with
2,295 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,35 @@ | ||
package storage | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/influxdata/influxdb" | ||
"github.com/influxdata/influxdb/tsdb/cursors" | ||
"github.com/influxdata/influxql" | ||
) | ||
|
||
// StringIterator describes the behavior for enumerating a sequence of | ||
// string values. | ||
type StringIterator interface { | ||
// Next advances the StringIterator to the next value. It returns false | ||
// when there are no more values. | ||
Next() bool | ||
|
||
// Value returns the current value. | ||
Value() string | ||
} | ||
|
||
// TagKeys returns an iterator where the values are tag keys for the bucket | ||
// matching the predicate within the time range (start, end]. | ||
func (e *Engine) TagKeys(orgID, bucketID influxdb.ID, start, end int64, predicate influxql.Expr) StringIterator { | ||
func (e *Engine) TagKeys(ctx context.Context, orgID, bucketID influxdb.ID, start, end int64, predicate influxql.Expr) cursors.StringIterator { | ||
// This method would be invoked when the consumer wants to get the following schema information for an arbitrary | ||
// time range in a single bucket: | ||
// | ||
// * All tag keys; | ||
// * All tag keys filtered by an arbitrary predicate, e.g., tag keys for a measurement or tag keys appearing alongside another tag key pair. | ||
// | ||
return nullStringIterator | ||
|
||
return cursors.NewStringSliceIterator([]string{"\x00", "arch", "cluster_id", "datacenter", "hostname", "os", "rack", "region", "service", "service_environment", "service_version", "\xff"}) | ||
} | ||
|
||
// 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]. | ||
func (e *Engine) TagValues(orgID, bucketID influxdb.ID, tagKey string, start, end int64, predicate influxql.Expr) StringIterator { | ||
// This method would be invoked when the consumer wants to get the following schema information for an arbitrary | ||
// time range in a single bucket: | ||
// | ||
// * All measurement names, i.e. tagKey == _measurement); | ||
// * All field names for a specific measurement using a predicate | ||
// * i.e. tagKey is "_field", predicate _measurement == "<measurement>" | ||
// | ||
return nullStringIterator | ||
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) | ||
} | ||
|
||
var nullStringIterator StringIterator = &emptyStringIterator{} | ||
|
||
type emptyStringIterator struct{} | ||
|
||
func (*emptyStringIterator) Next() bool { return false } | ||
func (*emptyStringIterator) Value() string { return "" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.