Commit a974edc9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5d775923
......@@ -789,12 +789,14 @@ func bigopen(ctx context.Context, zconn *ZConn, oid zodb.Oid) (_ *BigFile, err e
zconn.Incref()
return &BigFile{
Node: nodefs.NewDefaultNode(),
zconn: zconn,
zbf: zbf,
zbfSize: zbfSize,
// XXX this is needed only for head/
δFtail: NewΔTailI64(), // XXX indicate we have coverage starting from zconn.at?
loading: make(map[int64]*blkLoadState),
}, nil
}
......@@ -1089,8 +1091,13 @@ func main() {
// add entries to /
mkfile(root, ".wcfs", NewStaticFile([]byte(zurl)))
mkdir(root, "head", &Head{
head := &Head{
Node: nodefs.NewDefaultNode(),
}
mkdir(root, "head", head)
mkdir(head, "bigfile", &BigFileDir{
Node: nodefs.NewDefaultNode(),
tab: make(map[zodb.Oid]*BigFile),
})
// TODO handle autoexit
......
......@@ -99,7 +99,8 @@ def test_join():
defer(wc.close)
assert wc.mountpoint == testmntpt
assert readfile(wc.mountpoint + "/.wcfs") == zurl
assert os.path.isdir(wc.mountpoint + "/bigfile")
assert os.path.isdir(wc.mountpoint + "/head")
assert os.path.isdir(wc.mountpoint + "/head/bigfile")
wc2 = wcfs.join(zurl, autostart=False)
defer(wc2.close)
......@@ -115,7 +116,8 @@ def test_join_autostart():
defer(wc.close)
assert wc.mountpoint == testmntpt
assert readfile(wc.mountpoint + "/.wcfs") == zurl
assert os.path.isdir(wc.mountpoint + "/bigfile")
assert os.path.isdir(wc.mountpoint + "/head")
assert os.path.isdir(wc.mountpoint + "/head/bigfile")
# XXX hack (tmp ?)
......@@ -163,20 +165,19 @@ def test_bigfile_empty():
wc = wcfs.join(testzurl, autostart=True)
defer(wc.close)
# path to bigfile/ under wcfs
bigpath = wc.mountpoint + "/bigfile"
# path to head/bigfile/ under wcfs
bigpath = wc.mountpoint + "/head/bigfile"
# mkdir to non-BigFile - must be rejected
# lookup to non-BigFile - must be rejected
with raises(OSError) as exc:
os.mkdir("%s/%s" % (bigpath, last._p_oid.encode('hex')))
os.stat("%s/%s" % (bigpath, last._p_oid.encode('hex')))
assert exc.value.errno == EINVAL
# path to f under wcfs
fpath = "%s/%s" % (bigpath, f._p_oid.encode('hex'))
os.mkdir(fpath)
st = os.stat(fpath + "/head/data")
st = os.stat(fpath)
assert st.st_size == 0
assert st.st_mtime == tidtime(tid1)
......
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