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
421fda44
Commit
421fda44
authored
May 10, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
24416cc0
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
354 additions
and
420 deletions
+354
-420
go/neo/master.go
go/neo/master.go
+2
-2
go/neo/parttab.go
go/neo/parttab.go
+3
-2
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+336
-409
go/neo/proto-str.go
go/neo/proto-str.go
+6
-1
go/neo/proto.go
go/neo/proto.go
+2
-1
go/neo/proto_test.go
go/neo/proto_test.go
+2
-2
go/neo/server.go
go/neo/server.go
+3
-3
No files found.
go/neo/master.go
View file @
421fda44
...
@@ -29,12 +29,12 @@ import (
...
@@ -29,12 +29,12 @@ import (
// Master is a node overseeing and managing how whole NEO cluster works
// Master is a node overseeing and managing how whole NEO cluster works
type
Master
struct
{
type
Master
struct
{
c
usterName
string
c
lusterName
string
clusterState
ClusterState
clusterState
ClusterState
}
}
func
NewMaster
(
clusterName
string
)
*
Master
{
func
NewMaster
(
clusterName
string
)
*
Master
{
m
:=
&
Master
{
clusterName
}
m
:=
&
Master
{
clusterName
:
clusterName
}
m
.
SetClusterState
(
RECOVERING
)
// XXX no elections - we are the only master
m
.
SetClusterState
(
RECOVERING
)
// XXX no elections - we are the only master
return
m
return
m
}
}
...
...
go/neo/parttab.go
View file @
421fda44
...
@@ -49,10 +49,11 @@ package neo
...
@@ -49,10 +49,11 @@ package neo
// | | tid
// | | tid
// +-+
// +-+
type
PartitionTable
struct
{
type
PartitionTable
struct
{
ptTab
[]
...
//
ptTab []...
}
}
// Operational returns whether all object space is covered by at least some ready-to-serve nodes
// Operational returns whether all object space is covered by at least some ready-to-serve nodes
func
(
pt
*
PartitionalTable
)
Operational
()
bool
{
func
(
pt
*
PartitionTable
)
Operational
()
bool
{
panic
(
"TODO"
)
}
}
go/neo/proto-marshal.go
View file @
421fda44
This diff is collapsed.
Click to expand it.
go/neo/proto-str.go
View file @
421fda44
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
package
neo
package
neo
import
(
"fmt"
"strings"
)
// XXX or better translate to some other errors ?
// XXX or better translate to some other errors ?
// XXX here - not in proto.go - because else stringer will be confused
// XXX here - not in proto.go - because else stringer will be confused
func
(
e
*
Error
)
Error
()
string
{
func
(
e
*
Error
)
Error
()
string
{
...
@@ -32,7 +37,7 @@ func (nid NodeID) String() string {
...
@@ -32,7 +37,7 @@ func (nid NodeID) String() string {
// 's1', 'm2', for temporary nids
// 's1', 'm2', for temporary nids
if
temp
{
if
temp
{
s
=
strings
.
Lower
(
s
)
s
=
strings
.
To
Lower
(
s
)
}
}
return
s
return
s
...
...
go/neo/proto.go
View file @
421fda44
...
@@ -337,7 +337,8 @@ type AnswerLastIDs struct {
...
@@ -337,7 +337,8 @@ type AnswerLastIDs struct {
// Ask the full partition table. PM -> S.
// Ask the full partition table. PM -> S.
// Answer rows in a partition table. S -> PM.
// Answer rows in a partition table. S -> PM.
type
PartitionTable
struct
{
// XXX overlap with PartitionTable struct
type
X_PartitionTable
struct
{
}
}
type
AnswerPartitionTable
struct
{
type
AnswerPartitionTable
struct
{
...
...
go/neo/proto_test.go
View file @
421fda44
...
@@ -211,7 +211,7 @@ func TestPktMarshal(t *testing.T) {
...
@@ -211,7 +211,7 @@ func TestPktMarshal(t *testing.T) {
// map[uint32]UUID + trailing ...
// map[uint32]UUID + trailing ...
{
&
CheckReplicas
{
{
&
CheckReplicas
{
PartitionDict
:
map
[
uint32
]
UU
ID
{
PartitionDict
:
map
[
uint32
]
Node
ID
{
1
:
7
,
1
:
7
,
2
:
9
,
2
:
9
,
7
:
3
,
7
:
3
,
...
@@ -230,7 +230,7 @@ func TestPktMarshal(t *testing.T) {
...
@@ -230,7 +230,7 @@ func TestPktMarshal(t *testing.T) {
},
},
// uint32, []uint32
// uint32, []uint32
{
&
PartitionCorrupted
{
7
,
[]
UU
ID
{
1
,
3
,
9
,
4
}},
{
&
PartitionCorrupted
{
7
,
[]
Node
ID
{
1
,
3
,
9
,
4
}},
u32
(
7
)
+
u32
(
4
)
+
u32
(
1
)
+
u32
(
3
)
+
u32
(
9
)
+
u32
(
4
),
u32
(
7
)
+
u32
(
4
)
+
u32
(
1
)
+
u32
(
3
)
+
u32
(
9
)
+
u32
(
4
),
},
},
...
...
go/neo/server.go
View file @
421fda44
...
@@ -119,10 +119,10 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
...
@@ -119,10 +119,10 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
err
=
EncodeAndSend
(
conn
,
&
AcceptIdentification
{
err
=
EncodeAndSend
(
conn
,
&
AcceptIdentification
{
NodeType
:
myNodeType
,
NodeType
:
myNodeType
,
My
UUID
:
0
,
// XXX
My
NodeID
:
0
,
// XXX
NumPartitions
:
0
,
// XXX
NumPartitions
:
0
,
// XXX
NumReplicas
:
0
,
// XXX
NumReplicas
:
0
,
// XXX
Your
UUID
:
pkt
.
UU
ID
,
Your
NodeID
:
pkt
.
Node
ID
,
Primary
:
Address
{},
// XXX
Primary
:
Address
{},
// XXX
//KnownMasterList: // XXX
//KnownMasterList: // XXX
})
})
...
@@ -154,7 +154,7 @@ func IdentifyMe(link *NodeLink, nodeType NodeType /*XXX*/) (peerType NodeType, e
...
@@ -154,7 +154,7 @@ func IdentifyMe(link *NodeLink, nodeType NodeType /*XXX*/) (peerType NodeType, e
err
=
EncodeAndSend
(
conn
,
&
RequestIdentification
{
err
=
EncodeAndSend
(
conn
,
&
RequestIdentification
{
ProtocolVersion
:
PROTOCOL_VERSION
,
ProtocolVersion
:
PROTOCOL_VERSION
,
NodeType
:
nodeType
,
NodeType
:
nodeType
,
UU
ID
:
0
,
// XXX
Node
ID
:
0
,
// XXX
Address
:
Address
{},
// XXX
Address
:
Address
{},
// XXX
Name
:
""
,
// XXX cluster name ?
Name
:
""
,
// XXX cluster name ?
IdTimestamp
:
0
,
// XXX
IdTimestamp
:
0
,
// XXX
...
...
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