Interface simplifications.

GetFingerprintsForLabelName ([]*Fingerprint, error) ->
GetFingerprintsForLabelName ([]Fingerprint, error)
pull/75/head
Matt T. Proud 2013-02-14 08:19:41 -08:00
parent e8a733b525
commit f1245e8dda
2 changed files with 3 additions and 6 deletions

View File

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

View File

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