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
d5011053
Commit
d5011053
authored
Jul 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
09632ad8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
wcfs/__init__.py
wcfs/__init__.py
+21
-15
No files found.
wcfs/__init__.py
View file @
d5011053
...
...
@@ -90,16 +90,7 @@ class Conn(object):
# ._filemu threading.Lock
# ._filetab {} foid -> _File
def
__init__
(
wconn
,
wc
,
at
):
# XXX support !isolated mode
wconn
.
_wc
=
wc
wconn
.
at
=
at
wconn
.
_wlink
=
WatchLink
(
wc
)
wconn
.
_filemu
=
threading
.
Lock
()
wconn
.
_filetab
=
{}
# XXX wg.go(wconn._pinner, xxxctx)
pass
# _File represent isolated file view under Conn.
class
_File
(
object
):
...
...
@@ -124,7 +115,18 @@ class _Mapping(object):
# connect creates new Conn viewing WCFS state as of @at.
@
func
(
WCFS
)
def
connect
(
wc
,
at
):
# -> Conn
return
Conn
(
wc
,
at
)
wconn
=
Conn
()
# XXX support !isolated mode
wconn
.
_wc
=
wc
wconn
.
at
=
at
wconn
.
_wlink
=
WatchLink
(
wc
)
wconn
.
_filemu
=
threading
.
Lock
()
wconn
.
_filetab
=
{}
# XXX wg.go(wconn._pinner, xxxctx)
return
wconn
# close releases resources associated with wconn.
# XXX what happens to file mmappings?
...
...
@@ -171,14 +173,18 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
with
wconn
.
_filemu
:
f
=
wconn
.
_filetab
.
get
(
foid
)
if
f
is
None
:
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
=
_File
(
headf
)
f
=
_File
()
f
.
wconn
=
wconn
f
.
foid
=
foid
f
.
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
.
pinned
=
{}
f
.
mmaps
=
[]
wconn
.
_filetab
[
foid
]
=
f
# XXX relock wconn -> f ?
# create memory with head/f mapping and applied pins
mem
=
mm
.
m
m
ap_ro
(
f
.
headf
.
fileno
(),
offset
,
size
)
mem
=
mm
.
map_ro
(
f
.
headf
.
fileno
(),
offset
,
size
)
mmap
=
_Mapping
(
f
,
blk_start
,
mem
)
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
if
not
(
blk_start
<=
blk
<
blk_stop
):
...
...
@@ -205,7 +211,7 @@ def _remmapblk(mmap, blk, at):
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
mm
.
m
m
ap_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
blksize
)
mm
.
map_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
blksize
)
# remmap_blk remmaps file[blk] in its place again.
...
...
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