Commit c8292d67 authored by Kirill Smelkov's avatar Kirill Smelkov

wcfs: tests: Split tDB.commit into .commit and ._commit

- .commit performs ZODB commit and synchronizes WCFS to database changes;
- ._commit performs ZODB commit without WCFS synchronization.

We will soon need ._commit to create initial revisions for ZBigFile
while WCFS is not yet started.
parent 2a6b9bc3
...@@ -491,6 +491,11 @@ class tDB(tWCFS): ...@@ -491,6 +491,11 @@ class tDB(tWCFS):
# zf and changeDelta can be optionally provided, in which case .change(zf, # zf and changeDelta can be optionally provided, in which case .change(zf,
# changeDelta) call is made before actually committing. # changeDelta) call is made before actually committing.
def commit(t, zf=None, changeDelta=None): # -> tAt def commit(t, zf=None, changeDelta=None): # -> tAt
head = t._commit(zf, changeDelta)
t._wcsync() # synchronize wcfs to db
return head
def _commit(t, zf=None, changeDelta=None): # -> tAt
if zf is not None: if zf is not None:
assert changeDelta is not None assert changeDelta is not None
t.change(zf, changeDelta) t.change(zf, changeDelta)
...@@ -538,8 +543,6 @@ class tDB(tWCFS): ...@@ -538,8 +543,6 @@ class tDB(tWCFS):
print('M: f<%s>\t%s' % (h(zf._p_oid), sorted(zfDelta.keys()))) print('M: f<%s>\t%s' % (h(zf._p_oid), sorted(zfDelta.keys())))
t._changed = {} t._changed = {}
# synchronize wcfs to db, and we are done
t._wcsync()
return head return head
# _wcsync makes sure wcfs is synchronized to latest committed transaction. # _wcsync makes sure wcfs is synchronized to latest committed transaction.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment