forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resultset.go
50 lines (40 loc) · 798 Bytes
/
resultset.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
41
42
43
44
45
46
47
48
49
50
package storage
import (
"context"
"github.com/influxdata/influxdb/models"
"github.com/influxdata/influxdb/tsdb"
)
type readRequest struct {
ctx context.Context
start, end int64
asc bool
limit uint64
aggregate *Aggregate
}
type ResultSet struct {
req readRequest
cur seriesCursor
row seriesRow
}
func (r *ResultSet) Close() {
r.row.shards = nil
r.cur.Close()
}
func (r *ResultSet) Next() bool {
row := r.cur.Next()
if row == nil {
return false
}
r.row = *row
return true
}
func (r *ResultSet) Cursor() tsdb.Cursor {
cur := newMultiShardBatchCursor(r.req.ctx, r.row, &r.req)
if r.req.aggregate != nil {
cur = newAggregateBatchCursor(r.req.ctx, r.req.aggregate, cur)
}
return cur
}
func (r *ResultSet) Tags() models.Tags {
return r.row.tags
}