Interface simplifications.

GetFingerprintsForLabelSet ([]*Fingerprint, error) ->
GetFingerprintsForLabelSet ([]Fingerprint, error)
This commit is contained in:
Matt T. Proud 2013-02-14 08:07:59 -08:00
parent f03091b139
commit e8a733b525
4 changed files with 7 additions and 7 deletions

View file

@ -37,7 +37,7 @@ func (p *PersistenceAdapter) getMetricsWithLabels(labels model.LabelSet) ([]*mod
} }
metrics := []*model.Metric{} metrics := []*model.Metric{}
for _, fingerprint := range fingerprints { for _, fingerprint := range fingerprints {
metric, err := p.persistence.GetMetricForFingerprint(*fingerprint) metric, err := p.persistence.GetMetricForFingerprint(fingerprint)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -34,7 +34,7 @@ type MetricPersistence interface {
// Get all of the metric fingerprints that are associated with the provided // Get all of the metric fingerprints that are associated with the provided
// label set. // label set.
GetFingerprintsForLabelSet(model.LabelSet) ([]*model.Fingerprint, error) GetFingerprintsForLabelSet(model.LabelSet) ([]model.Fingerprint, error)
// Get all of the metric fingerprints that are associated for a given label // Get all of the metric fingerprints that are associated for a given label
// name. // name.

View file

@ -887,7 +887,7 @@ func TestGetMetricForFingerprint(t *testing.T) {
t.Errorf("Expected one element.") t.Errorf("Expected one element.")
} }
v, e := persistence.GetMetricForFingerprint(*result[0]) v, e := persistence.GetMetricForFingerprint(result[0])
if e != nil { if e != nil {
t.Error(e) t.Error(e)
} }
@ -912,7 +912,7 @@ func TestGetMetricForFingerprint(t *testing.T) {
t.Errorf("Expected one element.") t.Errorf("Expected one element.")
} }
v, e = persistence.GetMetricForFingerprint(*result[0]) v, e = persistence.GetMetricForFingerprint(result[0])
if e != nil { if e != nil {
t.Error(e) t.Error(e)

View file

@ -180,7 +180,7 @@ func (l *LevelDBMetricPersistence) GetLabelNameFingerprints(n *dto.LabelName) (c
return return
} }
func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.LabelSet) (fps []*model.Fingerprint, err error) { func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.LabelSet) (fps []model.Fingerprint, err error) {
begin := time.Now() begin := time.Now()
defer func() { defer func() {
@ -222,10 +222,10 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.Lab
for i := 1; i < numberOfSets; i++ { for i := 1; i < numberOfSets; i++ {
base = base.Intersection(sets[i]) base = base.Intersection(sets[i])
} }
fps = []*model.Fingerprint{} fps = []model.Fingerprint{}
for _, e := range base.Elements() { for _, e := range base.Elements() {
fingerprint := e.(model.Fingerprint) fingerprint := e.(model.Fingerprint)
fps = append(fps, &fingerprint) fps = append(fps, fingerprint)
} }
return return