Commit 04dbd323 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 83ef7688
...@@ -951,11 +951,11 @@ static const struct bigfile_ops pybigfile_ops = { ...@@ -951,11 +951,11 @@ static const struct bigfile_ops pybigfile_ops = {
.loadblk = pybigfile_loadblk, .loadblk = pybigfile_loadblk,
.storeblk = pybigfile_storeblk, .storeblk = pybigfile_storeblk,
//.release =
.mmap_setup_read = pybigfile_mmap_setup_read, .mmap_setup_read = pybigfile_mmap_setup_read,
.remmap_blk_read = pybigfile_remmap_blk_read, .remmap_blk_read = pybigfile_remmap_blk_read,
.munmap = pybigfile_munmap, .munmap = pybigfile_munmap,
//.release =
}; };
......
...@@ -25,12 +25,15 @@ ...@@ -25,12 +25,15 @@
/* Package _bigfile provides Python bindings to virtmem. /* Package _bigfile provides Python bindings to virtmem.
* *
* - `BigFile` is base class that allows implementing BigFile backends in Python. * - `BigFile` is base class that allows implementing BigFile backends in Python.
* Users can inherit from BigFile, implement loadblk/storeblk/blkmmapper and XXX review * Users can inherit from BigFile, implement loadblk/storeblk and this way
* this way provide access to data managed from Python to virtmem subsystem. * provide access to data managed from Python to virtmem subsystem(*).
* - `BigFileH` represents virtmem file handle for opened BigFile. * - `BigFileH` represents virtmem file handle for opened BigFile.
* It can be mmap'ed and provides writeout control. * It can be mmap'ed and provides writeout control.
* - `VMA` represents mmap'ed part of a BigFileH. * - `VMA` represents mmap'ed part of a BigFileH.
* It provides buffer/memoryview interface for data access. * It provides buffer/memoryview interface for data access.
*
* (*) A subclass may additionally provide functionality to map file data into
* memory. Please see BigFile documentation for details.
*/ */
#include <Python.h> #include <Python.h>
...@@ -91,9 +94,11 @@ struct PyBigFileH { ...@@ -91,9 +94,11 @@ struct PyBigFileH {
BigFileH fileh; BigFileH fileh;
/* if subclass, in addition to .loadblk/.storeblk, defines .blkmmapper XXX ... */ #if 0
/* if BigFile subclass, in addition to .loadblk/.storeblk, defines .blkmmapper XXX ... */
PyObject *pymmapper; // python object returned by .blkmmapper() that is holding virtmem_mapper pycapsule PyObject *pymmapper; // python object returned by .blkmmapper() that is holding virtmem_mapper pycapsule
//virt_mapper *virt_mmap_ops; // XXX ok? //virt_mapper *virt_mmap_ops; // XXX ok?
#endif
}; };
typedef struct PyBigFileH PyBigFileH; typedef struct PyBigFileH PyBigFileH;
...@@ -101,8 +106,18 @@ typedef struct PyBigFileH PyBigFileH; ...@@ -101,8 +106,18 @@ typedef struct PyBigFileH PyBigFileH;
/* /*
* BigFile that can be implemented in python * BigFile that can be implemented in python
* *
* Allows subclasses to implement .loadblk() (& friends) in python. XXX blkmmapper doc * Allows subclasses to implement .loadblk() and .storeblk() in python.
* For users .fileh_open() is exposed to get to file handles. * For users .fileh_open() is exposed to get to file handles.
*
* A subclass may additionally provide functionality to map file data into
* memory: if subclass provides .blkmmapper attribute, it is treated as
* pycapsule with type "wendelin.bigfile.IBlkMMapper" and C-level bigfile_ops
* struct that provides .mmap_setup_read and other operations related to
* mmapping data. To avoid deadlocks all mmap-related functionality must be
* nogil and so cannot be implemented in Python.
*
* One example user of .blkmmapper functionality is _ZBigFile which uses WCFS
* and mmaps files from it to provide memory mappings for ZBigFile data.
*/ */
struct PyBigFile { struct PyBigFile {
PyObject pyobj; PyObject pyobj;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
// File file_zodb.cpp provides blkmmapper functions for _ZBigFile. // File file_zodb.cpp provides blkmmapper functions for _ZBigFile.
// MMapping is implemented via WCFS. // MMapping is implemented via wcfs client.
#include "wcfs/client/wcfs.h" #include "wcfs/client/wcfs.h"
#include "wendelin/bigfile/file.h" #include "wendelin/bigfile/file.h"
......
...@@ -28,8 +28,8 @@ wcfs.py/wcfs.go while running tox tests in wcfs mode. ...@@ -28,8 +28,8 @@ wcfs.py/wcfs.go while running tox tests in wcfs mode.
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import
from golang import func, defer from golang import func, defer
from wendelin.wcfs.wcfs_test import tDB, tAt from ..wcfs_test import tDB, tAt # XXX -> absolute
from wendelin.wcfs import wcfs_test from .. import wcfs_test # XXX -> absolute
# XXX so that e.g. testdb is set up + ... # XXX so that e.g. testdb is set up + ...
def setup_module(): wcfs_test.setup_module() def setup_module(): wcfs_test.setup_module()
......
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