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
ca7e96e0
Commit
ca7e96e0
authored
Jul 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/zodb/zeo: Factor-out code to prepare pkt from message into pktEncode
parent
362e555a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
go/zodb/storage/zeo/proto.go
go/zodb/storage/zeo/proto.go
+11
-0
go/zodb/storage/zeo/zrpc.go
go/zodb/storage/zeo/zrpc.go
+6
-6
No files found.
go/zodb/storage/zeo/proto.go
View file @
ca7e96e0
...
@@ -50,6 +50,17 @@ const (
...
@@ -50,6 +50,17 @@ const (
// ---- message encode/decode ↔ packet ----
// ---- message encode/decode ↔ packet ----
// pktEncode encodes message into raw packet.
func
pktEncode
(
m
msg
)
*
pktBuf
{
pkb
:=
allocPkb
()
p
:=
pickle
.
NewEncoder
(
pkb
)
err
:=
p
.
Encode
(
pickle
.
Tuple
{
m
.
msgid
,
m
.
flags
,
m
.
method
,
m
.
arg
})
if
err
!=
nil
{
panic
(
err
)
// all our types are expected to be supported by pickle
}
return
pkb
}
// pktDecode decodes raw packet into message.
// pktDecode decodes raw packet into message.
func
pktDecode
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
func
pktDecode
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
var
m
msg
var
m
msg
...
...
go/zodb/storage/zeo/zrpc.go
View file @
ca7e96e0
...
@@ -183,12 +183,12 @@ func (zl *zLink) Call(ctx context.Context, method string, argv ...interface{}) (
...
@@ -183,12 +183,12 @@ func (zl *zLink) Call(ctx context.Context, method string, argv ...interface{}) (
zl
.
callMu
.
Unlock
()
zl
.
callMu
.
Unlock
()
// (msgid, async, method, argv)
// (msgid, async, method, argv)
pkb
:=
allocPkb
()
pkb
:=
pktEncode
(
msg
{
p
:=
pickle
.
NewEncoder
(
pkb
)
msgid
:
callID
,
err
=
p
.
Encode
(
pickle
.
Tuple
{
callID
,
false
,
method
,
pickle
.
Tuple
(
argv
)})
flags
:
0
,
if
err
!=
nil
{
method
:
method
,
panic
(
err
)
// all our types are expected to be supported by pickle
arg
:
pickle
.
Tuple
(
argv
),
}
}
)
// ok, pkt is ready to go
// ok, pkt is ready to go
err
=
zl
.
sendPkt
(
pkb
)
// XXX ctx cancel
err
=
zl
.
sendPkt
(
pkb
)
// XXX ctx cancel
...
...
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