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
147c741d
Commit
147c741d
authored
Dec 27, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
02926be3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
t/neo/marshal.go
t/neo/marshal.go
+66
-0
t/neo/proto.go
t/neo/proto.go
+1
-1
t/neo/protogen.go
t/neo/protogen.go
+1
-1
No files found.
t/neo/marshal.go
View file @
147c741d
...
...
@@ -80,3 +80,69 @@ func (p *Ping) NEODecode(data []byte) (int, error) {
func
(
p
*
CloseClient
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
/* + TODO variable part */
,
nil
}
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
ProtocolVersion
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
8
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
12
:
])
data
=
data
[
16
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
Name
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
MyUUID
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
NumPartitions
=
BigEndian
.
Uint32
(
data
[
8
:
])
p
.
NumReplicas
=
BigEndian
.
Uint32
(
data
[
12
:
])
p
.
YourUUID
=
int32
(
BigEndian
.
Uint32
(
data
[
16
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
20
:
])
data
=
data
[
24
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
Primary
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Primary
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
p
.
KnownMasterList
=
make
([]
struct
{
neo
.
Address
UUID
neo
.
UUID
},
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
}
p
.
KnownMasterList
[
i
]
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
KnownMasterList
[
i
]
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
KnownMasterList
[
i
]
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
2
:
]))
data
=
data
[
6
:
]
}
}
return
0
/* + TODO variable part */
,
nil
}
t/neo/proto.go
View file @
147c741d
...
...
@@ -208,7 +208,6 @@ type Ping struct {
type
CloseClient
struct
{
}
/*
// Request a node identification. This must be the first packet for any
// connection. Any -> Any.
type
RequestIdentification
struct
{
...
...
@@ -234,6 +233,7 @@ type AcceptIdentification struct {
}
}
/*
// Ask current primary master's uuid. CTL -> A.
type PrimaryMaster struct {
}
...
...
t/neo/protogen.go
View file @
147c741d
...
...
@@ -268,7 +268,7 @@ func gendecode(typespec *ast.TypeSpec) string {
d
.
emitobjtype
(
"p"
,
obj
,
typ
)
d
.
emit
(
"return %v /* + TODO variable part */, nil"
,
d
.
n
)
d
.
emit
(
"return %v /* + TODO variable part */, nil"
,
d
.
n
)
// FIXME n is wrong after reset
d
.
emit
(
"}"
)
return
d
.
buf
.
String
()
...
...
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