Simplified LevelDB data storing.

This commit is contained in:
Sascha L. Teichmann 2014-08-04 15:29:26 +02:00
parent 12e0516929
commit de9f738306

View File

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