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
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>
// Kirill Smelkov <kirr@nexedi.com>
//
//
// This program is free software: you can Use, Study, Modify and Redistribute
// 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 {
...
@@ -205,6 +205,8 @@ func (r rpc) excError(exc string, argv []interface{}) error {
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// zeo5Error decodes arg of reply with msgExcept flag set and returns
// corresponding error.
// corresponding error.
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
func
(
r
rpc
)
zeo5Error
(
arg
interface
{})
error
{
// XXX check r.zl.encoding == 'Z' before using pickles?
// ('type', (arg1, arg2, arg3, ...))
// ('type', (arg1, arg2, arg3, ...))
texc
,
ok
:=
arg
.
(
pickle
.
Tuple
)
texc
,
ok
:=
arg
.
(
pickle
.
Tuple
)
if
!
ok
||
len
(
texc
)
!=
2
{
if
!
ok
||
len
(
texc
)
!=
2
{
...
@@ -225,6 +227,8 @@ func (r rpc) zeo5Error(arg interface{}) error {
...
@@ -225,6 +227,8 @@ func (r rpc) zeo5Error(arg interface{}) error {
//
//
// nil is returned if arg does not represent an exception.
// nil is returned if arg does not represent an exception.
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
func
(
r
rpc
)
zeo4Error
(
arg
interface
{})
error
{
// XXX check r.zl.encoding == 'Z' before using pickles?
// (exc_class, exc_inst), e.g.
// (exc_class, exc_inst), e.g.
// ogórek.Tuple{
// ogórek.Tuple{
// ogórek.Class{Module:"ZODB.POSException", Name:"POSKeyError"},
// ogórek.Class{Module:"ZODB.POSException", Name:"POSKeyError"},
...
...
go/zodb/storage/zeo/zrpc.go
View file @
e4ff923f
...
@@ -31,7 +31,8 @@ import (
...
@@ -31,7 +31,8 @@ import (
"net"
"net"
"sync"
"sync"
pickle
"github.com/kisielk/og-rek"
msgpack
"github.com/shamaton/msgpack"
pickle
"github.com/kisielk/og-rek"
"github.com/someonegg/gocontainer/rbuf"
"github.com/someonegg/gocontainer/rbuf"
"lab.nexedi.com/kirr/go123/xbytes"
"lab.nexedi.com/kirr/go123/xbytes"
...
@@ -246,10 +247,21 @@ func pktDecodeZ(pkb *pktBuf) (msg, error) {
...
@@ -246,10 +247,21 @@ func pktDecodeZ(pkb *pktBuf) (msg, error) {
return
m
,
derrf
(
".%d: method: got %T; expected str"
,
m
.
msgid
,
tpkt
[
2
])
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
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.
// pktEncodeZ encodes message into raw Z (pickle) packet.
func
pktEncodeZ
(
m
msg
)
*
pktBuf
{
func
pktEncodeZ
(
m
msg
)
*
pktBuf
{
pkb
:=
allocPkb
()
pkb
:=
allocPkb
()
...
@@ -269,13 +281,15 @@ func pktEncodeZ(m msg) *pktBuf {
...
@@ -269,13 +281,15 @@ func pktEncodeZ(m msg) *pktBuf {
return
pkb
return
pkb
}
}
// pktDecodeM decodes raw M (msgpack) packet into message.
// pktEncodeM encodes message into raw M (msgpack) packet.
func
pktDecodeM
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
panic
(
"TODO"
)
}
func
pktEncodeM
(
m
msg
)
*
pktBuf
{
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