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
effad023
Commit
effad023
authored
Jul 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
93b8fbed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
wcfs/__init__.py
wcfs/__init__.py
+23
-3
No files found.
wcfs/__init__.py
View file @
effad023
...
@@ -82,7 +82,9 @@ class WCFS(object):
...
@@ -82,7 +82,9 @@ class WCFS(object):
# maintain isolated database view while at the same time sharing most of data
# maintain isolated database view while at the same time sharing most of data
# cache in OS pagecache of /head/bigfile/*.
# cache in OS pagecache of /head/bigfile/*.
#
#
# Use WCFS.connect(at) to create Conn.
# Use .mmap to create new Mappings.
# Use .mmap to create new Mappings.
# Use .resync to resync Conn onto different database view.
#
#
# Conn logically mirrors ZODB.Connection .
# Conn logically mirrors ZODB.Connection .
class
Conn
(
object
):
class
Conn
(
object
):
...
@@ -163,7 +165,6 @@ def close(wconn):
...
@@ -163,7 +165,6 @@ def close(wconn):
wconn
.
_filetab
=
None
wconn
.
_filetab
=
None
# _pinner receives pin messages from wcfs and adjusts wconn mappings.
# _pinner receives pin messages from wcfs and adjusts wconn mappings.
#
#
# XXX must be running without GIL: access to wcfs mmaped memory could come from
# XXX must be running without GIL: access to wcfs mmaped memory could come from
...
@@ -227,7 +228,7 @@ def _pin1(wconn, req):
...
@@ -227,7 +228,7 @@ def _pin1(wconn, req):
if
not
(
mmap
.
blk_start
<=
req
.
blk
<
mmap
.
blk_stop
):
if
not
(
mmap
.
blk_start
<=
req
.
blk
<
mmap
.
blk_stop
):
continue
# blk ∉ mmap
continue
# blk ∉ mmap
trace
(
'
\
t
remmapblk %d @%s'
%
(
req
.
blk
,
h
(
req
.
at
)))
trace
(
'
\
t
remmapblk %d @%s'
%
(
req
.
blk
,
(
h
(
req
.
at
)
if
req
.
at
else
"head"
)))
# FIXME check if virtmem did not mapped RW page into this block already
# FIXME check if virtmem did not mapped RW page into this block already
mmap
.
_remmapblk
(
req
.
blk
,
req
.
at
)
mmap
.
_remmapblk
(
req
.
blk
,
req
.
at
)
trace
(
'
\
t
-> remmaped'
)
trace
(
'
\
t
-> remmaped'
)
...
@@ -239,6 +240,25 @@ def _pin1(wconn, req):
...
@@ -239,6 +240,25 @@ def _pin1(wconn, req):
f
.
pinned
[
req
.
blk
]
=
req
.
at
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
in
wconn
.
_filetab
:
# XXX if file was has no mappings and was not used during whole prev
# cycle - forget and stop watching it
_
=
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.
# mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
@
func
(
Conn
)
@
func
(
Conn
)
def
mmap
(
wconn
,
foid
,
blk_start
,
blk_len
):
# -> Mapping
def
mmap
(
wconn
,
foid
,
blk_start
,
blk_len
):
# -> Mapping
...
@@ -261,7 +281,7 @@ def mmap(wconn, foid, blk_start, blk_len): # -> Mapping
...
@@ -261,7 +281,7 @@ def mmap(wconn, foid, blk_start, blk_len): # -> Mapping
if
_
!=
"ok"
:
if
_
!=
"ok"
:
# XXX unregister f from _filetab
# XXX unregister f from _filetab
# XXX vvv -> errctx?
# XXX vvv -> errctx?
raise
RuntimeError
(
"
mmap f<%s>[%d +%d): %s"
%
(
h
(
foid
),
blk_start
,
blk_len
,
_
))
raise
RuntimeError
(
"
@%s: mmap f<%s>[%d +%d): %s"
%
(
h
(
wconn
.
at
),
h
(
foid
),
blk_start
,
blk_len
,
_
))
# XXX relock wconn -> f ?
# XXX relock wconn -> f ?
...
...
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