Commit 769b8f4c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fdc76cf4
......@@ -115,6 +115,7 @@ def _deactivate_bucket(bucket):
# zconn_at returns tid as of which ZODB connection is viewing the database.
def zconn_at(zconn): # -> tid
assert isinstance(zconn, ZODB.Connection.Connection)
# XXX assert zconn is opened
# ZODB5 uses MVCC uniformly
if zmajor >= 5:
......
......@@ -93,11 +93,22 @@ cdef extern from "wcfs.h" namespace "wcfs" nogil:
pair[Conn, error] connect(Tid at)
cppclass _Conn:
error close()
pair[FileH, error] open(Oid foid)
error close()
cppclass Conn (refptr[_Conn]):
# Conn.X = Conn->X in C++
error close "_ptr()->close" ()
pair[FileH, error] open "_ptr()->open" (Oid foid)
error close "_ptr()->close" ()
cppclass _FileH:
# XXX add mmap?
pass
cppclass FileH (refptr[_FileH]):
# FileH.X = FileH->X in C++
# XXX add mmap?
pass
cdef class PyWCFS:
......@@ -132,12 +143,32 @@ cdef class PyConn:
def close(PyConn pywconn):
with nogil:
err = pywconn.wconn.close()
err = wconn_close_pyexc(pywconn.wconn)
if err != nil:
raise pyerr(err)
def open(PyConn pywconn, pyfoid): # -> FileH
cdef Oid foid = u64(pyfoid)
with nogil:
_ = wconn_open_pyexc(pywconn.wconn, foid)
wfileh = _.first
err = _.second
if err != nil:
raise pyerr(err)
cdef PyFileH pywfileh = PyFileH.__new__(PyFileH)
pywfileh.wfileh = wfileh
return pywfileh
# XXX resync
cdef class PyFileH:
cdef FileH wfileh
def __dealloc__(PyFileH pywfileh):
pywfileh.wfileh = nil
# ----------------------------------------
cdef class PyWatchLink:
cdef WatchLink wlink
......@@ -267,6 +298,12 @@ cdef nogil:
pair[Conn, error] wcfs_connect_pyexc(WCFS *wcfs, Tid at) except +topyexc:
return wcfs.connect(at)
error wconn_close_pyexc(Conn wconn) except +topyexc:
return wconn.close()
pair[FileH, error] wconn_open_pyexc(Conn wconn, Oid foid) except +topyexc:
return wconn.open(foid)
error wlink_close_pyexc(WatchLink wlink) except +topyexc:
return wlink.close()
......
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