From b6b6f52ec8608e1a694357357c3f1fde669f1e6d Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Wed, 14 Mar 2018 20:15:30 +0800 Subject: cmd: implement preimage dump and import cmds --- ethdb/database.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ethdb/database.go') 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() -- cgit v1.2.3