From 59a708f25a2a58ced4be3c3515be3f0a347edfc0 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Wed, 12 Dec 2012 12:13:27 +0100 Subject: [PATCH] Provide prototype of storage layer interfaces. --- model/metric.go | 14 +++++++++++++- storage/metric/interface.go | 14 +++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/model/metric.go b/model/metric.go index 277a46b0d..fdb2802b3 100644 --- a/model/metric.go +++ b/model/metric.go @@ -51,12 +51,24 @@ type Sample struct { Timestamp time.Time } -type Samples struct { +type SamplePair struct { Value SampleValue Timestamp time.Time } +type SampleSet struct { + Metric Metric + Values []SamplePair +} + type Interval struct { OldestInclusive time.Time NewestInclusive time.Time } + +// PENDING DELETION BELOW THIS LINE + +type Samples struct { + Value SampleValue + Timestamp time.Time +} diff --git a/storage/metric/interface.go b/storage/metric/interface.go index 5b16be19b..b68ff48c5 100644 --- a/storage/metric/interface.go +++ b/storage/metric/interface.go @@ -37,14 +37,14 @@ 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) + + // DIAGNOSTIC FUNCTIONS PENDING DELETION BELOW HERE + GetAllLabelNames() ([]string, error) GetAllLabelPairs() ([]model.LabelSet, error) GetAllMetrics() ([]model.LabelSet, error) - - // // BEGIN QUERY PRIMITIVES - // - // GetMetricValuesForIntervals(metric, interval) (values ...) - // GetMetricValueLast() - // // END QUERY PRIMITIVES - }