mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-05 01:30:24 +01:00
Simplified LevelDB data storing.
This commit is contained in:
parent
12e0516929
commit
de9f738306
16
leveldb.go
16
leveldb.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user