Commit a52fa604 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a214a315
...@@ -294,16 +294,12 @@ type BigFileHead struct { ...@@ -294,16 +294,12 @@ type BigFileHead struct {
//x *BigFileDir //x *BigFileDir
data *BigFileData data *BigFileData
//at *BigFileAt at *BigFileAt
//inv *BigFileInvalidations //inv *BigFileInvalidations
} }
// BigFileData represents "/bigfile/<bigfileX>/head/data" // BigFile is internal object for "/bigfile/<bigfileX>/<rev>/{data,at}"
// XXX also @<tidX>/data ? type BigFile struct {
type BigFileData struct {
nodefs.Node
//parent *BigFileHead
// 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
...@@ -317,6 +313,21 @@ type BigFileData struct { ...@@ -317,6 +313,21 @@ type BigFileData struct {
// lastChange zodb.Tid // last change to whole bigfile as of .zconn.At view // lastChange zodb.Tid // last change to whole bigfile as of .zconn.At view
} }
// BigFileData represents "/bigfile/<bigfileX>/head/data"
// XXX also @<tidX>/data ?
type BigFileData 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>. // /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
// //
...@@ -412,14 +423,24 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -412,14 +423,24 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
Node: nodefs.NewDefaultNode(), Node: nodefs.NewDefaultNode(),
} }
bfdata := &BigFileData{ bf := &BigFile{
Node: nodefs.NewDefaultNode(),
txnCtx: txnCtx, txnCtx: txnCtx,
zconn: zconn, zconn: zconn,
zbf: zbf, zbf: zbf,
} }
bfdata := &BigFileData{
Node: nodefs.NewDefaultNode(),
bigfile: bf,
}
bfat := &BigFileAt{
Node: nodefs.NewDefaultNode(),
bigfile: bf,
}
bfhead.data = bfdata bfhead.data = bfdata
bfhead.at = bfat
bfroot.tab[oid] = bfdir bfroot.tab[oid] = bfdir
bfroot.mu.Unlock() bfroot.mu.Unlock()
...@@ -428,7 +449,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -428,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)
// XXX mkfile(bh, "at", bh.at) mkfile(bfhead, "at", bfat)
// XXX mkfile(bh, "invalidations", bh.inv) // XXX mkfile(bh, "invalidations", bh.inv)
return bfdir.Inode(), fuse.OK return bfdir.Inode(), fuse.OK
...@@ -445,7 +466,7 @@ func (bfdata *BigFileData) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Con ...@@ -445,7 +466,7 @@ func (bfdata *BigFileData) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Con
// FIXME lastChange should cover all bigfile data, not only ZBigFile itself // FIXME lastChange should cover all bigfile data, not only ZBigFile itself
//mtime := &bfdata.lastChange.Time().Time //mtime := &bfdata.lastChange.Time().Time
lastChange := bfdata.zbf.PSerial() lastChange := bfdata.bigfile.zbf.PSerial()
mtime := lastChange.Time().Time mtime := lastChange.Time().Time
out.SetTimes(/*atime=*/nil, /*mtime=*/&mtime, /*ctime=*/&mtime) out.SetTimes(/*atime=*/nil, /*mtime=*/&mtime, /*ctime=*/&mtime)
......
...@@ -69,7 +69,13 @@ def readfile(path): ...@@ -69,7 +69,13 @@ def readfile(path):
# tidtime converts tid to transaction commit time. # tidtime converts tid to transaction commit time.
def tidtime(tid): def tidtime(tid):
return TimeStamp(tid).timeTime() t = TimeStamp(tid).timeTime()
# ZODB/py vs ZODB/go time resolution is not better than 1µs
# see e.g. https://lab.nexedi.com/kirr/neo/commit/9112f21e
#
# NOTE pytest.approx supports only ==, not e.g. <
return round(t, 6)
# check that zurl does not change from one open to another storage open. # check that zurl does not change from one open to another storage open.
......
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