Commit a214a315 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ab73858d
...@@ -311,7 +311,7 @@ type BigFileData struct { ...@@ -311,7 +311,7 @@ type BigFileData struct {
// XXX do we need to keep it here explicitly? // XXX do we need to keep it here explicitly?
zconn *zodb.Connection zconn *zodb.Connection
zbf *ZBigFile zbf *ZBigFile // XXX kept always activated
// TODO // TODO
// 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
...@@ -382,6 +382,17 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -382,6 +382,17 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
return nil, fuse.EINVAL return nil, fuse.EINVAL
} }
// acticate ZBigFile and keep it this way
err = zbf.PActivate(ctx)
if err != nil {
log.Printf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
defer func() {
if status != fuse.OK {
zbf.PDeactivate()
}
}()
// relock bfroot and either mkdir or EEXIST if the directory was maybe // relock bfroot and either mkdir or EEXIST if the directory was maybe
// simultanously created while we were not holding bfroot.mu // simultanously created while we were not holding bfroot.mu
...@@ -426,6 +437,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -426,6 +437,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
// XXX do we need to support rmdir? (probably no) // XXX do we need to support rmdir? (probably no)
// /bigfile/<bigfileX>/head/data -> Getattr serves stat.
func (bfdata *BigFileData) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fuse.Status {
out.Mode = fuse.S_IFREG | 0444
out.Size = 0 // FIXME
// .Blocks
// FIXME lastChange should cover all bigfile data, not only ZBigFile itself
//mtime := &bfdata.lastChange.Time().Time
lastChange := bfdata.zbf.PSerial()
mtime := lastChange.Time().Time
out.SetTimes(/*atime=*/nil, /*mtime=*/&mtime, /*ctime=*/&mtime)
return fuse.OK
}
// Read implements reading from /bigfile/<bigfileX>/head/data. // Read implements reading from /bigfile/<bigfileX>/head/data.
// XXX and from /bigfile/<bigfileX>/@<tidX>/data. // XXX and from /bigfile/<bigfileX>/@<tidX>/data.
/* /*
...@@ -437,11 +465,10 @@ func (bf *BigFileData) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Contex ...@@ -437,11 +465,10 @@ func (bf *BigFileData) Read(_ nodefs.File, dest []byte, off int64, _ fuse.Contex
*/ */
// zodbCacheControl implements LiveCacheControl to tune ZODB to never evict
// zodbCacheControl implements LiveCacheControl to tune ZODB to never evict
// LOBTree/LOBucket from live cache. We want to keep LOBTree/LOBucket always alive // LOBTree/LOBucket from live cache. We want to keep LOBTree/LOBucket always alive
// becuse it is essentially the index where to find ZBigFile data. // becuse it is essentially the index where to find ZBigFile data.
// //
...@@ -458,6 +485,8 @@ func (cc *zodbCacheControl) WantEvict(obj zodb.IPersistent) bool { ...@@ -458,6 +485,8 @@ func (cc *zodbCacheControl) WantEvict(obj zodb.IPersistent) bool {
case *btree.LOBTree: case *btree.LOBTree:
case *btree.LOBucket: case *btree.LOBucket:
// XXX + ZBigFile ?
} }
return false return false
......
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