Commit 61d438a4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ac777ea5
......@@ -294,11 +294,11 @@ type BigFileHead struct {
//x *BigFileDir
data *BigFileData
at *BigFileAt
//at *BigFileAt
//inv *BigFileInvalidations
}
// BigFile is internal object for "/bigfile/<bigfileX>/<rev>/{data,at}"
// BigFile is object that serves "/bigfile/<bigfileX>/<rev>/{data,at}"
type BigFile struct {
// current read-only transaction under which we access ZODB data
txnCtx context.Context // XXX -> better directly store txn
......@@ -321,12 +321,12 @@ type BigFileData struct {
bigfile *BigFile
}
// BigFileAt represents "/bigfile/<bigfileX>/head/at"
type BigFileAt struct {
nodefs.Node
bigfile *BigFile
}
// // BigFileAt represents "/bigfile/<bigfileX>/head/at"
// type BigFileAt struct {
// nodefs.Node
//
// bigfile *BigFile
// }
// /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
......@@ -434,13 +434,13 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
bigfile: bf,
}
bfat := &BigFileAt{
Node: nodefs.NewDefaultNode(),
bigfile: bf,
}
// bfat := &BigFileAt{
// Node: nodefs.NewDefaultNode(),
// bigfile: bf,
// }
bfhead.data = bfdata
bfhead.at = bfat
// bfhead.at = bfat
bfroot.tab[oid] = bfdir
bfroot.mu.Unlock()
......@@ -449,7 +449,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
mkdir(bfroot, name, bfdir)
mkdir(bfdir, "head", bfhead)
mkfile(bfhead, "data", bfdata)
mkfile(bfhead, "at", bfat)
mkfile(bfhead, "at", NewSmallFile(bf.readAt))
// XXX mkfile(bh, "invalidations", bh.inv)
return bfdir.Inode(), fuse.OK
......@@ -485,6 +485,14 @@ func (bf *BigFileData) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Contex
}
*/
// /bigfile/<bigfileX>/head/at -> served by readAt.
func (bf *BigFile) readAt() []byte {
// XXX locking
// XXX zconn -> zbf.PJar() ?
return []byte(bf.zconn.At().String())
}
......
......@@ -154,8 +154,8 @@ def test_bigfile_empty():
assert st.st_size == 0
assert st.st_mtime == tidtime(tid1)
assert readfile(fpath + "/head/at") == 'txn2'
# XXX head/at = last txn of whole db
# head/at = last txn of whole db
assert readfile(fpath + "/head/at") == tid2.encode('hex')
wc.close()
......
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