Browse Source

Interface simplifications.

GetBoundaryValues() from pointers to values.
pull/74/head
Matt T. Proud 12 years ago
parent
commit
14788cf4f3
  1. 2
      storage/metric/interface.go
  2. 6
      storage/metric/leveldb/reading.go
  3. 2
      storage/metric/leveldb/rule_integration_test.go

2
storage/metric/interface.go

@ -43,7 +43,7 @@ type MetricPersistence interface {
GetMetricForFingerprint(model.Fingerprint) (*model.Metric, error)
GetValueAtTime(model.Metric, time.Time, StalenessPolicy) (*model.Sample, error)
GetBoundaryValues(*model.Metric, *model.Interval, *StalenessPolicy) (*model.Sample, *model.Sample, error)
GetBoundaryValues(model.Metric, model.Interval, StalenessPolicy) (*model.Sample, *model.Sample, error)
GetRangeValues(*model.Metric, *model.Interval, *StalenessPolicy) (*model.SampleSet, error)
GetAllMetricNames() ([]string, error)

6
storage/metric/leveldb/reading.go

@ -290,7 +290,7 @@ func (l *LevelDBMetricPersistence) GetMetricForFingerprint(f model.Fingerprint)
return
}
func (l *LevelDBMetricPersistence) GetBoundaryValues(m *model.Metric, i *model.Interval, s *metric.StalenessPolicy) (open *model.Sample, end *model.Sample, err error) {
func (l *LevelDBMetricPersistence) GetBoundaryValues(m model.Metric, i model.Interval, s metric.StalenessPolicy) (open *model.Sample, end *model.Sample, err error) {
begin := time.Now()
defer func() {
@ -300,14 +300,14 @@ func (l *LevelDBMetricPersistence) GetBoundaryValues(m *model.Metric, i *model.I
}()
// XXX: Maybe we will want to emit incomplete sets?
open, err = l.GetValueAtTime(*m, i.OldestInclusive, *s)
open, err = l.GetValueAtTime(m, i.OldestInclusive, s)
if err != nil {
return
} else if open == nil {
return
}
end, err = l.GetValueAtTime(*m, i.NewestInclusive, *s)
end, err = l.GetValueAtTime(m, i.NewestInclusive, s)
if err != nil {
return
} else if end == nil {

2
storage/metric/leveldb/rule_integration_test.go

@ -1058,7 +1058,7 @@ var testGetBoundaryValues = func(t test.Tester) {
DeltaAllowance: input.staleness,
}
openValue, endValue, err := persistence.GetBoundaryValues(&m, &interval, &p)
openValue, endValue, err := persistence.GetBoundaryValues(m, interval, p)
if err != nil {
t.Errorf("%d.%d(%s). Could not query for value: %q\n", i, j, behavior.name, err)
}

Loading…
Cancel
Save