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 {
|
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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user