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