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