Interface simplifications.
GetBoundaryValues() from pointers to values.
This commit is contained in:
parent
56f069b3ec
commit
14788cf4f3
|
@ -43,7 +43,7 @@ type MetricPersistence interface {
|
||||||
GetMetricForFingerprint(model.Fingerprint) (*model.Metric, error)
|
GetMetricForFingerprint(model.Fingerprint) (*model.Metric, error)
|
||||||
|
|
||||||
GetValueAtTime(model.Metric, time.Time, StalenessPolicy) (*model.Sample, 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)
|
GetRangeValues(*model.Metric, *model.Interval, *StalenessPolicy) (*model.SampleSet, error)
|
||||||
|
|
||||||
GetAllMetricNames() ([]string, error)
|
GetAllMetricNames() ([]string, error)
|
||||||
|
|
|
@ -290,7 +290,7 @@ func (l *LevelDBMetricPersistence) GetMetricForFingerprint(f model.Fingerprint)
|
||||||
return
|
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()
|
begin := time.Now()
|
||||||
|
|
||||||
defer func() {
|
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?
|
// 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 {
|
if err != nil {
|
||||||
return
|
return
|
||||||
} else if open == nil {
|
} else if open == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
end, err = l.GetValueAtTime(*m, i.NewestInclusive, *s)
|
end, err = l.GetValueAtTime(m, i.NewestInclusive, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
} else if end == nil {
|
} else if end == nil {
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ var testGetBoundaryValues = func(t test.Tester) {
|
||||||
DeltaAllowance: input.staleness,
|
DeltaAllowance: input.staleness,
|
||||||
}
|
}
|
||||||
|
|
||||||
openValue, endValue, err := persistence.GetBoundaryValues(&m, &interval, &p)
|
openValue, endValue, err := persistence.GetBoundaryValues(m, interval, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("%d.%d(%s). Could not query for value: %q\n", i, j, behavior.name, err)
|
t.Errorf("%d.%d(%s). Could not query for value: %q\n", i, j, behavior.name, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue