Added a few missing implementations in index.go.

Also, added closing of persistence and mem storage.

Change-Id: Iacf0d22c3520dd2584d9546984c1f8a5ed6cd54e
This commit is contained in:
Bjoern Rabenstein 2014-09-04 16:59:13 +02:00
parent 70e4837650
commit af77d5ef0b
4 changed files with 11 additions and 13 deletions

View File

@ -145,6 +145,7 @@ func main() {
if err != nil {
glog.Fatal("Error opening disk persistence: ", err)
}
defer persistence.Close()
o := &storage_ng.MemorySeriesStorageOptions{
Persistence: persistence,
@ -157,6 +158,7 @@ func main() {
if err != nil {
glog.Fatal("Error opening memory series storage: ", err)
}
defer memStorage.Close()
//registry.MustRegister(memStorage)
var remoteTSDBQueue *remote.TSDBQueueManager

View File

@ -448,22 +448,21 @@ func (i *TotalIndexer) GetMetricForFingerprint(fp clientmodel.Fingerprint) (clie
}
// GetFingerprintsForLabelPair returns all fingerprints for the provided label pair.
func (i *TotalIndexer) GetFingerprintsForLabelPair(l clientmodel.LabelName, v clientmodel.LabelValue) (clientmodel.Fingerprints, error) {
func (i *TotalIndexer) GetFingerprintsForLabelPair(ln clientmodel.LabelName, lv clientmodel.LabelValue) (clientmodel.Fingerprints, error) {
fps, _, err := i.LabelPairToFingerprints.Lookup(&metric.LabelPair{
Name: l,
Value: v,
Name: ln,
Value: lv,
})
return fps, err
}
// GetLabelValuesForLabelName returns all label values associated with a given label name.
func (i *TotalIndexer) GetLabelValuesForLabelName(clientmodel.LabelName) (clientmodel.LabelValues, error) {
// TODO: implement.
return nil, nil
func (i *TotalIndexer) GetLabelValuesForLabelName(ln clientmodel.LabelName) (clientmodel.LabelValues, error) {
lvs, _, err := i.LabelNameToLabelValues.Lookup(ln)
return lvs, err
}
// HasFingerprint returns true if a metric with the given fingerprint has been indexed.
func (i *TotalIndexer) HasFingerprint(clientmodel.Fingerprint) (bool, error) {
// TODO: implement.
return false, nil
func (i *TotalIndexer) HasFingerprint(fp clientmodel.Fingerprint) (bool, error) {
return i.FingerprintMembership.Has(fp)
}

View File

@ -42,7 +42,7 @@ func verifyIndexedState(i int, t *testing.T, b incrementalBatch, indexedFpsToMet
t.Fatalf("%d. fingerprint %v not found", i, fp)
}
if !mOut.Equal(m) {
t.Fatalf("%i. %v: Got: %s; want %s", i, fp, mOut, m)
t.Fatalf("%d. %v: Got: %s; want %s", i, fp, mOut, m)
}
// Check that indexed metrics are in membership index.

View File

@ -243,9 +243,6 @@ func (s *memorySeriesStorage) Close() error {
}
s.fingerprintToSeries = nil
// TODO: Close() persistence either here or in main (where it got created -
// probably better in main).
s.state = storageStopping
return nil