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
b2efc471
Commit
b2efc471
authored
Jul 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e9c16aec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
36 deletions
+33
-36
wcfs/__init__.py
wcfs/__init__.py
+33
-36
No files found.
wcfs/__init__.py
View file @
b2efc471
...
...
@@ -243,42 +243,6 @@ def _pin1(wconn, req):
f
.
pinned
[
req
.
blk
]
=
req
.
at
# resync resyncs connection onto different database view.
# XXX place=?
@
func
(
Conn
)
def
resync
(
wconn
,
at
):
# XXX locking
for
foid
,
f
in
wconn
.
_filetab
.
items
():
# XXX if file has no mappings and was not used during whole prev
# cycle - forget and stop watching it
# update f.headfsize and remmap to head/f zero regions that are now covered by head/f
_
=
os
.
fstat
(
f
.
headf
.
fileno
())
assert
f
.
blksize
==
_
.
st_blksize
# blksize must not change
headfsize
=
_
.
st_size
assert
f
.
headfsize
<=
headfsize
# head/file size ↑=
assert
headfsize
%
f
.
blksize
==
0
for
mmap
in
f
.
mmaps
:
print
(
' resync -> %s: unzero [%d:%d)'
%
(
at
,
f
.
headfsize
//
f
.
blksize
,
headfsize
//
f
.
blksize
))
memunzero
=
mmap
.
mem
[
f
.
headfsize
-
mmap
.
blk_start
*
f
.
blksize
:
headfsize
-
mmap
.
blk_start
*
f
.
blksize
]
if
len
(
memunzero
)
>
0
:
mm
.
map_into_ro
(
memunzero
,
f
.
headf
.
fileno
(),
f
.
headfsize
)
f
.
headfsize
=
headfsize
_
=
wconn
.
_wlink
.
sendReq
(
context
.
background
(),
b"watch %s @%s"
%
(
h
(
foid
),
h
(
at
)))
if
_
!=
"ok"
:
# XXX unregister f from _filetab
# XXX vvv -> errctx?
raise
RuntimeError
(
"resync @%s -> @%s: f<%s>: %s"
%
(
h
(
wconn
.
at
),
h
(
at
),
h
(
foid
),
_
))
wconn
.
at
=
at
# mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
@
func
(
Conn
)
def
mmap
(
wconn
,
foid
,
blk_start
,
blk_len
):
# -> Mapping
...
...
@@ -330,6 +294,39 @@ def mmap(wconn, foid, blk_start, blk_len): # -> Mapping
return
mmap
# resync resyncs connection and its mappings onto different database view.
@
func
(
Conn
)
def
resync
(
wconn
,
at
):
# XXX locking
for
foid
,
f
in
wconn
.
_filetab
.
items
():
# XXX if file has no mappings and was not used during whole prev
# cycle - forget and stop watching it
# update f.headfsize and remmap to head/f zero regions that are now covered by head/f
_
=
os
.
fstat
(
f
.
headf
.
fileno
())
assert
f
.
blksize
==
_
.
st_blksize
# blksize must not change
headfsize
=
_
.
st_size
assert
f
.
headfsize
<=
headfsize
# head/file size ↑=
assert
headfsize
%
f
.
blksize
==
0
for
mmap
in
f
.
mmaps
:
print
(
' resync -> %s: unzero [%d:%d)'
%
(
at
,
f
.
headfsize
//
f
.
blksize
,
headfsize
//
f
.
blksize
))
memunzero
=
mmap
.
mem
[
f
.
headfsize
-
mmap
.
blk_start
*
f
.
blksize
:
headfsize
-
mmap
.
blk_start
*
f
.
blksize
]
if
len
(
memunzero
)
>
0
:
mm
.
map_into_ro
(
memunzero
,
f
.
headf
.
fileno
(),
f
.
headfsize
)
f
.
headfsize
=
headfsize
_
=
wconn
.
_wlink
.
sendReq
(
context
.
background
(),
b"watch %s @%s"
%
(
h
(
foid
),
h
(
at
)))
if
_
!=
"ok"
:
# XXX unregister f from _filetab
# XXX vvv -> errctx?
raise
RuntimeError
(
"resync @%s -> @%s: f<%s>: %s"
%
(
h
(
wconn
.
at
),
h
(
at
),
h
(
foid
),
_
))
wconn
.
at
=
at
# _remmapblk remmaps mapping memory for file[blk] to be viewing database as of @at state.
#
...
...
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