From f2a30cf20c3ef7d2d5b6874ff5f6287e3a429c34 Mon Sep 17 00:00:00 2001 From: "Matt T. Proud" Date: Sun, 24 Mar 2013 06:40:45 +0100 Subject: [PATCH] Several important cleanups and deprecations. EachFunc is deprecated. Remove deprecated ``Pair`` and ``GetAll``. These were originally used for forensic and the old gorest impl. Nothing today in the user-facing path nor the tests uses them, especially since the advent of the ForEach protocol in the interface. --- storage/raw/interface.go | 9 --------- storage/raw/leveldb/leveldb.go | 23 ----------------------- 2 files changed, 32 deletions(-) diff --git a/storage/raw/interface.go b/storage/raw/interface.go index af776d59f..51f99b008 100644 --- a/storage/raw/interface.go +++ b/storage/raw/interface.go @@ -19,13 +19,6 @@ import ( "io" ) -type Pair struct { - Left []byte - Right []byte -} - -type EachFunc func(pair *Pair) - // Persistence models a key-value store for bytes that supports various // additional operations. type Persistence interface { @@ -51,8 +44,6 @@ type Persistence interface { ForEach(decoder storage.RecordDecoder, filter storage.RecordFilter, operator storage.RecordOperator) (scannedEntireCorpus bool, err error) // Commit applies the Batch operations to the database. Commit(Batch) error - // Pending removal. - GetAll() ([]Pair, error) } // Batch models a pool of mutations for the database that can be committed diff --git a/storage/raw/leveldb/leveldb.go b/storage/raw/leveldb/leveldb.go index a85b9f17b..ad280f556 100644 --- a/storage/raw/leveldb/leveldb.go +++ b/storage/raw/leveldb/leveldb.go @@ -185,29 +185,6 @@ func (l *LevelDBPersistence) Commit(b raw.Batch) (err error) { return l.storage.Write(l.writeOptions, batch.batch) } -func (l *LevelDBPersistence) GetAll() (pairs []raw.Pair, err error) { - snapshot := l.storage.NewSnapshot() - defer l.storage.ReleaseSnapshot(snapshot) - readOptions := levigo.NewReadOptions() - defer readOptions.Close() - - readOptions.SetSnapshot(snapshot) - iterator := l.storage.NewIterator(readOptions) - defer iterator.Close() - iterator.SeekToFirst() - - for iterator := iterator; iterator.Valid(); iterator.Next() { - pairs = append(pairs, raw.Pair{Left: iterator.Key(), Right: iterator.Value()}) - - err = iterator.GetError() - if err != nil { - return - } - } - - return -} - func (i *iteratorCloser) Close() (err error) { defer func() { if i.storage != nil {