Commit f443ae81 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5a975bb4
...@@ -34,20 +34,26 @@ cdef extern from "bigfile/_bigfile.h": ...@@ -34,20 +34,26 @@ cdef extern from "bigfile/_bigfile.h":
ctypedef extern class wendelin.bigfile._bigfile.BigFile[object PyBigFile]: ctypedef extern class wendelin.bigfile._bigfile.BigFile[object PyBigFile]:
pass pass
""" """
# FIXME hack, keep in sync with PyBigFile ## FIXME hack, keep in sync with PyBigFile
cdef extern from *: #cdef extern from *:
""" # """
#include <wendelin/bigfile/file.h> # #include <wendelin/bigfile/file.h>
#include <wendelin/bigfile/virtmem.h> # #include <wendelin/bigfile/virtmem.h>
#
struct cxxPyBigFile { # struct cxxPyBigFile {
PyObject pyobj; # PyObject pyobj;
BigFile file; # BigFile file;
}; # };
""" # """
struct cxxPyBigFile: # struct cxxPyBigFile:
# pass
# ctypedef extern class wendelin.bigfile._bigfile.BigFile[object cxxPyBigFile]:
# pass
cdef extern from "bigfile/_bigfile.h":
struct PyBigFile:
pass pass
ctypedef extern class wendelin.bigfile._bigfile.BigFile[object cxxPyBigFile]: ctypedef extern class wendelin.bigfile._bigfile.BigFile[object PyBigFile]:
pass pass
import wcfs as pywcfs import wcfs as pywcfs
...@@ -66,8 +72,8 @@ from wendelin.lib.zodb import zconn_at ...@@ -66,8 +72,8 @@ from wendelin.lib.zodb import zconn_at
# XXX + wcfs # XXX + wcfs
cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
cdef object zself # reference to ZBigFile cdef object zself # reference to ZBigFile
cdef wcfs.Oid foid # = .zself._p_oid # cdef wcfs.Oid foid # = .zself._p_oid
cdef wcfs.FileH wfileh # WCFS file handle cdef wcfs.FileH wfileh # WCFS file handle. Initially nil, opened by blkmmapper
# XXX Cython does not allow __new__ nor to change arguments passed to __cinit__ / __init__ # XXX Cython does not allow __new__ nor to change arguments passed to __cinit__ / __init__
@staticmethod @staticmethod
...@@ -75,7 +81,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -75,7 +81,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
cdef _ZBigFile obj = _ZBigFile.__new__(_ZBigFile, blksize) cdef _ZBigFile obj = _ZBigFile.__new__(_ZBigFile, blksize)
obj.zself = zself obj.zself = zself
# obj.foid = -1 # Note: zself._p_oid could be yet None for newly created ZBigFile # obj.foid = -1 # Note: zself._p_oid could be yet None for newly created ZBigFile
obj.wfileh = nil # opened by blkmmapper obj.wfileh = nil
return obj return obj
def __dealloc__(_ZBigFile zf): def __dealloc__(_ZBigFile zf):
...@@ -100,10 +106,12 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -100,10 +106,12 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# zf.foid = u64(zf.zself._p_oid) # zf.foid = u64(zf.zself._p_oid)
# join zconn to wconn; link to wconn from _ZBigFile # join zconn to wconn; link to wconn from _ZBigFile
pywconn = pywconnOf(zconn) pywconn = pywconnOf(zconn)
pywfileh = pywconn.open(zf.zself._p_oid) pywfileh = pywconn.open(zf.zself._p_oid)
zf.wfileh = pywfileh.wfileh zf.wfileh = pywfileh.wfileh
# return XXX
# functions that we give to virtmem bigfile_ops .mmap* # functions that we give to virtmem bigfile_ops .mmap*
cdef extern from * nogil: cdef extern from * nogil:
......
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