Commit 62a2fddc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 72311505
......@@ -125,53 +125,6 @@ def _open(wc, obj, mode='rb', at=None):
return open(path, mode, 0) # unbuffered
"""
# open creates wcfs file handle, which can be mmaped to give data of ZBigFile.
#
# XXX more text
#
# All mmapings of one FileH share changes.
# There can be several different FileH for the same (at, oid), and those
# FileH do not share changes.
def open(self, zfile): # -> FileH
#assert isinstance(zfile, ZBigFile) # XXX import cycle
zconn = zfile._p_jar
# XXX ._start is probably ZODB5 only -> check ZODB4 and ZODB3
zat = p64(u64(zconn._storage._start)-1) # before -> at
# XXX pinned to @revX/... for now -> TODO /head/bigfile/...
path = '%s/@%s/bigfile/%s' % (self.mountpoint, h(zat), h(zfile._p_oid))
fd = os.open(path, os.O_RDONLY)
return FileH(fd)
"""
"""
# FileH is handle to opened bigfile/X.
#
# XXX it mimics BigFileH and should be integrated into virtmem (see fileh_open_overlay)
#
# XXX it should implement wcfs invalidation protocol and remmap head/... parts
# to pinned as requested.
import mmap
from bigarray import pagesize # XXX hack
from bigarray.array_ram import _VMA # XXX hack
class FileH(object):
# .fd
def __init__(self, fd):
self.fd = fd
def __del__(self):
os.close(self.fd)
def mmap(self, pgoffset, pglen):
return _VMA(self.fd, pgoffset, pglen, pagesize, mmap.PROT_READ)
"""
# ---- join/run wcfs ----
......
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