New interface definition after discussion.

This commit is contained in:
Matt T. Proud 2012-12-12 12:53:34 +01:00
parent 59a708f25a
commit 0886592ebc
2 changed files with 28 additions and 4 deletions

View file

@ -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

View file

@ -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")
}