Commit c9df6fe7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a8b88bc3
......@@ -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 mmapper for the file.
# it relies on .wfileh being initialized by .fileh_open()
# blkmmapper is pycapsule with virtmem mmap functions for _ZBigFile.
# 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.
......
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