Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
049b11af
Commit
049b11af
authored
Nov 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
edbe92f7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
31 deletions
+40
-31
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+24
-0
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+6
-21
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+2
-2
wcfs/internal/wcfs_watchlink.cpp
wcfs/internal/wcfs_watchlink.cpp
+4
-4
wcfs/internal/wcfs_watchlink.h
wcfs/internal/wcfs_watchlink.h
+4
-4
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
049b11af
...
...
@@ -230,6 +230,30 @@ vector<string> split(const string &s, char sep) {
}
// strings::
// context::
namespace
context
{
const
error
canceled
=
fmt
::
errorf
(
"context canceled"
);
const
error
deadlineExceeded
=
fmt
::
errorf
(
"deadline exceeded"
);
struct
_Background
:
Context
{
chan
<
structZ
>
done
()
{
return
nil
;
}
error
err
()
{
return
nil
;
}
};
static
_Background
_bg
;
Context
*
background
()
{
return
&
_bg
;
// NOTE nil is not valid in C++ (IContext* also carries vtab ptr)
}
}
// context::
// xstrconv:: (strconv-like)
namespace
xstrconv
{
...
...
wcfs/internal/wcfs_misc.h
View file @
049b11af
...
...
@@ -163,35 +163,20 @@ vector<string> split(const string &s, char sep);
}
// strings::
// XXX ok?
struct
IContext
{
virtual
chan
<
structZ
>
done
()
=
0
;
virtual
error
err
()
=
0
;
};
// context::
namespace
context
{
struct
_Background
:
IContext
{
chan
<
structZ
>
done
()
{
return
nil
;
}
error
err
()
{
return
nil
;
}
struct
Context
{
virtual
chan
<
structZ
>
done
()
=
0
;
virtual
error
err
()
=
0
;
};
static
_Background
_bg
;
// XXX doc
IContext
*
background
()
{
return
&
_bg
;
// NOTE nil is not valid in C++ (IContext* also carries vtab ptr)
}
Context
*
background
();
// XXX doc
const
error
canceled
=
fmt
::
errorf
(
"context canceled"
)
;
// XXX deadline exceeded?
extern
const
error
canceled
;
extern
const
error
deadlineExceeded
;
}
// context::
...
...
wcfs/internal/wcfs_virtmem.cpp
View file @
049b11af
...
...
@@ -71,7 +71,7 @@ public:
error
resync
(
zodb
::
Tid
at
);
private:
void
_pinner
(
I
Context
*
ctx
);
void
_pinner
(
context
::
Context
*
ctx
);
void
_pin1
(
PinReq
*
req
);
};
...
...
@@ -172,7 +172,7 @@ error Conn::close() { // XXX error -> void?
}
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
void
Conn
::
_pinner
(
I
Context
*
ctx
)
{
void
Conn
::
_pinner
(
context
::
Context
*
ctx
)
{
Conn
&
wconn
=
*
this
;
// XXX panic/exc -> log.CRITICAL
...
...
wcfs/internal/wcfs_watchlink.cpp
View file @
049b11af
...
...
@@ -97,7 +97,7 @@ error WatchLink::close() {
}
// _serveRX receives messages from ._f and dispatches them according to streamID.
error
WatchLink
::
_serveRX
(
I
Context
*
ctx
)
{
// XXX error -> where ?
error
WatchLink
::
_serveRX
(
context
::
Context
*
ctx
)
{
// XXX error -> where ?
WatchLink
&
wlink
=
*
this
;
// when finishing - wakeup everyone waiting for rx
...
...
@@ -209,7 +209,7 @@ error WatchLink::_write(const string &pkt) {
// sendReq sends client -> server request and returns server reply.
// XXX -> reply | None when EOF
tuple
<
string
,
error
>
WatchLink
::
sendReq
(
I
Context
*
ctx
,
const
string
&
req
)
{
tuple
<
string
,
error
>
WatchLink
::
sendReq
(
context
::
Context
*
ctx
,
const
string
&
req
)
{
WatchLink
*
wlink
=
this
;
// XXX err ctx
...
...
@@ -231,7 +231,7 @@ tuple<string, error> WatchLink::sendReq(IContext *ctx, const string &req) {
return
make_tuple
(
reply
,
nil
);
}
tuple
<
/*rxq*/
chan
<
rxPkt
>
,
error
>
WatchLink
::
_sendReq
(
I
Context
*
ctx
,
const
string
&
req
)
{
tuple
<
/*rxq*/
chan
<
rxPkt
>
,
error
>
WatchLink
::
_sendReq
(
context
::
Context
*
ctx
,
const
string
&
req
)
{
WatchLink
*
wlink
=
this
;
// XXX err ctx?
...
...
@@ -269,7 +269,7 @@ tuple</*rxq*/chan<rxPkt>, error> WatchLink::_sendReq(IContext *ctx, const string
// recvReq receives client <- server request.
static
error
_parsePinReq
(
PinReq
*
pin
,
const
rxPkt
*
pkt
);
error
WatchLink
::
recvReq
(
I
Context
*
ctx
,
PinReq
*
prx
)
{
error
WatchLink
::
recvReq
(
context
::
Context
*
ctx
,
PinReq
*
prx
)
{
WatchLink
&
wlink
=
*
this
;
// XXX err ctx?
...
...
wcfs/internal/wcfs_watchlink.h
View file @
049b11af
...
...
@@ -87,16 +87,16 @@ class WatchLink {
public:
friend
tuple
<
WatchLink
*
,
error
>
WCFS
::
_openwatch
();
error
close
();
error
recvReq
(
I
Context
*
ctx
,
PinReq
*
rx_into
);
tuple
<
string
,
error
>
sendReq
(
I
Context
*
ctx
,
const
string
&
req
);
error
recvReq
(
context
::
Context
*
ctx
,
PinReq
*
rx_into
);
tuple
<
string
,
error
>
sendReq
(
context
::
Context
*
ctx
,
const
string
&
req
);
private:
void
_closeTX
();
error
_serveRX
(
I
Context
*
ctx
);
error
_serveRX
(
context
::
Context
*
ctx
);
tuple
<
string
,
error
>
_readline
();
error
_send
(
StreamID
stream
,
const
string
&
msg
);
error
_write
(
const
string
&
pkt
);
tuple
<
chan
<
rxPkt
>
,
error
>
_sendReq
(
I
Context
*
ctx
,
const
string
&
req
);
tuple
<
chan
<
rxPkt
>
,
error
>
_sendReq
(
context
::
Context
*
ctx
,
const
string
&
req
);
};
// PinReq represents 1 server-initiated wcfs pin request received over /head/watch link.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment