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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
02926be3
Commit
02926be3
authored
Dec 27, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
541e343f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
t/neo/marshal.go
t/neo/marshal.go
+31
-0
t/neo/proto.go
t/neo/proto.go
+1
-2
t/neo/protogen.go
t/neo/protogen.go
+1
-0
No files found.
t/neo/marshal.go
View file @
02926be3
...
@@ -49,3 +49,34 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
...
@@ -49,3 +49,34 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
}
}
return
0
/* + TODO variable part */
,
nil
return
0
/* + TODO variable part */
,
nil
}
}
func
(
p
*
Notify
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
Message
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
return
0
/* + TODO variable part */
,
nil
}
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Code
=
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
Message
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
return
0
/* + TODO variable part */
,
nil
}
func
(
p
*
Ping
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
/* + TODO variable part */
,
nil
}
func
(
p
*
CloseClient
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
/* + TODO variable part */
,
nil
}
t/neo/proto.go
View file @
02926be3
...
@@ -177,7 +177,6 @@ type RowInfo struct {
...
@@ -177,7 +177,6 @@ type RowInfo struct {
/*
// // XXX link request <-> answer ?
// // XXX link request <-> answer ?
// // XXX naming -> PktHeader ?
// // XXX naming -> PktHeader ?
// type PktHead struct {
// type PktHead struct {
...
@@ -186,7 +185,6 @@ type RowInfo struct {
...
@@ -186,7 +185,6 @@ type RowInfo struct {
// Len be32 // whole packet length (including header)
// Len be32 // whole packet length (including header)
// }
// }
// TODO generate .Encode() / .Decode()
// General purpose notification (remote logging)
// General purpose notification (remote logging)
type
Notify
struct
{
type
Notify
struct
{
...
@@ -210,6 +208,7 @@ type Ping struct {
...
@@ -210,6 +208,7 @@ type Ping struct {
type
CloseClient
struct
{
type
CloseClient
struct
{
}
}
/*
// Request a node identification. This must be the first packet for any
// Request a node identification. This must be the first packet for any
// connection. Any -> Any.
// connection. Any -> Any.
type RequestIdentification struct {
type RequestIdentification struct {
...
...
t/neo/protogen.go
View file @
02926be3
...
@@ -209,6 +209,7 @@ func (d *decoder) emitslice(assignto string, obj types.Object, typ *types.Slice)
...
@@ -209,6 +209,7 @@ func (d *decoder) emitslice(assignto string, obj types.Object, typ *types.Slice)
d
.
emit
(
"{ l := %v"
,
d
.
decodedBasic
(
nil
,
types
.
Typ
[
types
.
Uint32
]))
d
.
emit
(
"{ l := %v"
,
d
.
decodedBasic
(
nil
,
types
.
Typ
[
types
.
Uint32
]))
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"%v = make(%v, l)"
,
assignto
,
typ
)
d
.
emit
(
"%v = make(%v, l)"
,
assignto
,
typ
)
// TODO size check
// TODO if size(item)==const - check l in one go
// TODO if size(item)==const - check l in one go
//d.emit("if len(data) < l { return 0, ErrDecodeOverflow }")
//d.emit("if len(data) < l { return 0, ErrDecodeOverflow }")
d
.
emit
(
"for i := 0; i < l; i++ {"
)
d
.
emit
(
"for i := 0; i < l; i++ {"
)
...
...
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