Commit 84fe9dcc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bdd6be33
...@@ -1012,11 +1012,13 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error { ...@@ -1012,11 +1012,13 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
} }
// /bigfile/<bigfileX>/head/at -> readAt serves read. // /(head|<rev>)/at -> readAt serves read.
func (bf *BigFile) readAt() []byte { func (h *Head) readAt() []byte {
// XXX locking // XXX implemented only for Head, not Rev
// XXX zbf.PJar() not good if we want to share objects between connections? root := groot
return []byte(bf.zbf.PJar().At().String()) root.zheadMu.Lock()
defer root.zheadMu.Unlock()
return []byte(root.zhead.At().String())
} }
...@@ -1108,6 +1110,7 @@ func main() { ...@@ -1108,6 +1110,7 @@ func main() {
Node: nodefs.NewDefaultNode(), Node: nodefs.NewDefaultNode(),
tab: make(map[zodb.Oid]*BigFile), tab: make(map[zodb.Oid]*BigFile),
}) })
mkfile(head, "at", NewSmallFile(head.readAt)) // TODO mtime(at) = tidtime(at)
// TODO handle autoexit // TODO handle autoexit
_ = autoexit _ = autoexit
......
...@@ -165,8 +165,9 @@ def test_bigfile_empty(): ...@@ -165,8 +165,9 @@ def test_bigfile_empty():
wc = wcfs.join(testzurl, autostart=True) wc = wcfs.join(testzurl, autostart=True)
defer(wc.close) defer(wc.close)
# path to head/bigfile/ under wcfs # path to head/ and head/bigfile/ under wcfs
bigpath = wc.mountpoint + "/head/bigfile" head = wc.mountpoint + "/head"
bigpath = head + "/bigfile"
# lookup to non-BigFile - must be rejected # lookup to non-BigFile - must be rejected
with raises(OSError) as exc: with raises(OSError) as exc:
...@@ -182,7 +183,7 @@ def test_bigfile_empty(): ...@@ -182,7 +183,7 @@ def test_bigfile_empty():
assert st.st_mtime == tidtime(tid1) assert st.st_mtime == tidtime(tid1)
# head/at = last txn of whole db # head/at = last txn of whole db
assert readfile(fpath + "/head/at") == tid2.encode('hex') assert readfile(head + "/at") == tid2.encode('hex')
# TODO check head/at syncs to later non-bigfile commits # TODO check head/at syncs to later non-bigfile commits
......
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