Commit 8daa72b8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b0b8350f
......@@ -101,7 +101,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
if zf.wfileh == nil:
zconn = zf.zself._p_jar
assert zconn is not None
# XXX locking? or rely on that ZODB objects for must be used from under 1 thread only?
# XXX locking? or rely on that ZODB objects for zconn must be used from under 1 thread only?
# join zconn to wconn; link to wconn from _ZBigFile
pywconn = pywconnOf(zconn)
......@@ -132,7 +132,34 @@ cdef wcfs.PyConn pywconnOf(zconn):
wc = pywcfs.join(zurl)
wconn = wc.connect(zconn_at(zconn))
# XXX register zconn synchronizer to wconn.resync on zconn open
# XXX zconn goes away -> wconn close & free
zconn._wcfs_wconn = wconn
# keep wconn view of the database in sync with zconn
zconn._wcfs_wconn_zsync = ZSync(zconn, wconn)
return wconn
# ZSync keeps wconn in sync with zconn.
# XXX -> make generic and usefor _ZBigFileH too?
# XXX naming?
class ZSync:
# .zconn
# .wconn
def __init__(zsync, zconn, wconn):
print('ZSync %r %r' % (zconn, wconn))
assert zconn.open
zsync.zconn = zconn # XXX -> weakref
zsync.wconn = wconn
# when connection will be reopened -> zsync.on_connection_open()
zconn.onOpenCallback(zsync)
# DB.open() pops .zconn from connection pool and "opens" for usage.
# -> resync .wconn to new database view of ZODB connection.
def on_connection_open(zsync):
print('ZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
zsync.wconn.resync(zconn_at(zsync.zconn))
# TODO zconn dealloc -> wconn.close
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