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
1115e0ff
Commit
1115e0ff
authored
Mar 05, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2c2a094f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
40 deletions
+37
-40
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+37
-40
No files found.
wcfs/client/wcfs.cpp
View file @
1115e0ff
...
...
@@ -205,48 +205,8 @@ static error mmap_efault_into(void *addr, size_t size);
static
tuple
<
uint8_t
*
,
error
>
mmap_ro
(
os
::
File
f
,
off_t
offset
,
size_t
size
);
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
(
"%s: connect @%s"
,
v
(
wc
),
v
(
at
));
etrace
(
""
);
error
err
;
// TODO support !isolated mode
// need to wait till `wcfs/head/at ≥ at` because e.g. Conn.open stats
// head/f to get f.headfsize.
err
=
wc
->
_headWait
(
at
);
if
(
err
!=
nil
)
{
return
make_pair
(
nil
,
E
(
err
));
}
WatchLink
wlink
;
tie
(
wlink
,
err
)
=
wc
->
_openwatch
();
if
(
err
!=
nil
)
return
make_pair
(
nil
,
E
(
err
));
Conn
wconn
=
adoptref
(
new
_Conn
());
wconn
->
_wc
=
wc
;
wconn
->
at
=
at
;
wconn
->
_wlink
=
wlink
;
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_pair
(
wconn
,
nil
);
}
// _headWait waits till wcfs/head/at becomes ≥ at.
//
// XXX place?
//
// _headWait is currently needed, because client stats wcfs/head/f to get f
// size assuming that f size only ↑. The assumption is not generally valid
// (e.g. f might be truncated = hole puched for block at tail), but holds true
...
...
@@ -288,6 +248,43 @@ error WCFS::_headWait(zodb::Tid at) {
return
nil
;
}
// connect creates new Conn viewing WCFS state as of @at.
pair
<
Conn
,
error
>
WCFS
::
connect
(
zodb
::
Tid
at
)
{
WCFS
*
wc
=
this
;
xerr
::
Contextf
E
(
"%s: connect @%s"
,
v
(
wc
),
v
(
at
));
etrace
(
""
);
error
err
;
// TODO support !isolated mode
// need to wait till `wcfs/head/at ≥ at` because e.g. Conn.open stats
// head/f to get f.headfsize.
err
=
wc
->
_headWait
(
at
);
if
(
err
!=
nil
)
{
return
make_pair
(
nil
,
E
(
err
));
}
WatchLink
wlink
;
tie
(
wlink
,
err
)
=
wc
->
_openwatch
();
if
(
err
!=
nil
)
return
make_pair
(
nil
,
E
(
err
));
Conn
wconn
=
adoptref
(
new
_Conn
());
wconn
->
_wc
=
wc
;
wconn
->
at
=
at
;
wconn
->
_wlink
=
wlink
;
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_pair
(
wconn
,
nil
);
}
static
global
<
error
>
errConnClosed
=
errors
::
New
(
"connection closed"
);
// close releases resources associated with wconn.
...
...
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