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
2
Merge Requests
2
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
4ca61cd7
Commit
4ca61cd7
authored
Jul 07, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
57d9037e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+20
-11
No files found.
go/zodb/storage/zeo/zeo.go
View file @
4ca61cd7
...
@@ -86,7 +86,7 @@ func (z *zeo) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error
...
@@ -86,7 +86,7 @@ func (z *zeo) Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, error
func
(
z
*
zeo
)
_Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
*
mem
.
Buf
,
zodb
.
Tid
,
error
)
{
func
(
z
*
zeo
)
_Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
*
mem
.
Buf
,
zodb
.
Tid
,
error
)
{
rpc
:=
z
.
rpc
(
"loadBefore"
)
rpc
:=
z
.
rpc
(
"loadBefore"
)
xres
,
err
:=
rpc
.
call
(
ctx
,
oidPack
(
xid
.
Oid
),
tidPack
(
xid
.
At
+
1
))
// XXX at2Before
xres
,
err
:=
rpc
.
call
(
ctx
,
z
.
srv
.
oidPack
(
xid
.
Oid
),
z
.
srv
.
tidPack
(
xid
.
At
+
1
))
// XXX at2Before
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
err
return
nil
,
0
,
err
}
}
...
@@ -432,7 +432,7 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
...
@@ -432,7 +432,7 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
panic
(
"bug"
)
panic
(
"bug"
)
case
'Z'
:
case
'Z'
:
// pickle
s
: str|bytes
// pickle: str|bytes
v
,
err
:=
pickletools
.
Xstrbytes8
(
xv
)
v
,
err
:=
pickletools
.
Xstrbytes8
(
xv
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
false
return
0
,
false
...
@@ -456,21 +456,30 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
...
@@ -456,21 +456,30 @@ func (zl *zLink) xuint64Unpack(xv interface{}) (uint64, bool) {
}
}
// xuint64Pack packs v into big-endian 8-byte string
// xuint64Pack packs v into big-endian 8-byte string
//
func
(
zl
*
zLink
)
xuint64Pack
(
v
uint64
)
interface
{}
{
// XXX do we need to emit bytes instead of str?
// XXX adapt to msgpack?
func
xuint64Pack
(
v
uint64
)
string
{
var
b
[
8
]
byte
var
b
[
8
]
byte
binary
.
BigEndian
.
PutUint64
(
b
[
:
],
v
)
binary
.
BigEndian
.
PutUint64
(
b
[
:
],
v
)
return
mem
.
String
(
b
[
:
])
switch
zl
.
encoding
{
default
:
panic
(
"bug"
)
case
'Z'
:
// pickle: -> str XXX do we need to emit bytes for py3?
return
mem
.
String
(
b
[
:
])
case
'M'
:
// msgpack: -> bin
return
b
[
:
]
}
}
}
func
tidPack
(
tid
zodb
.
Tid
)
string
{
func
(
zl
*
zLink
)
tidPack
(
tid
zodb
.
Tid
)
interface
{}
{
return
xuint64Pack
(
uint64
(
tid
))
return
zl
.
xuint64Pack
(
uint64
(
tid
))
}
}
func
oidPack
(
oid
zodb
.
Oid
)
string
{
func
(
zl
*
zLink
)
oidPack
(
oid
zodb
.
Oid
)
interface
{}
{
return
xuint64Pack
(
uint64
(
oid
))
return
zl
.
xuint64Pack
(
uint64
(
oid
))
}
}
func
(
zl
*
zLink
)
tidUnpack
(
xv
interface
{})
(
zodb
.
Tid
,
bool
)
{
func
(
zl
*
zLink
)
tidUnpack
(
xv
interface
{})
(
zodb
.
Tid
,
bool
)
{
...
...
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