Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
89a10d24
Commit
89a10d24
authored
8 years ago
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
This diff is collapsed.
Click to expand it.
t/neo/zodb/cmd/zodbdump/zodbdump.go
View file @
89a10d24
...
@@ -30,6 +30,7 @@ txn ...
...
@@ -30,6 +30,7 @@ txn ...
package
main
package
main
import
(
import
(
"bytes"
"crypto/sha1"
"crypto/sha1"
"flag"
"flag"
"fmt"
"fmt"
...
@@ -43,7 +44,7 @@ import (
...
@@ -43,7 +44,7 @@ import (
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/mem"
//"lab.nexedi.com/kirr/go123/xio"
//"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
// dumpb pickles an object to []byte
...
@@ -56,16 +57,17 @@ func dumpb(obj interface{}) []byte {
...
@@ -56,16 +57,17 @@ func dumpb(obj interface{}) []byte {
// as bytes.Buffer.Write will never return an error (it panics on oom)
// 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
// the only case when we can get error here is due to non-picklable object
if
err
!=
nil
{
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
()
return
buf
.
Bytes
()
}
}
/*
// normalizeExtPy normalizes ZODB extension to the form zodbdump/py would print it.
// normalizeExtPy normalizes ZODB extension to the form zodbdump/py would print it.
// specifically the dictionary pickle inside is analyzed and then ... XXX
// specifically the dictionary pickle inside is analyzed and then ... XXX
func normalizeExtPy(ext []byte) []byte {
func normalizeExtPy(ext []byte) []byte {
// unpickle ext
// unpickle ext
r
:=
b
ufio
.
NewBuffer
(
ext
)
r := b
ytes
.NewBuffer(ext)
p := pickle.NewDecoder(r)
p := pickle.NewDecoder(r)
xv, _ := p.Decode()
xv, _ := p.Decode()
v, ok := xv.(map[interface{}]interface{})
v, ok := xv.(map[interface{}]interface{})
...
@@ -75,7 +77,7 @@ func normalizeExtPy(ext []byte) []byte {
...
@@ -75,7 +77,7 @@ func normalizeExtPy(ext []byte) []byte {
return ext
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 {
for i, key := range v {
keyv[i].key = key
keyv[i].key = key
// NOTE key was created by pickle.Decoder - it must be picklable
// NOTE key was created by pickle.Decoder - it must be picklable
...
@@ -84,6 +86,7 @@ func normalizeExtPy(ext []byte) []byte {
...
@@ -84,6 +86,7 @@ func normalizeExtPy(ext []byte) []byte {
}
}
*/
// zodbDump dumps contents of a storage in between tidMin..tidMax range to a writer.
// zodbDump dumps contents of a storage in between tidMin..tidMax range to a writer.
// see top-level documentation for the dump format.
// see top-level documentation for the dump format.
...
...
This diff is collapsed.
Click to expand it.
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