Commit f8526f45 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c4013452
......@@ -40,6 +40,8 @@ struct IContext {
struct Conn;
struct _File;
struct WatchLink;
struct SrvReq;
// WCFS represents filesystem-level connection to wcfs server.
// XXX doc
......@@ -55,7 +57,7 @@ struct WCFS {
struct Conn {
WCFS *_wc;
Tid at;
// _wlink
WatchLink *_wlink;
sync::Mutex _filemu;
dict<Oid, _File*> _filetab; // {} foid -> _file
......@@ -63,6 +65,7 @@ struct Conn {
private:
void _pinner(IContext *ctx);
void _pin1(SrvReq *req);
};
// _File represent isolated file view under Conn.
......@@ -75,6 +78,19 @@ struct _File {
// XXX struct Mapping
// XXX struct WatchLink
struct WatchLink {
// XXX
SrvReq *recvReq(IContext *ctx);
};
// SrvReq represents 1 server-initiated wcfs request received over /head/watch link.
struct SrvReq {
// XXX
};
// connect creates new Conn viewing WCFS state as of @at.
Conn *WCFS::connect(Tid at) {
WCFS *wc = this;
......@@ -100,4 +116,24 @@ Conn *WCFS::connect(Tid at) {
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
void Conn::_pinner(IContext *ctx) {
Conn *wconn = this;
// XXX panic/exc -> log.CRITICAL
while (1) {
SrvReq *req = wconn->_wlink->recvReq(ctx);
if (req == NULL)
return // XXX ok? (EOF - when wcfs closes wlink)
// we received request to pin/unpin file block. handle it
wconn->_pin1(req);
// XXX free req?
}
}
// pin1 handles one pin request received from wcfs.
void Conn::_pin1(SrvReq *req) {
Conn *wconn = this;
// XXX
}
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