Commit 350acb30 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6235cb9c
......@@ -50,12 +50,15 @@ cdef extern from *:
ctypedef extern class wendelin.bigfile._bigfile.BigFile[object CXXPyBigFile]:
pass
from wcfs.internal cimport _wcfs as wcfs
from golang cimport nil
# helper for ZBigFile - just redirect loadblk/storeblk back
# (because it is not possible to inherit from both Persistent and BigFile at
# the same time - see below)
cdef class _ZBigFile(BigFile):
#cdef class _ZBigFile:
cdef object zself # reference to ZBigFile
cdef object zself # reference to ZBigFile
cdef wcfs.Conn wconn # WCFS connection XXX -> zconn instead ? XXX wconn is shared between files
# XXX Cython does not allow __new__ nor to change arguments passed to __cinit__ / __init__
@staticmethod
......@@ -64,6 +67,9 @@ cdef class _ZBigFile(BigFile):
obj.zself = zself
return obj
def __dealloc__(_ZBigFile zf):
zf.wconn = nil
# redirect load/store/mapper to main class
def loadblk(self, blk, buf): return self.zself.loadblk(blk, buf)
......
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2019 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
# cython: language_level=2
# distutils: language=c++
# XXX doc
from golang cimport chan, structZ, string, error, refptr
from golang cimport context
from libc.stdint cimport int64_t, uint64_t
from libcpp.utility cimport pair
from libcpp.vector cimport vector
# XXX -> pygolang
cdef extern from "wcfs_misc.h" namespace "io" nogil:
error EOF "io::EOF_"
error ErrUnexpectedEOF
cdef extern from "wcfs_misc.h" namespace "zodb" nogil:
ctypedef uint64_t Tid
ctypedef uint64_t Oid
cdef extern from "wcfs_misc.h" namespace "wcfs" nogil:
const Tid TidHead
cdef extern from "wcfs_watchlink.h" namespace "wcfs" nogil:
cppclass _WatchLink:
error close()
error closeWrite()
pair[string, error] sendReq(context.Context ctx, const string &req)
error recvReq(context.Context ctx, PinReq *prx)
error replyReq(context.Context ctx, const PinReq *req, const string& reply);
vector[string] fatalv
chan[structZ] rx_eof
cppclass WatchLink (refptr[_WatchLink]):
# WatchLink.X = WatchLink->X in C++
error close "_ptr()->close" ()
error closeWrite "_ptr()->closeWrite"()
pair[string, error] sendReq "_ptr()->sendReq" (context.Context ctx, const string &req)
error recvReq "_ptr()->recvReq" (context.Context ctx, PinReq *prx)
error replyReq "_ptr()->replyReq" (context.Context ctx, const PinReq *req, const string& reply);
vector[string] fatalv "_ptr()->fatalv"
chan[structZ] rx_eof "_ptr()->rx_eof"
cppclass PinReq:
Oid foid
int64_t blk
Tid at
string msg
error _twlinkwrite(WatchLink wlink, const string& pkt)
cdef extern from "wcfs.h" namespace "wcfs" nogil:
cppclass WCFS:
string mountpoint
pair[WatchLink, error] _openwatch()
pair[Conn, error] connect(Tid at)
cppclass _Conn:
pair[FileH, error] open(Oid foid)
error close()
cppclass Conn (refptr[_Conn]):
# Conn.X = Conn->X in C++
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
......@@ -27,89 +27,16 @@
# At functional level WCFS pinner is verified when running wendelin.core array
# tests in wcfs mode.
from golang cimport chan, structZ, string, error, refptr, pychan
from golang cimport context
from golang cimport pychan, nil
from golang import context as pycontext
from libcpp cimport nullptr_t, nullptr as nil
from libcpp.utility cimport pair
from libcpp.vector cimport vector
cdef extern from *:
ctypedef bint cbool "bool"
from libc.stdint cimport int64_t, uint64_t
from ZODB.utils import p64, u64
# XXX -> pygolang
cdef extern from "wcfs_misc.h" namespace "io" nogil:
error EOF "io::EOF_"
error ErrUnexpectedEOF
cdef extern from "wcfs_misc.h" namespace "zodb" nogil:
ctypedef uint64_t Tid
ctypedef uint64_t Oid
cdef extern from "wcfs_misc.h" namespace "wcfs" nogil:
const Tid TidHead
cdef extern from "wcfs_watchlink.h" namespace "wcfs" nogil:
cppclass _WatchLink:
error close()
error closeWrite()
pair[string, error] sendReq(context.Context ctx, const string &req)
error recvReq(context.Context ctx, PinReq *prx)
error replyReq(context.Context ctx, const PinReq *req, const string& reply);
vector[string] fatalv
chan[structZ] rx_eof
cppclass WatchLink (refptr[_WatchLink]):
# WatchLink.X = WatchLink->X in C++
error close "_ptr()->close" ()
error closeWrite "_ptr()->closeWrite"()
pair[string, error] sendReq "_ptr()->sendReq" (context.Context ctx, const string &req)
error recvReq "_ptr()->recvReq" (context.Context ctx, PinReq *prx)
error replyReq "_ptr()->replyReq" (context.Context ctx, const PinReq *req, const string& reply);
vector[string] fatalv "_ptr()->fatalv"
chan[structZ] rx_eof "_ptr()->rx_eof"
cppclass PinReq:
Oid foid
int64_t blk
Tid at
string msg
error _twlinkwrite(WatchLink wlink, const string& pkt)
cdef extern from "wcfs.h" namespace "wcfs" nogil:
cppclass WCFS:
string mountpoint
pair[WatchLink, error] _openwatch()
pair[Conn, error] connect(Tid at)
cppclass _Conn:
pair[FileH, error] open(Oid foid)
error close()
cppclass Conn (refptr[_Conn]):
# Conn.X = Conn->X in C++
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
# XXX hack, why it is needed? (likely top-level wendelin.* redirector
from wcfs.internal._wcfs cimport *
cdef class PyWCFS:
cdef WCFS wc
......
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