Simplified LevelDB data storing.

This commit is contained in:
Sascha L. Teichmann 2014-08-04 15:29:26 +02:00
parent 12e0516929
commit de9f738306
1 changed files with 8 additions and 8 deletions

View File

@ -31,11 +31,11 @@ func NewLeveDBBackend(path string, cacheSize int) (ldb *LevelDBBackend, err erro
}
func (ldb *LevelDBBackend) Shutdown() error {
tx := ldb.tx
if tx != nil {
ldb.tx = nil
tx.Close()
}
tx := ldb.tx
if tx != nil {
ldb.tx = nil
tx.Close()
}
ldb.db.Close()
ldb.cache.Close()
return nil
@ -89,7 +89,7 @@ func (ldb *LevelDBBackend) CommitTransaction() (err error) {
tx := ldb.tx
ldb.tx = nil
wo := leveldb.NewWriteOptions()
err = ldb.db.Write(wo, tx)
wo.Close()
return
err = ldb.db.Write(wo, tx)
wo.Close()
return
}