Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
0cbf4db6
Commit
0cbf4db6
authored
Apr 03, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
338231dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
bigfile/_file_zodb.pyx
bigfile/_file_zodb.pyx
+13
-9
No files found.
bigfile/_file_zodb.pyx
View file @
0cbf4db6
...
...
@@ -57,6 +57,7 @@ from cpython cimport PyCapsule_New
from
ZODB.Connection
import
Connection
as
ZConnection
from
ZODB.utils
import
u64
from
wendelin.lib.zodb
import
zconn_at
import
weakref
# _ZBigFile is base class for ZBigFile that provides BigFile-line base.
...
...
@@ -155,18 +156,18 @@ cdef wcfs.PyConn pywconnOf(zconn):
# ZSync keeps wconn in sync with zconn.
#
XXX -> make generic and use for _ZBigFileH too?
#
-> y: ZSync base + ZSyncWConn, ZSyncBigFileH
#
XXX naming? -> ZKeepInSync ?
#
#
wconn will be closed once zconn is destroyed (not closed, which returns it
#
back into DB pool).
class
ZSync
:
# .zconn
# .wconn
# .zconn
_ref weakref[zodb.Connection]
# .wconn
(py) wcfs.Connection
def
__init__
(
zsync
,
zconn
,
wconn
):
#print('ZSync %r %r' % (zconn, wconn))
assert
zconn
.
open
zsync
.
zconn
=
zconn
# XXX -> weakref
zsync
.
wconn
=
wconn
zsync
.
wconn
=
wconn
zsync
.
zconn_ref
=
weakref
.
ref
(
zconn
,
zsync
.
on_zconn_dealloc
)
# NOTE zconn.onOpenCallback is not enough: zconn.at can change even
# without zconn.close/zconn.open, e.g.:
...
...
@@ -175,11 +176,14 @@ class ZSync:
# tm.commit() # zconn.at updated again
zconn
.
onResyncCallback
(
zsync
)
# TODO zconn dealloc -> wconn.close
# .zconn dealloc -> wconn.close
def
on_zconn_dealloc
(
zsync
,
_
):
zsync
.
wconn
.
close
()
# DB resyncs .zconn onto new database view.
# -> resync .wconn to updated database view of ZODB connection.
def
on_connection_resync
(
zsync
):
#print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
#import traceback; traceback.print_stack()
zsync
.
wconn
.
resync
(
zconn_at
(
zsync
.
zconn
))
zconn
=
zsync
.
zconn_ref
()
zsync
.
wconn
.
resync
(
zconn_at
(
zconn
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment