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

.

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