From f03091b139e2b1c37b1cf2271f3e5cef58f6c973 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Wed, 13 Feb 2013 21:11:23 -0800 Subject: [PATCH] Interface simplifications: GetRangeValues From pointers to copies. --- rules/ast/persistence_adapter.go | 4 ++-- storage/metric/interface.go | 2 +- storage/metric/leveldb/reading.go | 2 +- storage/metric/leveldb/rule_integration_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/ast/persistence_adapter.go b/rules/ast/persistence_adapter.go index 23764f31e..d0c1c61f8 100644 --- a/rules/ast/persistence_adapter.go +++ b/rules/ast/persistence_adapter.go @@ -74,7 +74,7 @@ func (p *PersistenceAdapter) GetBoundaryValues(labels model.LabelSet, interval * sampleSets := []*model.SampleSet{} for _, metric := range metrics { // TODO: change to GetBoundaryValues() once it has the right return type. - sampleSet, err := p.persistence.GetRangeValues(metric, interval, p.stalenessPolicy) + sampleSet, err := p.persistence.GetRangeValues(*metric, *interval, *p.stalenessPolicy) if err != nil { return nil, err } @@ -97,7 +97,7 @@ func (p *PersistenceAdapter) GetRangeValues(labels model.LabelSet, interval *mod sampleSets := []*model.SampleSet{} for _, metric := range metrics { - sampleSet, err := p.persistence.GetRangeValues(metric, interval, p.stalenessPolicy) + sampleSet, err := p.persistence.GetRangeValues(*metric, *interval, *p.stalenessPolicy) if err != nil { return nil, err } diff --git a/storage/metric/interface.go b/storage/metric/interface.go index a3c58ceb8..74c4416c2 100644 --- a/storage/metric/interface.go +++ b/storage/metric/interface.go @@ -44,7 +44,7 @@ type MetricPersistence interface { GetValueAtTime(model.Metric, time.Time, StalenessPolicy) (*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) diff --git a/storage/metric/leveldb/reading.go b/storage/metric/leveldb/reading.go index a0a0952aa..a45dfd245 100644 --- a/storage/metric/leveldb/reading.go +++ b/storage/metric/leveldb/reading.go @@ -553,7 +553,7 @@ func (l *LevelDBMetricPersistence) GetValueAtTime(m model.Metric, t time.Time, s return } -func (l *LevelDBMetricPersistence) GetRangeValues(m *model.Metric, i *model.Interval, s *metric.StalenessPolicy) (v *model.SampleSet, err error) { +func (l *LevelDBMetricPersistence) GetRangeValues(m model.Metric, i model.Interval, s metric.StalenessPolicy) (v *model.SampleSet, err error) { begin := time.Now() defer func() { diff --git a/storage/metric/leveldb/rule_integration_test.go b/storage/metric/leveldb/rule_integration_test.go index 14beb6884..5ffda9707 100644 --- a/storage/metric/leveldb/rule_integration_test.go +++ b/storage/metric/leveldb/rule_integration_test.go @@ -1652,7 +1652,7 @@ var testGetRangeValues = func(t test.Tester) { DeltaAllowance: input.staleness, } - values, err := persistence.GetRangeValues(&m, &i, &p) + values, err := persistence.GetRangeValues(m, i, p) if err != nil { t.Errorf("%d.%d(%s). Could not query for value: %q\n", i, j, behavior.name, err) }