aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb
diff options
context:
space:
mode:
authorrjl493456442 <garyrong0905@gmail.com>2018-03-14 20:15:30 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-03-26 17:51:46 +0800
commitb6b6f52ec8608e1a694357357c3f1fde669f1e6d (patch)
treead5882a115e1688b5a542f208385c40a21400c6a /ethdb
parent933972d139b0fe291cb01c7ad2c0f9d3109a68dd (diff)
downloadgo-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar.gz
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar.bz2
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar.lz
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar.xz
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.tar.zst
go-tangerine-b6b6f52ec8608e1a694357357c3f1fde669f1e6d.zip
cmd: implement preimage dump and import cmds
Diffstat (limited to 'ethdb')
-rw-r--r--ethdb/database.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/ethdb/database.go b/ethdb/database.go
index 8c557e482..d0256c56f 100644
--- a/ethdb/database.go
+++ b/ethdb/database.go
@@ -29,6 +29,7 @@ import (
"github.com/syndtr/goleveldb/leveldb/filter"
"github.com/syndtr/goleveldb/leveldb/iterator"
"github.com/syndtr/goleveldb/leveldb/opt"
+ "github.com/syndtr/goleveldb/leveldb/util"
)
var OpenFileLimit = 64
@@ -121,6 +122,11 @@ func (db *LDBDatabase) NewIterator() iterator.Iterator {
return db.db.NewIterator(nil, nil)
}
+// NewIteratorByPrefix returns a iterator to iterate over subset of database content with a particular prefix.
+func (db *LDBDatabase) NewIteratorByPrefix(prefix []byte) iterator.Iterator {
+ return db.db.NewIterator(util.BytesPrefix(prefix), nil)
+}
+
func (db *LDBDatabase) Close() {
// Stop the metrics collection to avoid internal database races
db.quitLock.Lock()