Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
89a10d24
Commit
89a10d24
authored
Mar 11, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9dac2c66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
+0
-0
t/neo/zodb/cmd/zodbdump/zodbdump.go
t/neo/zodb/cmd/zodbdump/zodbdump.go
+7
-4
No files found.
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
View file @
89a10d24
No preview for this file type
t/neo/zodb/cmd/zodbdump/zodbdump.go
View file @
89a10d24
...
...
@@ -30,6 +30,7 @@ txn ...
package
main
import
(
"bytes"
"crypto/sha1"
"flag"
"fmt"
...
...
@@ -43,7 +44,7 @@ import (
"lab.nexedi.com/kirr/go123/mem"
//"lab.nexedi.com/kirr/go123/xio"
pickle
"gith
i
b.com/kisielk/og-rek"
pickle
"gith
u
b.com/kisielk/og-rek"
)
// dumpb pickles an object to []byte
...
...
@@ -56,16 +57,17 @@ func dumpb(obj interface{}) []byte {
// as bytes.Buffer.Write will never return an error (it panics on oom)
// the only case when we can get error here is due to non-picklable object
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"dumpb: Non-picklable object %#v: %v"
,
obj
,
err
)
panic
(
fmt
.
Errorf
(
"dumpb: Non-picklable object %#v: %v"
,
obj
,
err
)
)
}
return
buf
.
Bytes
()
}
/*
// normalizeExtPy normalizes ZODB extension to the form zodbdump/py would print it.
// specifically the dictionary pickle inside is analyzed and then ... XXX
func normalizeExtPy(ext []byte) []byte {
// unpickle ext
r
:=
b
ufio
.
NewBuffer
(
ext
)
r := b
ytes
.NewBuffer(ext)
p := pickle.NewDecoder(r)
xv, _ := p.Decode()
v, ok := xv.(map[interface{}]interface{})
...
...
@@ -75,7 +77,7 @@ func normalizeExtPy(ext []byte) []byte {
return ext
}
keyv
:=
make
([]
*
struct
{
key
interface
{}
,
kpickle
[]
byte
},
len
(
v
))
keyv := make([]*struct{key interface{}
;
kpickle []byte}, len(v))
for i, key := range v {
keyv[i].key = key
// NOTE key was created by pickle.Decoder - it must be picklable
...
...
@@ -84,6 +86,7 @@ func normalizeExtPy(ext []byte) []byte {
}
*/
// zodbDump dumps contents of a storage in between tidMin..tidMax range to a writer.
// see top-level documentation for the dump format.
...
...
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