Skip to content

Commit dd62472

Browse files
committed
feat: plumbing through TimeRange
1 parent a376915 commit dd62472

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

tsdb/engine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ type Engine interface {
8383
DiskSize() int64
8484
IsIdle() (bool, string)
8585
Free() error
86+
// TimeRange will return the min/max time range of shard
87+
TimeRange() (int64, int64)
8688

8789
io.WriterTo
8890
}

tsdb/engine/tsm1/engine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,11 @@ func (e *Engine) LastModified() time.Time {
677677
return fsTime
678678
}
679679

680+
// TimeRange returns the min and max time range for this shard
681+
func (e *Engine) TimeRange() (int64, int64) {
682+
return e.FileStore.TimeRange()
683+
}
684+
680685
// EngineStatistics maintains statistics for the engine.
681686
type EngineStatistics struct {
682687
CacheCompactions int64 // Counter of cache compactions that have ever run.

tsdb/shard.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,16 @@ func (s *Shard) LastModifiedWithErr() (time.Time, error) {
474474
return engine.LastModified(), nil
475475
}
476476

477+
func (s *Shard) TimeRange() (int64, int64, error) {
478+
engine, err := s.Engine()
479+
if err != nil {
480+
return int64(0), int64(0), err
481+
}
482+
483+
minT, maxT := engine.TimeRange()
484+
return minT, maxT, nil
485+
}
486+
477487
// Index returns a reference to the underlying index. It returns an error if
478488
// the index is nil.
479489
func (s *Shard) Index() (Index, error) {

0 commit comments

Comments
 (0)