From 0886592ebcedac386fec21d6fac28ac02d659ffc Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Wed, 12 Dec 2012 12:53:34 +0100 Subject: [PATCH] New interface definition after discussion. --- storage/metric/interface.go | 14 ++++++++++---- storage/metric/leveldb/reading.go | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/storage/metric/interface.go b/storage/metric/interface.go index b68ff48c5..05c1865c2 100644 --- a/storage/metric/interface.go +++ b/storage/metric/interface.go @@ -15,8 +15,14 @@ package metric import ( "github.com/matttproud/prometheus/model" + "time" ) +type StalenessPolicy struct { + AllowStale bool + InterpolationInterval time.Duration +} + // MetricPersistence is a system for storing metric samples in a persistence // layer. type MetricPersistence interface { @@ -37,10 +43,10 @@ type MetricPersistence interface { GetMetricForFingerprint(f *model.Fingerprint) (*model.Metric, error) - GetFirstValue(m *model.Metric) (*model.Sample, error) - GetCurrentValue(m *model.Metric) (*model.Sample, error) - GetBoundaryValues(m *model.Metric, i *model.Interval) (*model.SampleSet, error) - GetRangeValues(m *model.Metric, i *model.Interval) (*model.SampleSet, error) + GetFirstValue(*model.Metric) (*model.Sample, error) + 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) // DIAGNOSTIC FUNCTIONS PENDING DELETION BELOW HERE diff --git a/storage/metric/leveldb/reading.go b/storage/metric/leveldb/reading.go index 0c6c8974c..62cc306c2 100644 --- a/storage/metric/leveldb/reading.go +++ b/storage/metric/leveldb/reading.go @@ -20,7 +20,9 @@ import ( "github.com/matttproud/prometheus/coding/indexable" "github.com/matttproud/prometheus/model" dto "github.com/matttproud/prometheus/model/generated" + "github.com/matttproud/prometheus/storage/metric" "log" + "time" ) func (l *LevelDBMetricPersistence) hasIndexMetric(dto *dto.Metric) (bool, error) { @@ -198,3 +200,19 @@ func (l *LevelDBMetricPersistence) GetMetricForFingerprint(f *model.Fingerprint) panic("unreachable") } + +func (l *LevelDBMetricPersistence) GetBoundaryValues(m *model.Metric, i *model.Interval, s *metric.StalenessPolicy) (*model.Sample, *model.Sample, error) { + panic("not implemented") +} + +func (l *LevelDBMetricPersistence) GetFirstValue(m *model.Metric) (*model.Sample, error) { + panic("not implemented") +} + +func (l *LevelDBMetricPersistence) GetValueAtTime(m *model.Metric, t *time.Time, s *metric.StalenessPolicy) (*model.Sample, error) { + panic("not implemented") +} + +func (l *LevelDBMetricPersistence) GetRangeValues(m *model.Metric, i *model.Interval, s *metric.StalenessPolicy) (*model.SampleSet, error) { + panic("not implemented") +}