Commit 44a59d27 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 95fcfdaf
...@@ -48,6 +48,8 @@ from ZODB.FileStorage import FileStorage ...@@ -48,6 +48,8 @@ from ZODB.FileStorage import FileStorage
from ZODB.utils import z64, u64, p64 from ZODB.utils import z64, u64, p64
from zodbtools.util import ashex, fromhex from zodbtools.util import ashex, fromhex
from .internal import mm
from six import reraise from six import reraise
...@@ -142,7 +144,7 @@ def _pinner(wconn, ctx): ...@@ -142,7 +144,7 @@ def _pinner(wconn, ctx):
# XXX relock wconn -> f ? # XXX relock wconn -> f ?
for mmap in f.mmaps: # XXX use ↑blk_start for binary search for mmap in f.mmaps: # XXX use ↑blk_start for binary search
if not (mmap.blk_start <= req.blk && req.blk < mmap.blk_stop): if not (mmap.blk_start <= req.blk < mmap.blk_stop):
continue # blk ∉ mmap continue # blk ∉ mmap
# 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
...@@ -162,7 +164,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko ...@@ -162,7 +164,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
f = wconn._filetab.get(foid) f = wconn._filetab.get(foid)
if f is None: if f is None:
headf = wconn._wc._open("head/%s" % (ashex(foid),), "rb") headf = wconn._wc._open("head/%s" % (ashex(foid),), "rb")
f = File(headf) f = _File(headf)
wconn._filetab[foid] = f wconn._filetab[foid] = f
# XXX relock wconn -> f ? # XXX relock wconn -> f ?
...@@ -171,7 +173,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko ...@@ -171,7 +173,7 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
mem = mm.mmap_ro(f.headf.fileno(), offset, size) mem = mm.mmap_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 < blk_stop): if not (blk_start <= blk < blk_stop):
continue # blk out of this mapping continue # blk out of this mapping
mmap._remmapblk(blk, rev) mmap._remmapblk(blk, rev)
...@@ -210,7 +212,7 @@ def remmap_blk(mmap, blk): ...@@ -210,7 +212,7 @@ def remmap_blk(mmap, blk):
# unmap is removes mapping memory from address space. # unmap is removes mapping memory from address space.
# virtmem calls this when VMA is unmapped. # virtmem calls this when VMA is unmapped.
@func(_Mapping): @func(_Mapping)
def unmap(mmap): def unmap(mmap):
# XXX locking # XXX locking
mm.unmap(mmap.mem) mm.unmap(mmap.mem)
......
...@@ -17,7 +17,13 @@ ...@@ -17,7 +17,13 @@
# #
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""wcfs_test tests wcfs filesystem from outside as python client process""" """wcfs_test tests wcfs filesystem from outside as python client process
It also unit-tests wcfs.py virtmem-level infrastructure.
At functional level, the whole wendelin.core test suite is used to verify
wcfs.py/wcfs.go while running tox tests in wcfs mode.
"""
from __future__ import print_function, absolute_import from __future__ import print_function, absolute_import
...@@ -1677,6 +1683,17 @@ def test_wcfs_watch_2files(): ...@@ -1677,6 +1683,17 @@ def test_wcfs_watch_2files():
# XXX @revX/ is automatically removed after some time # XXX @revX/ is automatically removed after some time
# ---- wcfs.py + virtmem integration ----
# XXX name, text ...
def test_XXX():
t = tDB(); zf = t.zfile
defer(t.close)
at1 = t.commit(zf, {2:'c1'})
at2 = t.commit(zf, {2:'c2'})
wconn = t.wc.connect(at1)
# ---- misc --- # ---- misc ---
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment