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
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 (
// ---- 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.
func
pktDecode
(
pkb
*
pktBuf
)
(
msg
,
error
)
{
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{}) (
zl
.
callMu
.
Unlock
()
// (msgid, async, method, argv)
pkb
:=
allocPkb
()
p
:=
pickle
.
NewEncoder
(
pkb
)
err
=
p
.
Encode
(
pickle
.
Tuple
{
callID
,
false
,
method
,
pickle
.
Tuple
(
argv
)})
if
err
!=
nil
{
panic
(
err
)
// all our types are expected to be supported by pickle
}
pkb
:=
pktEncode
(
msg
{
msgid
:
callID
,
flags
:
0
,
method
:
method
,
arg
:
pickle
.
Tuple
(
argv
),
}
)
// ok, pkt is ready to go
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