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):
...
@@ -90,16 +90,7 @@ class Conn(object):
# ._filemu threading.Lock
# ._filemu threading.Lock
# ._filetab {} foid -> _File
# ._filetab {} foid -> _File
pass
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)
# _File represent isolated file view under Conn.
# _File represent isolated file view under Conn.
class
_File
(
object
):
class
_File
(
object
):
...
@@ -124,7 +115,18 @@ class _Mapping(object):
...
@@ -124,7 +115,18 @@ class _Mapping(object):
# connect creates new Conn viewing WCFS state as of @at.
# connect creates new Conn viewing WCFS state as of @at.
@
func
(
WCFS
)
@
func
(
WCFS
)
def
connect
(
wc
,
at
):
# -> Conn
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.
# close releases resources associated with wconn.
# XXX what happens to file mmappings?
# XXX what happens to file mmappings?
...
@@ -171,14 +173,18 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
...
@@ -171,14 +173,18 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
with
wconn
.
_filemu
:
with
wconn
.
_filemu
:
f
=
wconn
.
_filetab
.
get
(
foid
)
f
=
wconn
.
_filetab
.
get
(
foid
)
if
f
is
None
:
if
f
is
None
:
headf
=
wconn
.
_wc
.
_open
(
"head/bigfile/%s"
%
(
ashex
(
foid
),),
"rb"
)
f
=
_File
()
f
=
_File
(
headf
)
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
wconn
.
_filetab
[
foid
]
=
f
# XXX relock wconn -> f ?
# XXX relock wconn -> f ?
# create memory with head/f mapping and applied pins
# 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
)
mmap
=
_Mapping
(
f
,
blk_start
,
mem
)
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
if
not
(
blk_start
<=
blk
<
blk_stop
):
if
not
(
blk_start
<=
blk
<
blk_stop
):
...
@@ -205,7 +211,7 @@ def _remmapblk(mmap, blk, at):
...
@@ -205,7 +211,7 @@ def _remmapblk(mmap, blk, at):
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
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.
# 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