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
70cd471f
Commit
70cd471f
authored
Apr 03, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f72e9137
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
31 deletions
+41
-31
bigfile/_file_zodb.pyx
bigfile/_file_zodb.pyx
+2
-1
lib/tests/test_zodb.py
lib/tests/test_zodb.py
+14
-1
lib/zodb.py
lib/zodb.py
+17
-0
wcfs/__init__.py
wcfs/__init__.py
+0
-17
wcfs/internal/wcfs_test.pyx
wcfs/internal/wcfs_test.pyx
+6
-2
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+2
-10
No files found.
bigfile/_file_zodb.pyx
View file @
70cd471f
...
...
@@ -50,6 +50,7 @@ cdef extern from * nogil:
const
bigfile_ops
ZBigFile_mmap_ops
import
wcfs
as
pywcfs
from
wendelin.lib
import
zodb
as
pyzodb
from
wcfs.client
cimport
_wcfs
as
wcfs
from
golang
cimport
error
,
nil
,
pyerror
from
cpython
cimport
PyCapsule_New
...
...
@@ -139,7 +140,7 @@ cdef wcfs.PyConn pywconnOf(zconn):
# zconn is not yet associated with wconn
zstor
=
zconn
.
db
().
storage
zurl
=
py
wcfs
.
zstor_2zurl
(
zstor
)
zurl
=
py
zodb
.
zstor_2zurl
(
zstor
)
wc
=
pywcfs
.
join
(
zurl
)
wconn
=
wc
.
connect
(
zconn_at
(
zconn
))
...
...
lib/tests/test_zodb.py
View file @
70cd471f
...
...
@@ -17,7 +17,7 @@
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
from
wendelin.lib.zodb
import
LivePersistent
,
deactivate_btree
,
dbclose
,
zconn_at
from
wendelin.lib.zodb
import
LivePersistent
,
deactivate_btree
,
dbclose
,
zconn_at
,
zstor_2zurl
from
wendelin.lib.testing
import
getTestDB
from
persistent
import
Persistent
,
UPTODATE
,
GHOST
,
CHANGED
from
ZODB
import
DB
,
POSException
...
...
@@ -349,6 +349,19 @@ def test_zodb_onresync():
conn
.
close
()
# test that zurl does not change from one open to another storage open.
def
test_zurlstable
():
zurl0
=
None
for
i
in
range
(
10
):
zstor
=
testdb
.
getZODBStorage
()
zurl
=
zstor_2zurl
(
zstor
)
zstor
.
close
()
if
i
==
0
:
zurl0
=
zurl
else
:
assert
zurl
==
zurl0
# ---- misc ----
# zsync syncs ZODB storage.
...
...
lib/zodb.py
View file @
70cd471f
...
...
@@ -299,3 +299,20 @@ elif zmajor == 4:
# ZODB3: TODO
else
:
pass
# raises in onResyncCallback
# zstor_2zurl converts a ZODB storage to URL to access it.
def
zstor_2zurl
(
zstor
):
# There is, sadly, no unified way to do it, as even if storages are created via
# zodburi, after creation its uri is lost. And storages could be created not
# only through URI but e.g. via ZConfig and manually. We want to support all
# those cases...
#
# For this reason extract URL with important for wcfs use-case parameters in
# ad-hoc way.
if
isinstance
(
zstor
,
FileStorage
):
return
"file://%s"
%
(
zstor
.
_file_name
,)
# TODO ZEO + NEO support
raise
NotImplementedError
(
"don't know how to extract zurl from %r"
%
zstor
)
wcfs/__init__.py
View file @
70cd471f
...
...
@@ -286,23 +286,6 @@ def _mntpt_4zurl(zurl):
return
mntpt
# zstor_2zurl converts a ZODB storage to URL to access it.
# XXX -> unexport?
def
zstor_2zurl
(
zstor
):
# There is, sadly, no unified way to do it, as even if storages are created via
# zodburi, after creation its uri is lost. And storages could be created not
# only through URI but e.g. via ZConfig and manually. We want to support all
# those cases...
#
# For this reason extract URL with important for wcfs use-case parameters in
# ad-hoc way.
if
isinstance
(
zstor
,
FileStorage
):
return
"file://%s"
%
(
zstor
.
_file_name
,)
# TODO ZEO + NEO support
raise
NotImplementedError
(
"don't know how to extract zurl from %r"
%
zstor
)
# mkdir -p.
def
_mkdir_p
(
path
):
try
:
...
...
wcfs/internal/wcfs_test.pyx
View file @
70cd471f
...
...
@@ -92,7 +92,11 @@ cdef sync.Mutex mustfaultMu # one at a time as sigaction is per-process
cdef
sigjmp_buf
mustfaultJmp
cdef
cbool
faultExpected
=
False
cdef
cbool
faultedOk
=
False
cdef
unsigned
char
mustfaultG
# global var for compiler not to optimize-out p[0] access
cdef
extern
from
*
nogil
:
"""
volatile unsigned char mustfaultG; // global var for compiler not to optimize-out p[0] access
"""
unsigned
char
mustfaultG
cdef
void
mustfaultSighand
(
int
sig
)
nogil
:
global
faultedOk
...
...
@@ -105,7 +109,7 @@ cdef void mustfaultSighand(int sig) nogil:
siglongjmp
(
mustfaultJmp
,
1
)
cdef
void
_read_mustfault
(
const
unsigned
char
*
p
)
nogil
except
+
topyexc
:
global
faultExpected
,
faultedOk
global
faultExpected
,
faultedOk
,
mustfaultG
cdef
sigaction_t
act
,
saveact
act
.
sa_handler
=
mustfaultSighand
...
...
wcfs/wcfs_test.py
View file @
70cd471f
...
...
@@ -29,7 +29,7 @@ wcfs.py/wcfs.go while running tox tests in wcfs mode.
from
__future__
import
print_function
,
absolute_import
from
wendelin.lib.testing
import
getTestDB
from
wendelin.lib.zodb
import
dbclose
from
wendelin.lib.zodb
import
dbclose
,
zstor_2zurl
from
wendelin.lib.mem
import
memcpy
from
wendelin.bigfile.file_zodb
import
ZBigFile
from
wendelin.bigfile.tests.test_filezodb
import
blksize
...
...
@@ -80,7 +80,7 @@ def setup_module():
testdb
.
setup
()
zstor
=
testdb
.
getZODBStorage
()
testzurl
=
wcfs
.
zstor_2zurl
(
zstor
)
testzurl
=
zstor_2zurl
(
zstor
)
zstor
.
close
()
testmntpt
=
wcfs
.
_mntpt_4zurl
(
testzurl
)
os
.
rmdir
(
testmntpt
)
...
...
@@ -104,14 +104,6 @@ def teardown_function(f):
# ---- test join/autostart ----
# test that zurl does not change from one open to another storage open.
def
test_zurlstable
():
for
i
in
range
(
10
):
zstor
=
testdb
.
getZODBStorage
()
zurl
=
wcfs
.
zstor_2zurl
(
zstor
)
zstor
.
close
()
assert
zurl
==
testzurl
# test that join works.
@
func
def
test_join
():
...
...
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