Add rocksdb reopen db method

Mainly used for debugging purposes
indexv1
Martin Boehm 2018-03-12 16:28:52 +01:00
parent fbc5248ef8
commit 4c51d7cb0a
1 changed files with 16 additions and 0 deletions

View File

@ -120,6 +120,22 @@ func (d *RocksDB) Close() error {
return nil
}
// Reopen reopens the database
// It closes and reopens db, nobody can access the database during the operation!
func (d *RocksDB) Reopen() error {
err := d.closeDB()
if err != nil {
return err
}
d.db = nil
db, cfh, err := openDB(d.path)
if err != nil {
return err
}
d.db, d.cfh = db, cfh
return nil
}
// GetTransactions finds all input/output transactions for address specified by outputScript.
// Transaction are passed to callback function.
func (d *RocksDB) GetTransactions(outputScript []byte, lower uint32, higher uint32, fn func(txid string, vout uint32, isOutput bool) error) (err error) {