Commit eb1e1798 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4f8b5511
......@@ -33,7 +33,7 @@ using std::pair;
#include "wcfs_misc.h"
class _Conn;
struct _Conn;
class _WatchLink;
......
......@@ -66,8 +66,8 @@ struct PinReq;
// Use .resync to resync Conn onto different database view.
//
// Conn logically mirrors ZODB.Connection .
typedef refptr<class _Conn> Conn;
class _Conn {
typedef refptr<struct _Conn> Conn;
struct _Conn : object {
WCFS *_wc;
zodb::Tid at;
WatchLink _wlink; // watch/receive pins for created mappings
......@@ -75,7 +75,8 @@ class _Conn {
sync::Mutex _filemu;
dict<zodb::Oid, _File*> _filetab; // {} foid -> _file
// XXX ._pinWG, ._pinCancel
sync::WorkGroup _pinWG;
func<void()> _pinCancel;
// don't new - create via WCFS.connect
private:
......@@ -90,7 +91,7 @@ public:
error resync(zodb::Tid at);
private:
void _pinner(context::Context ctx);
error _pinner(context::Context ctx);
void _pin1(PinReq *req);
};
......@@ -148,17 +149,20 @@ tuple<Conn, error> WCFS::connect(zodb::Tid at) {
wconn->_wlink = wlink;
pinCtx, wconn._pinCancel = context.with_cancel(context.background())
wconn._pinWG = sync.WorkGroup(pinCtx)
wconn._pinWG.go(wconn._pinner)
context::Context pinCtx;
tie(pinCtx, wconn->_pinCancel) = context::with_cancel(context::background());
wconn->_pinWG = sync::NewWorkGroup(pinCtx);
wconn->_pinWG->go([wconn](context::Context ctx) -> error {
return wconn->_pinner(ctx);
});
return make_tuple(wconn, nil);
}
// close releases resources associated with wconn.
// XXX what happens to file mmappings?
error Conn::close() { // XXX error -> void?
Conn &wconn = *this;
error _Conn::close() { // XXX error -> void?
_Conn& wconn = *this;
wconn._wlink->close(); // XXX err
#if 0
......@@ -191,8 +195,8 @@ error Conn::close() { // XXX error -> void?
}
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
void Conn::_pinner(context::Context ctx) {
Conn &wconn = *this;
error _Conn::_pinner(context::Context ctx) { // XXX error -> where?
_Conn& wconn = *this;
// XXX panic/exc -> log.CRITICAL
......@@ -203,7 +207,7 @@ void Conn::_pinner(context::Context ctx) {
err = wconn._wlink->recvReq(ctx, &req);
if (err != nil) {
// XXX -> err, handle EOF, abort on *
return; // XXX ok? (EOF - when wcfs closes wlink)
return err; // XXX ok? (EOF - when wcfs closes wlink)
}
// we received request to pin/unpin file block. handle it
......@@ -212,8 +216,8 @@ void Conn::_pinner(context::Context ctx) {
}
// pin1 handles one pin request received from wcfs.
void Conn::_pin1(PinReq *req) {
Conn &wconn = *this;
void _Conn::_pin1(PinReq *req) {
_Conn& wconn = *this;
// XXX defer: reply either ack or nak on error
// XXX return error?
......@@ -264,8 +268,8 @@ void Conn::_pin1(PinReq *req) {
// XXX Conn::mmap
// resync resyncs connection and its mappings onto different database view.
error Conn::resync(zodb::Tid at) {
Conn &wconn = *this;
error _Conn::resync(zodb::Tid at) {
_Conn& wconn = *this;
// XXX err ctx
// XXX locking
......
......@@ -19,7 +19,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
"""wcfs_test tests wcfs filesystem from outside as python client process
It also unit-tests wcfs.py virtmem-level integration.
It also unit-tests wcfs.py virtmem-level integration. XXX
At functional level, the whole wendelin.core test suite is used to verify
wcfs.py/wcfs.go while running tox tests in wcfs mode.
......
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