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
e216fc66
Commit
e216fc66
authored
Jul 08, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
adaaf7d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+23
-2
No files found.
go/zodb/storage/zeo/zeo.go
View file @
e216fc66
...
...
@@ -97,7 +97,7 @@ func (z *zeo) _Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, erro
return
nil
,
0
,
rpc
.
ereplyf
(
"got %#v; expect 3-tuple"
,
xres
)
}
data
,
ok1
:=
res
[
0
]
.
(
string
)
data
,
ok1
:=
z
.
srv
.
asBytes
(
res
[
0
]
)
serial
,
ok2
:=
z
.
srv
.
tidUnpack
(
res
[
1
])
// next_serial (res[2]) - just ignore
...
...
@@ -105,7 +105,7 @@ func (z *zeo) _Load(ctx context.Context, xid zodb.Xid) (*mem.Buf, zodb.Tid, erro
return
nil
,
0
,
rpc
.
ereplyf
(
"got (%T, %v, %T); expect (str, tid, .)"
,
res
...
)
}
return
&
mem
.
Buf
{
Data
:
mem
.
Bytes
(
data
)
},
serial
,
nil
return
&
mem
.
Buf
{
Data
:
data
},
serial
,
nil
}
// Iterates implements zodb.IStorageDriver.
...
...
@@ -509,3 +509,24 @@ func (zl *zLink) asTuple(xt interface{}) (tuple, bool) {
return
tuple
(
t
),
ok
}
}
// asBytes tries to decode object as raw bytes.
func
(
zl
*
zLink
)
asBytes
(
xb
interface
{})
([]
byte
,
bool
)
{
switch
zl
.
encoding
{
default
:
panic
(
"bug"
)
case
'Z'
:
// pickle: str|bytes
s
,
err
:=
pickletools
.
Xstrbytes
(
xb
)
if
err
!=
nil
{
return
nil
,
false
}
return
mem
.
Bytes
(
s
),
true
case
'M'
:
// msgpack: bin
b
,
ok
:=
xb
.
([]
byte
)
return
b
,
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