1package storage
2
3import (
4	"context"
5	"time"
6
7	"github.com/influxdata/influxdb/services/meta"
8	"github.com/influxdata/influxdb/tsdb"
9)
10
11type MetaClient interface {
12	ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta.ShardGroupInfo, err error)
13}
14
15// Request message for Storage.Read.
16type ReadRequest struct {
17	Database string
18	RP       string
19	Shards   []*tsdb.Shard
20	Start    int64 // start time
21	End      int64 // end time
22}
23
24type Store struct {
25	TSDBStore *tsdb.Store
26}
27
28// Read creates a ResultSet that reads all points with a timestamp ts, such that start ≤ ts < end.
29func (s *Store) Read(ctx context.Context, req *ReadRequest) (*ResultSet, error) {
30	var cur seriesCursor
31	if ic, err := newIndexSeriesCursor(ctx, req.Shards); err != nil {
32		return nil, err
33	} else if ic == nil {
34		return nil, nil
35	} else {
36		cur = ic
37	}
38
39	return newResultSet(ctx, req, cur), nil
40}
41