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
7cbb1b4a
Commit
7cbb1b4a
authored
Dec 04, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e7eb277f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
51 deletions
+0
-51
wcfs/__init__.py
wcfs/__init__.py
+0
-51
No files found.
wcfs/__init__.py
View file @
7cbb1b4a
...
...
@@ -88,57 +88,6 @@ class WCFS(_WCFS):
pass
"""
# 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
assert blk_len >= 0
blk_stop = blk_start + blk_len
with wconn._filemu:
f = wconn._filetab.get(foid)
if f is None:
f = _File()
f.wconn = wconn
f.foid = foid
f.headf = wconn._wc._open("head/bigfile/%s" % (h(foid),), "rb")
f.pinned = {}
f.mmaps = []
_ = os.fstat(f.headf.fileno())
f.blksize = _.st_blksize
f.headfsize = _.st_size
assert f.headfsize % f.blksize == 0
wconn._filetab[foid] = f
# start watching f
_ = wconn._wlink.sendReq(context.background(), b"watch %s @%s" % (h(foid), h(wconn.at)))
if _ != "ok":
# XXX unregister f from _filetab
# XXX vvv -> errctx?
raise RuntimeError("@%s: mmap f<%s>[%d +%d): %s" % (h(wconn.at), h(foid), blk_start, blk_len, _))
# XXX relock wconn -> f ?
# create memory with head/f mapping and applied pins
# mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
start = blk_start*f.blksize
mem = mm.map_ro(f.headf.fileno(), start, blk_len*f.blksize)
zmemtail = mem[max(f.headfsize, start) - start:]
if len(zmemtail) != 0:
mm.map_zero_into_ro(zmemtail)
mmap = _Mapping()
mmap.file = f
mmap.blk_start = blk_start
mmap.mem = mem
for blk, rev in f.pinned.items(): # XXX keep f.pinned ↑blk and use binary search?
if not (blk_start <= blk < blk_stop):
continue # blk out of this mapping
mmap._remmapblk(blk, rev)
f.mmaps.append(mmap) # XXX keep f.mmaps ↑blk_start
return mmap
# resync resyncs connection and its mappings onto different database view.
@func(Conn)
def resync(wconn, at):
...
...
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