Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
650ec24f
Commit
650ec24f
authored
Jul 12, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bc702ef7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
3 deletions
+107
-3
wcfs/wcfs.go
wcfs/wcfs.go
+19
-3
wcfs/zblk.go
wcfs/zblk.go
+88
-0
No files found.
wcfs/wcfs.go
View file @
650ec24f
...
...
@@ -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
}
...
...
wcfs/zblk.go
0 → 100644
View file @
650ec24f
// 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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment