Commit 650ec24f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bc702ef7
......@@ -340,8 +340,6 @@ func NewBigFile(head *BigFileHead) *BigFile {
// Mkdir receives client request to create /bigfile/<bigfileX>.
func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs.Inode, fuse.Status) {
oid, err := zodb.ParseOid(name)
......@@ -361,6 +359,7 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
br.mu.Unlock()
ctx := context.Background() // XXX ok?
/*
buf, _, err := br.zstor.Load(ctx, zodb.Xid{Oid: oid, At: zodb.TidMax}) // FIXME At, use serial
if err != nil {
switch errors.Cause(err).(type) {
......@@ -379,10 +378,27 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
log.Printf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
*/
pybf, err := br.zpy.Load(ctx, zodb.Xid{Oid: oid, At: zodb.TidMax}) // FIXME At, use serial
if err != nil {
switch errors.Cause(err).(type) {
case *zodb.NoObjectError:
// XXX log?
return nil, fuse.EINVAL
case *zodb.NoDataError:
// XXX log?
return nil, fuse.EINVAL // XXX ok?
default:
log.Printf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
}
// XXX -> pyclass.FullName() != "wendelin.bigfile.file_zodb" + ".ZBigFile"
pybfClass := pickle.Class{Module: "wendelin.bigfile.file_zodb", Name: ".ZBigFile"}
if pybf.PyClass != pybfClass {
if pybf.PyClass() != pybfClass {
// XXX log?
return nil, fuse.EINVAL
}
......
// Copyright (C) 2018 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package main
// ZBlk* + ZBigFile loading
import (
//"lab.nexedi.com/kirr/neo/go/zodb"
)
// // loadZBlk0 loads data stored in ZBlk0 object
// func loadZBlk0(ctx context.Context, oid zodb.Oid) (data []byte, err error) {
// ...
// }
// XXX start from loading ZBigFile btree
type ZBigFile struct {
pyobj *zodb.PyObject
blksize int64
blktab ... // LOBtree{} blk -> ZBlk*(blkdata)
}
// module of Wendelin ZODB py objects
const zwendelin "wendelin.bigfile.file_zodb"
// loadZBigFile loads ZBigFile object from specified oid.
func (conn *zpyconn) loadZBigFile(ctx context.Context, oid zodb.Oid) (*ZBigFile, error) {
// ZBigFile
// .blksize xint
// .blktab LOBtree{} blk -> ZBlk*(blkdata)
pyobj, err := zpyconn.Load(ctx, oid)
if err != nil {
return nil, err // XXX errctx
}
if pyobj.PyClass.Path() != zwendelin + ".ZBigFile" {
return nil, XXX_class_missmatch // XXX
}
// decode pystate
t, ok := pyobj.PyState.(pickle.Tuple)
if !ok || len(t) != 2 {
// XXX expected (.blksize, blktab)
}
blksize, ok = pickletools.Xint64(t[0])
// XXX if !ok
tabref, ok := t[1].(pickle.Ref)
// XXX if !ok
t, ok = tabref.Pid.(pickle.Tuple)
if !ok || len(t) != 2 {
// XXX expected (oid, LOBTree)
}
taboid, err = decodeOID(t[0])
// XXX err
if t[1] != pickle.Class{Module: "BTrees.LOBTree", Name: "LOBTree"} {
// XXX err
}
// XXX ok
}
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