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
a57954f1
Commit
a57954f1
authored
Jun 06, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0d1abff4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
go/neo/server.go
go/neo/server.go
+6
-6
go/neo/storage.go
go/neo/storage.go
+11
-4
No files found.
go/neo/server.go
View file @
a57954f1
...
@@ -145,7 +145,7 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
...
@@ -145,7 +145,7 @@ func IdentifyPeer(link *NodeLink, myNodeType NodeType) (nodeInfo RequestIdentifi
}
}
// IdentifyMe identifies local node to remote peer
// IdentifyMe identifies local node to remote peer
func
IdentifyMe
(
link
*
NodeLink
,
nodeType
NodeType
/*XXX*/
)
(
peerType
NodeType
,
err
error
)
{
func
IdentifyMe
(
link
*
NodeLink
,
myInfo
NodeInfo
,
clusterName
string
)
(
peerType
NodeType
,
err
error
)
{
defer
errcontextf
(
&
err
,
"%s: request identification"
,
link
)
defer
errcontextf
(
&
err
,
"%s: request identification"
,
link
)
conn
,
err
:=
link
.
NewConn
()
conn
,
err
:=
link
.
NewConn
()
...
@@ -162,11 +162,11 @@ func IdentifyMe(link *NodeLink, nodeType NodeType /*XXX*/) (peerType NodeType, e
...
@@ -162,11 +162,11 @@ func IdentifyMe(link *NodeLink, nodeType NodeType /*XXX*/) (peerType NodeType, e
resp
:=
AcceptIdentification
{}
resp
:=
AcceptIdentification
{}
err
=
Ask
(
conn
,
&
RequestIdentification
{
err
=
Ask
(
conn
,
&
RequestIdentification
{
NodeType
:
n
odeType
,
NodeType
:
myInfo
.
N
odeType
,
NodeUUID
:
0
,
// XXX
NodeUUID
:
myInfo
.
NodeUUID
,
Address
:
Address
{},
// XXX
Address
:
myInfo
.
Address
,
ClusterName
:
""
,
// XXX
ClusterName
:
clusterName
,
IdTimestamp
:
0
,
// XXX
IdTimestamp
:
myInfo
.
IdTimestamp
,
// XXX ok?
},
&
resp
)
},
&
resp
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
go/neo/storage.go
View file @
a57954f1
...
@@ -36,7 +36,8 @@ import (
...
@@ -36,7 +36,8 @@ import (
// Storage is NEO storage server application
// Storage is NEO storage server application
type
Storage
struct
{
type
Storage
struct
{
my
NodeInfo
// XXX -> only Address + NodeUUID ?
myInfo
NodeInfo
// XXX -> only Address + NodeUUID ?
clusterName
string
net
Network
// network we are working on
net
Network
// network we are working on
masterAddr
string
// address of master XXX -> Address ?
masterAddr
string
// address of master XXX -> Address ?
...
@@ -47,8 +48,8 @@ type Storage struct {
...
@@ -47,8 +48,8 @@ type Storage struct {
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// The storage uses zstor as underlying backend for storing data.
// The storage uses zstor as underlying backend for storing data.
// To actually start running the node - call Run. XXX text
// To actually start running the node - call Run. XXX text
func
NewStorage
(
net
Network
,
masterAddr
string
,
serveAddr
string
,
zstor
zodb
.
IStorage
)
*
Storage
{
func
NewStorage
(
cluster
string
,
net
Network
,
masterAddr
string
,
serveAddr
string
,
zstor
zodb
.
IStorage
)
*
Storage
{
stor
:=
&
Storage
{
net
:
net
,
masterAddr
:
masterAddr
,
zstor
:
zstor
}
stor
:=
&
Storage
{
clusterName
:
cluster
,
net
:
net
,
masterAddr
:
masterAddr
,
zstor
:
zstor
}
return
stor
return
stor
}
}
...
@@ -63,6 +64,7 @@ func (stor *Storage) Run(ctx context.Context) error {
...
@@ -63,6 +64,7 @@ func (stor *Storage) Run(ctx context.Context) error {
return
err
// XXX err ctx
return
err
// XXX err ctx
}
}
// FIXME -> no -> Serve closes l
defer
l
.
Close
()
// XXX err ?
defer
l
.
Close
()
// XXX err ?
// now we know our listening address (in case it was autobind before)
// now we know our listening address (in case it was autobind before)
...
@@ -109,8 +111,13 @@ func (stor *Storage) talkMaster1(ctx context.Context) {
...
@@ -109,8 +111,13 @@ func (stor *Storage) talkMaster1(ctx context.Context) {
Mlink
,
err
:=
Dial
(
ctx
,
stor
.
net
,
stor
.
masterAddr
)
Mlink
,
err
:=
Dial
(
ctx
,
stor
.
net
,
stor
.
masterAddr
)
if
err
!=
nil
{
if
err
!=
nil
{
//
XXX
//
err: XXX log or return ?
}
}
// TODO Mlink.Close() on return / cancel
?
,
err
:=
IdentifyMe
(
Mlink
,
stor
.
myInfo
,
stor
.
clusterName
)
// TODO
}
}
// ServeLink serves incoming node-node link connection
// ServeLink serves incoming node-node link connection
...
...
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