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
c386f595
Commit
c386f595
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
50d3b07f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
go/neo/proto.go
go/neo/proto.go
+10
-0
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+53
-0
No files found.
go/neo/proto.go
View file @
c386f595
...
@@ -1003,3 +1003,13 @@ type AddTransaction struct {
...
@@ -1003,3 +1003,13 @@ type AddTransaction struct {
TTid
zodb
.
Tid
TTid
zodb
.
Tid
OidList
[]
zodb
.
Oid
OidList
[]
zodb
.
Oid
}
}
// S -> S
type
AddObject
struct
{
Oid
zodb
.
Oid
Serial
zodb
.
Tid
Compression
bool
Checksum
Checksum
Data
[]
byte
// TODO from pool, separately (?)
DataSerial
zodb
.
Tid
}
go/neo/zproto-marshal.go
View file @
c386f595
...
@@ -3956,6 +3956,58 @@ overflow:
...
@@ -3956,6 +3956,58 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 97. AddObject
func
(
*
AddObject
)
neoMsgCode
()
uint16
{
return
97
}
func
(
p
*
AddObject
)
neoMsgEncodedLen
()
int
{
return
49
+
len
(
p
.
Data
)
}
func
(
p
*
AddObject
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
copy
(
data
[
17
:
],
p
.
Checksum
[
:
])
{
l
:=
uint32
(
len
(
p
.
Data
))
binary
.
BigEndian
.
PutUint32
(
data
[
37
:
],
l
)
data
=
data
[
41
:
]
copy
(
data
,
p
.
Data
)
data
=
data
[
l
:
]
}
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
}
func
(
p
*
AddObject
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
}
p
.
Oid
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Serial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Compression
=
byte2bool
((
data
[
16
:
])[
0
])
copy
(
p
.
Checksum
[
:
],
data
[
17
:
37
])
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
37
:
])
data
=
data
[
41
:
]
if
uint32
(
len
(
data
))
<
8
+
l
{
goto
overflow
}
nread
+=
8
+
l
p
.
Data
=
make
([]
byte
,
l
)
copy
(
p
.
Data
,
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
DataSerial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
41
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// registry of message types
// registry of message types
var
msgTypeRegistry
=
map
[
uint16
]
reflect
.
Type
{
var
msgTypeRegistry
=
map
[
uint16
]
reflect
.
Type
{
0
|
answerBit
:
reflect
.
TypeOf
(
Error
{}),
0
|
answerBit
:
reflect
.
TypeOf
(
Error
{}),
...
@@ -4055,4 +4107,5 @@ var msgTypeRegistry = map[uint16]reflect.Type{
...
@@ -4055,4 +4107,5 @@ var msgTypeRegistry = map[uint16]reflect.Type{
94
:
reflect
.
TypeOf
(
FetchObjects
{}),
94
:
reflect
.
TypeOf
(
FetchObjects
{}),
95
|
answerBit
:
reflect
.
TypeOf
(
AnswerFetchObjects
{}),
95
|
answerBit
:
reflect
.
TypeOf
(
AnswerFetchObjects
{}),
96
:
reflect
.
TypeOf
(
AddTransaction
{}),
96
:
reflect
.
TypeOf
(
AddTransaction
{}),
97
:
reflect
.
TypeOf
(
AddObject
{}),
}
}
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