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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
c9df6fe7
Commit
c9df6fe7
authored
Dec 19, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a8b88bc3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
44 deletions
+13
-44
bigfile/_file_zodb.pyx
bigfile/_file_zodb.pyx
+13
-44
No files found.
bigfile/_file_zodb.pyx
View file @
c9df6fe7
...
...
@@ -33,9 +33,20 @@ cdef extern from "bigfile/_bigfile.h":
ctypedef
extern
class
wendelin
.
bigfile
.
_bigfile
.
BigFile
[
object
PyBigFile
]:
pass
# ZBigFile_mmap_ops is virtmem mmap functions for _ZBigFile.
cdef
extern
from
"<wendelin/bigfile/file.h>"
nogil
:
struct
bigfile_ops
:
pass
cdef
extern
from
*
nogil
:
"""
extern const bigfile_ops ZBigFile_mmap_ops;
"""
const
bigfile_ops
ZBigFile_mmap_ops
import
wcfs
as
pywcfs
from
wcfs.internal
cimport
_wcfs
as
wcfs
from
golang
cimport
nil
from
cpython
cimport
PyCapsule_New
from
ZODB.Connection
import
Connection
as
ZConnection
from
ZODB.utils
import
u64
...
...
@@ -73,8 +84,8 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
def
loadblk
(
self
,
blk
,
buf
):
return
self
.
zself
.
loadblk
(
blk
,
buf
)
def
storeblk
(
self
,
blk
,
buf
):
return
self
.
zself
.
storeblk
(
blk
,
buf
)
# blkmmapper is pycapsule with virtmem mmap
per for the f
ile.
#
it relies
on .wfileh being initialized by .fileh_open()
# blkmmapper is pycapsule with virtmem mmap
functions for _ZBigF
ile.
#
The functions rely
on .wfileh being initialized by .fileh_open()
blkmmapper
=
PyCapsule_New
(
<
void
*>&
ZBigFile_mmap_ops
,
"bigfile.blkmmaper"
,
NULL
)
# fileh_open wraps BigFile.fileh_open and makes sure that WCFS file handle
...
...
@@ -97,49 +108,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
return
super
(
_ZBigFile
,
zf
).
fileh_open
(
mmap_overlay
)
"""
# blkmmapper is pycapsule with virtmem mmapper for the file.
# it relies on .wfileh being initialized by .fileh_open()
@staticmethod
def blkmmapper():
# def blkmmapper(_ZBigFile zf):
# # it is called from under PyBigFile.fileh_open(mmap_overlay=True) and
# # .zfile should be already associated with jar and have oid.
#
# # make sure that WCFS file handle corresponding to ZBigFile is opened.
# cdef wcfs.PyFileH pywfileh
# 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?
#
# # join zconn to wconn; link to wconn from _ZBigFile
# pywconn = pywconnOf(zconn)
# pywfileh = pywconn.open(zf.zself._p_oid)
# zf.wfileh = pywfileh.wfileh
# zf is ready to serve mmap requests via .wfileh
# return pycapsule with corresponding mmap methods.
#
# the capsule is not bound to particular _ZBigFile object because
# .mmap_* methods receive BigFile* argument which they upcast to _ZBigFile.
return _ZBigFile_mmap_pycapsule
"""
# _ZBigFile_mmap_pycapsule is pycapsule with functions that we give to
# PyBigFile for ZBigFile virtmem .mmap* ops (see _ZBigFile.blkmmapper).
cdef
extern
from
"<wendelin/bigfile/file.h>"
nogil
:
struct
bigfile_ops
:
pass
cdef
extern
from
*
nogil
:
"""
extern const bigfile_ops ZBigFile_mmap_ops;
"""
const
bigfile_ops
ZBigFile_mmap_ops
from
cpython
cimport
PyCapsule_New
#cdef object _ZBigFile_mmap_pycapsule = PyCapsule_New(
# <void*>&ZBigFile_mmap_ops, "bigfile.blkmmaper", NULL)
# pywconnOf establishes and returns (py) wcfs.Conn associated with 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