Commit 83ef7688 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e48a8eaf
......@@ -263,8 +263,6 @@ def _tpywlinkwrite(PyWatchLink pywlink, bytes pypkt):
# pyerr converts error into python error.
cdef object pyerr(error err):
if err == nil:
return None
return pyerror.from_error(err)
......
......@@ -79,7 +79,7 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset);
// connect creates new Conn viewing WCFS state as of @at.
pair<Conn, error> WCFS::connect(zodb::Tid at) {
WCFS *wc = this;
xerr::Contextf E("connect @%s", v(at)); // XXX +wc path?
xerr::Contextf E("wcfs %s: connect @%s", v(wc->mountpoint), v(at));
// TODO support !isolated mode
......@@ -112,7 +112,6 @@ static global<error> errConnClosed = errors::New("connection closed");
// opened fileh and mappings becomes invalid to use except close and unmap.
error _Conn::close() {
_Conn& wconn = *this;
//xerr::Contextf E("close conn @%s", v(wconn.at));
xerr::Contextf E("wcfs %s: close conn @%s", v(wconn._wc->mountpoint), v(wconn.at));
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
......@@ -296,7 +295,7 @@ error _Conn::__pin1(PinReq *req) {
pair<FileH, error> _Conn::open(zodb::Oid foid) {
_Conn& wconn = *this;
error err;
xerr::Contextf E("conn @%s: open f<%s>", v(wconn.at), v(foid));
xerr::Contextf E("wcfs %s: conn @%s: open f<%s>", v(wconn._wc->mountpoint), v(wconn.at), v(foid));
wconn._filehmu.lock();
defer([&]() {
......@@ -354,7 +353,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
error _FileH::close() {
_FileH& fileh = *this;
Conn wconn = fileh.wconn;
xerr::Contextf E("conn @%s: close f<%s>", v(wconn->at), v(fileh.foid)); // XXX + wcfs path?
xerr::Contextf E("wcfs %s: conn @%s: close f<%s>", v(wconn->_wc->mountpoint), v(wconn->at), v(fileh.foid));
// remove fileh from wconn._filehtab
// fileh.close can be called several times and after first call another
......@@ -373,8 +372,8 @@ error _FileH::close() {
// If vma != nil, created mapping is associated with that vma of user-space virtual memory manager.
pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma) {
_FileH& f = *this;
xerr::Contextf E("conn @%s: mmap f<%s> [blk%ld +blk%ld)",
v(f.wconn->at), v(f.foid), blk_start, blk_len); // XXX +wcfs path?
xerr::Contextf E("wcfs %s: conn @%s: mmap f<%s> [blk%ld +blk%ld)",
v(f.wconn->_wc->mountpoint), v(f.wconn->at), v(f.foid), blk_start, blk_len);
// XXX (blk_start + blk_len) * blk_size overflow
error err;
......@@ -432,7 +431,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
// resync resyncs connection and its mappings onto different database view.
error _Conn::resync(zodb::Tid at) {
_Conn& wconn = *this;
xerr::Contextf E("conn @%s: resync -> @%s", v(wconn.at), v(at)); // XXX +wcfs path?
xerr::Contextf E("wcfs %s: conn @%s: resync -> @%s", v(wconn._wc->mountpoint), v(wconn.at), v(at));
// XXX locking
error err;
......@@ -500,13 +499,13 @@ error _Conn::resync(zodb::Tid at) {
// at=TidHead means unpin to head/ .
// NOTE this does not check whether virtmem already mapped blk as RW.
error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) {
// XXX err context? blk #<blk> @<at>
_Mapping *mmap = this;
xerr::Contextf E("conn @%s: f<%s>: remmapblk #%ld @%s",
v(mmap->fileh->wconn->at), v(mmap->fileh->foid), blk, v(at)); // XXX +wcfs path?
FileH f = mmap->fileh;
xerr::Contextf E("wcfs %s: conn @%s: f<%s>: remmapblk #%ld @%s",
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid), blk, v(at));
ASSERT(mmap->blk_start <= blk && blk < mmap->blk_stop());
FileH f = mmap->fileh;
error err;
uint8_t *blkmem = mmap->mem_start + (blk - mmap->blk_start)*f->blksize;
......
......@@ -42,14 +42,14 @@
// ─── ───── ────────────────────────── ───── /head/bigfile/X
//
// where @revR mmaps are being dynamically added/removed by this client package
// to maintain X@at data view according to WCFS invalidation protocol(*).
// to maintain X@at data view according to WCFS isolation protocol(*).
//
//
// Integration with wendelin.core virtmem layer
//
// This client package can be used standalone, but additionally provides
// integration with wendelin.core userspace virtual memory manager: when a
// Mapping is created it can be associated as serving base layer for a
// Mapping is created, it can be associated as serving base layer for a
// particular virtmem VMA via FileH.mmap(vma=...). In that case, since virtmem
// itself adds another layer of dirty pages over read-only base provided by
// Mapping(+)
......@@ -67,7 +67,7 @@
// ─── ───── ────────────────────────── ───── /head/bigfile/X
//
// the Mapping will interact with virtmem layer to coordinate
// mapping memory updates.
// updates to mapping virtual memory.
//
//
// API overview
......@@ -99,18 +99,9 @@
#include <golang/libgolang.h>
#include <golang/cxx.h>
#include <golang/sync.h>
using namespace golang;
using cxx::dict;
using cxx::set;
#include <string>
using std::string;
#include <tuple>
using std::tuple;
#include <utility>
using std::pair;
#include "wcfs_misc.h"
#include <wendelin/bug.h>
......@@ -124,6 +115,13 @@ struct VMA;
// wcfs::
namespace wcfs {
using namespace golang;
using cxx::dict;
using cxx::set;
using std::tuple;
using std::pair;
typedef refptr<struct _Conn> Conn;
typedef refptr<struct _Mapping> Mapping;
typedef refptr<struct _FileH> FileH;
......@@ -176,8 +174,8 @@ struct _Conn : object {
sync::Mutex _filehmu;
dict<zodb::Oid, FileH> _filehtab; // {} foid -> fileh
sync::WorkGroup _pinWG;
func<void()> _pinCancel;
sync::WorkGroup _pinWG; // pin/unpin messages from wcfs are served by _pinner
func<void()> _pinCancel; // spawned under _pinWG.
// don't new - create via WCFS.connect
private:
......@@ -203,7 +201,7 @@ private:
//
// The file view is maintained to be as of @Conn.at database state even in the
// presence of simultaneous database changes. The file view uses
// /head/<file>/data primarily and @revX/<file>/data pin overrides.
// /head/<file>/data primarily and /@revX/<file>/data pin overrides.
//
// Use .mmap to map file view into memory.
typedef refptr<struct _FileH> FileH;
......@@ -231,6 +229,8 @@ public:
};
// Mapping represents one memory mapping of FileH.
//
// The mapped memory is [.mem_start, .mem_stop)
typedef refptr<struct _Mapping> Mapping;
struct _Mapping : object {
FileH fileh;
......
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