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
e4ff923f
Commit
e4ff923f
authored
Jul 05, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f0da8664
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+5
-1
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+22
-8
No files found.
go/zodb/storage/zeo/zeo.go
View file @
e4ff923f
// Copyright (C) 2018-20
19
Nexedi SA and Contributors.
// Copyright (C) 2018-20
20
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -205,6 +205,8 @@ func (r rpc) excError(exc string, argv []interface{}) error {
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// corresponding error.
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
// XXX check r.zl.encoding == 'Z' before using pickles?
// ('type', (arg1, arg2, arg3, ...))
texc
,
ok
:=
arg
.
(
pickle
.
Tuple
)
if
!
ok
||
len
(
texc
)
!=
2
{
...
...
@@ -225,6 +227,8 @@ func (r rpc) zeo5Error(arg interface{}) error {
//
// nil is returned if arg does not represent an exception.
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
// XXX check r.zl.encoding == 'Z' before using pickles?
// (exc_class, exc_inst), e.g.
// ogórek.Tuple{
// ogórek.Class{Module:"ZODB.POSException", Name:"POSKeyError"},
...
...
go/zodb/storage/zeo/zrpc.go
View file @
e4ff923f
...
...
@@ -31,7 +31,8 @@ import (
"net"
"sync"
pickle
"github.com/kisielk/og-rek"
msgpack
"github.com/shamaton/msgpack"
pickle
"github.com/kisielk/og-rek"
"github.com/someonegg/gocontainer/rbuf"
"lab.nexedi.com/kirr/go123/xbytes"
...
...
@@ -246,10 +247,21 @@ func pktDecodeZ(pkb *pktBuf) (msg, error) {
return
m
,
derrf
(
".%d: method: got %T; expected str"
,
m
.
msgid
,
tpkt
[
2
])
}
m
.
arg
=
tpkt
[
3
]
m
.
arg
=
tpkt
[
3
]
// XXX pickle.Tuple -> tuple
return
m
,
nil
}
// pktDecodeM decodes raw M (msgpack) packet into message.
func
pktDecodeM
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
var
m
msg
err
:=
msgpack
.
DecodeStructAsArray
(
pkb
.
Payload
(),
&
m
)
if
err
!=
nil
{
return
m
,
err
}
return
m
,
nil
}
// pktEncodeZ encodes message into raw Z (pickle) packet.
func
pktEncodeZ
(
m
msg
)
*
pktBuf
{
pkb
:=
allocPkb
()
...
...
@@ -269,13 +281,15 @@ func pktEncodeZ(m msg) *pktBuf {
return
pkb
}
// pktDecodeM decodes raw M (msgpack) packet into message.
func
pktDecodeM
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
panic
(
"TODO"
)
}
// pktEncodeM encodes message into raw M (msgpack) packet.
func
pktEncodeM
(
m
msg
)
*
pktBuf
{
panic
(
"TODO"
)
pkb
:=
allocPkb
()
data
,
err
:=
msgpack
.
EncodeStructAsArray
(
m
)
if
err
!=
nil
{
panic
(
err
)
// all our types are expected to be supported by msgpack
}
pkb
.
Write
(
data
)
// XXX extra copy
return
pkb
}
...
...
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