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
a50da567
Commit
a50da567
authored
Jan 23, 2019
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
37b8404c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
wcfs/zblk.go
wcfs/zblk.go
+21
-10
wcfs/zblk_test.go
wcfs/zblk_test.go
+1
-0
No files found.
wcfs/zblk.go
View file @
a50da567
...
...
@@ -39,7 +39,6 @@ package main
import
(
"context"
"fmt"
"log"
"reflect"
"sort"
"sync"
...
...
@@ -141,13 +140,17 @@ func (zb *zBlk0State) DropState() {
zb
.
blkdata
=
""
}
func
(
zb
*
zBlk0State
)
PyGetState
()
interface
{}
{
return
zb
.
blkdata
}
func
(
zb
*
zBlk0State
)
PySetState
(
pystate
interface
{})
error
{
blkdata
,
ok
:=
pystate
.
(
string
)
if
!
ok
{
return
fmt
.
Errorf
(
"expect str; got %s"
,
typeOf
(
pystate
))
}
log
.
Printf
(
"ZBlk0.PySetState #%d"
,
len
(
blkdata
))
//
log.Printf("ZBlk0.PySetState #%d", len(blkdata))
zb
.
blkdata
=
blkdata
return
nil
}
...
...
@@ -168,7 +171,7 @@ func (zb *ZBlk0) loadBlkData(ctx context.Context) ([]byte, error) {
// ZData mimics ZData from python.
type
ZData
struct
{
zBlkBase
zBlkBase
// XXX -> ZBlk1, not here?
zodb
.
Persistent
// XXX py source uses bytes(buf) but on python2 it still results in str
...
...
@@ -181,6 +184,10 @@ func (zd *zDataState) DropState() {
zd
.
data
=
""
}
func
(
zd
*
zDataState
)
PyGetState
()
interface
{}
{
return
zd
.
data
}
func
(
zd
*
zDataState
)
PySetState
(
pystate
interface
{})
error
{
//log.Printf("ZData.PySetState")
data
,
ok
:=
pystate
.
(
string
)
...
...
@@ -205,8 +212,12 @@ func (zb *zBlk1State) DropState() {
zb
.
chunktab
=
nil
}
func
(
zb
*
zBlk1State
)
PyGetState
()
interface
{}
{
return
zb
.
chunktab
}
func
(
zb
*
zBlk1State
)
PySetState
(
pystate
interface
{})
error
{
log
.
Printf
(
"ZBlk1.PySetState"
)
//
log.Printf("ZBlk1.PySetState")
chunktab
,
ok
:=
pystate
.
(
*
btree
.
IOBTree
)
if
!
ok
{
return
fmt
.
Errorf
(
"expect IOBTree; got %s"
,
typeOf
(
pystate
))
...
...
@@ -380,6 +391,7 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) ([]byte, error) {
type
ZBigFile
struct
{
zodb
.
Persistent
// state: (.blksize, .blktab)
blksize
int64
blktab
*
btree
.
LOBTree
// {} blk -> ZBlk*(blkdata)
}
...
...
@@ -393,14 +405,13 @@ func (bf *zBigFileState) DropState() {
bf
.
blktab
=
nil
}
// PyGetState implements zodb.PyStateful.
func
(
bf
*
zBigFileState
)
PyGetState
()
interface
{}
{
return
pickle
.
Tuple
{
bf
.
blksize
,
bf
.
blktab
}
}
// PySetState implements zodb.PyStateful.
func
(
bf
*
zBigFileState
)
PySetState
(
pystate
interface
{})
(
err
error
)
{
// ZBigFile
// .blksize xint
// .blktab LOBtree{} blk -> ZBlk*(blkdata)
//
// state: (.blksize, .blktab)
t
,
ok
:=
pystate
.
(
pickle
.
Tuple
)
if
!
ok
{
return
fmt
.
Errorf
(
"expect [2](); got %s"
,
typeOf
(
pystate
))
...
...
wcfs/zblk_test.go
View file @
a50da567
...
...
@@ -115,4 +115,5 @@ func TestZBlk(t *testing.T) {
// XXX check zf.blktab.MaxKey ?
// XXX check zf.LoadBlk()
// XXX PyGetState vs PySetState
}
Kirill Smelkov
@kirr
·
Jan 31, 2019
Maintainer
.
.
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