Dolda2000 GitWeb
/
didex.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renamed store.store to avoid top-level conflict.
[didex.git]
/
didex
/
db.py
diff --git
a/didex/db.py
b/didex/db.py
index
75aee02
..
7435166
100644
(file)
--- a/
didex/db.py
+++ b/
didex/db.py
@@
-2,6
+2,8
@@
import time, threading, struct
from . import lib
from bsddb3 import db as bd
from . import lib
from bsddb3 import db as bd
+__all__ = ["environment", "database"]
+
deadlock = bd.DBLockDeadlockError
class environment(lib.closable):
deadlock = bd.DBLockDeadlockError
class environment(lib.closable):
@@
-64,10
+66,18
@@
class txn(object):
def __init__(self, env, flags=bd.DB_TXN_WRITE_NOSYNC):
self.tx = env.txn_begin(None, flags)
self.done = False
def __init__(self, env, flags=bd.DB_TXN_WRITE_NOSYNC):
self.tx = env.txn_begin(None, flags)
self.done = False
+ self.pcommit = set()
def commit(self):
self.done = True
self.tx.commit(0)
def commit(self):
self.done = True
self.tx.commit(0)
+ def run1(list):
+ if len(list) > 0:
+ try:
+ list[0]()
+ finally:
+ run1(list[1:])
+ run1(list(self.pcommit))
def abort(self):
self.done = True
def abort(self):
self.done = True
@@
-81,6
+91,9
@@
class txn(object):
self.abort()
return False
self.abort()
return False
+ def postcommit(self, fun):
+ self.pcommit.add(fun)
+
def txnfun(envfun):
def fxf(fun):
def wrapper(self, *args, tx=None, **kwargs):
def txnfun(envfun):
def fxf(fun):
def wrapper(self, *args, tx=None, **kwargs):