From 5a224c74ea18605ba68863c7052f5622ba5e91b2 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Wed, 10 Apr 2019 15:53:02 -0700 Subject: [PATCH] feat(storage): Stub storage schema APIs Closes #13241 --- storage/engine_schema.go | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 storage/engine_schema.go diff --git a/storage/engine_schema.go b/storage/engine_schema.go new file mode 100644 index 0000000000..ca2908dac0 --- /dev/null +++ b/storage/engine_schema.go @@ -0,0 +1,50 @@ +package storage + +import ( + "github.com/influxdata/influxdb" + "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 { + // 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 +} + +// 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 == "" + // + return nullStringIterator +} + +var nullStringIterator StringIterator = &emptyStringIterator{} + +type emptyStringIterator struct{} + +func (*emptyStringIterator) Next() bool { return false } +func (*emptyStringIterator) Value() string { return "" }