From f1245e8dda198276c7ea7fa040f79133b5327dfc Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Thu, 14 Feb 2013 08:19:41 -0800 Subject: [PATCH] Interface simplifications. GetFingerprintsForLabelName ([]*Fingerprint, error) -> GetFingerprintsForLabelName ([]Fingerprint, error) --- storage/metric/interface.go | 2 +- storage/metric/leveldb/reading.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/storage/metric/interface.go b/storage/metric/interface.go index 5280cdc73..7ec676241 100644 --- a/storage/metric/interface.go +++ b/storage/metric/interface.go @@ -38,7 +38,7 @@ type MetricPersistence interface { // Get all of the metric fingerprints that are associated for a given label // name. - GetFingerprintsForLabelName(model.LabelName) ([]*model.Fingerprint, error) + GetFingerprintsForLabelName(model.LabelName) ([]model.Fingerprint, error) GetMetricForFingerprint(model.Fingerprint) (*model.Metric, error) diff --git a/storage/metric/leveldb/reading.go b/storage/metric/leveldb/reading.go index e76851c4d..a2bd6f7cf 100644 --- a/storage/metric/leveldb/reading.go +++ b/storage/metric/leveldb/reading.go @@ -222,7 +222,6 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.Lab for i := 1; i < numberOfSets; i++ { base = base.Intersection(sets[i]) } - fps = []model.Fingerprint{} for _, e := range base.Elements() { fingerprint := e.(model.Fingerprint) fps = append(fps, fingerprint) @@ -231,7 +230,7 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.Lab return } -func (l *LevelDBMetricPersistence) GetFingerprintsForLabelName(labelName model.LabelName) (fps []*model.Fingerprint, err error) { +func (l *LevelDBMetricPersistence) GetFingerprintsForLabelName(labelName model.LabelName) (fps []model.Fingerprint, err error) { begin := time.Now() defer func() { @@ -240,8 +239,6 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelName(labelName model.L recordOutcome(storageOperations, storageLatency, duration, err, map[string]string{operation: getFingerprintsForLabelName, result: success}, map[string]string{operation: getFingerprintsForLabelName, result: failure}) }() - fps = make([]*model.Fingerprint, 0, 0) - raw, err := l.labelNameToFingerprints.Get(coding.NewProtocolBufferEncoder(model.LabelNameToDTO(&labelName))) if err != nil { return @@ -256,7 +253,7 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelName(labelName model.L for _, m := range unmarshaled.Member { fp := model.Fingerprint(*m.Signature) - fps = append(fps, &fp) + fps = append(fps, fp) } return