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
d04fb093
Commit
d04fb093
authored
Feb 03, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c5775014
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
10 deletions
+40
-10
go/neo/storage.go
go/neo/storage.go
+12
-2
go/neo/xneo/connect.go
go/neo/xneo/connect.go
+9
-1
go/neo/xneo/nodetab.go
go/neo/xneo/nodetab.go
+10
-1
go/neo/xneo/xneo.go
go/neo/xneo/xneo.go
+9
-6
No files found.
go/neo/storage.go
View file @
d04fb093
...
...
@@ -200,8 +200,18 @@ func (stor *Storage) talkMaster(ctx context.Context) (err error) {
// it returns error describing why such cycle had to finish.
// XXX distinguish between temporary problems and non-temporary ones?
func
(
stor
*
Storage
)
talkMaster1
(
ctx
context
.
Context
)
(
err
error
)
{
// FIXME dup in Client.talkMaster1
mlink
,
accept
,
err
:=
stor
.
node
.
Dial
(
ctx
,
proto
.
MASTER
,
stor
.
node
.
MasterAddr
)
// FIXME dup in MasteredNode.talkMaster1
node
:=
stor
.
node
reqID
:=
&
proto
.
RequestIdentification
{
NodeType
:
node
.
MyInfo
.
Type
,
NID
:
node
.
MyInfo
.
NID
,
Address
:
node
.
MyInfo
.
Addr
,
ClusterName
:
node
.
ClusterName
,
IdTime
:
node
.
MyInfo
.
IdTime
,
// XXX ok?
DevPath
:
nil
,
// XXX stub
NewNID
:
nil
,
// XXX stub
}
mlink
,
accept
,
err
:=
xneo
.
Dial
(
ctx
,
proto
.
MASTER
,
node
.
Net
,
node
.
MasterAddr
,
reqID
)
if
err
!=
nil
{
return
err
}
...
...
go/neo/xneo/connect.go
View file @
d04fb093
...
...
@@ -102,7 +102,15 @@ func (l *listener) Close() error { return l.l.Close() }
func
(
l
*
listener
)
Addr
()
net
.
Addr
{
return
l
.
l
.
Addr
()
}
// XXX Dial + request identification + verify peer type
// Dial connects to another node in the cluster.
//
// It handshakes, requests identification and checks peer type. If successful returned are:
//
// - established link
// - accept identification reply
//
// Dial does not update .NodeTab or its node entries in any way.
// For establishing links to peers present in .NodeTab use Node.Dial.
func
Dial
(
ctx
context
.
Context
,
typ
proto
.
NodeType
,
net
xnet
.
Networker
,
addr
string
,
reqID
*
proto
.
RequestIdentification
)
(
_
*
neonet
.
NodeLink
,
_
*
proto
.
AcceptIdentification
,
err
error
)
{
defer
task
.
Runningf
(
&
ctx
,
"dial %s (%s)"
,
addr
,
typ
)(
&
err
)
...
...
go/neo/xneo/nodetab.go
View file @
d04fb093
...
...
@@ -327,7 +327,16 @@ func (p *PeerNode) dial(ctx context.Context) (_ *neonet.NodeLink, err error) {
defer
task
.
Runningf
(
&
ctx
,
"connect %s"
,
p
.
NID
)(
&
err
)
// XXX "connect" good word here?
node
:=
p
.
nodeTab
.
localNode
link
,
accept
,
err
:=
node
.
Dial
(
ctx
,
p
.
Type
,
p
.
Addr
.
String
())
reqID
:=
&
proto
.
RequestIdentification
{
NodeType
:
node
.
MyInfo
.
Type
,
NID
:
node
.
MyInfo
.
NID
,
Address
:
node
.
MyInfo
.
Addr
,
ClusterName
:
node
.
ClusterName
,
IdTime
:
node
.
MyInfo
.
IdTime
,
// XXX ok?
DevPath
:
nil
,
// XXX stub
NewNID
:
nil
,
// XXX stub
}
link
,
accept
,
err
:=
Dial
(
ctx
,
p
.
Type
,
node
.
Net
,
p
.
Addr
.
String
(),
reqID
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
go/neo/xneo/xneo.go
View file @
d04fb093
...
...
@@ -24,17 +24,17 @@ package xneo
import
(
"context"
"fmt"
//
"fmt"
"sync"
"lab.nexedi.com/kirr/go123/xerr"
//
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/neo/go/internal/log"
"lab.nexedi.com/kirr/neo/go/internal/task"
"lab.nexedi.com/kirr/neo/go/internal/xio"
//
"lab.nexedi.com/kirr/neo/go/internal/task"
//
"lab.nexedi.com/kirr/neo/go/internal/xio"
"lab.nexedi.com/kirr/neo/go/neo/neonet"
//
"lab.nexedi.com/kirr/neo/go/neo/neonet"
"lab.nexedi.com/kirr/neo/go/neo/proto"
)
...
...
@@ -90,6 +90,7 @@ func NewNode(net xnet.Networker, typ proto.NodeType, clusterName, masterAddr str
return
node
}
// XXX kill -> xneo.Dial
// Dial connects to another node in the cluster.
//
// It handshakes, requests identification and checks peer type. If successful returned are:
...
...
@@ -104,7 +105,8 @@ func NewNode(net xnet.Networker, typ proto.NodeType, clusterName, masterAddr str
// <- dialing to other nodes always go through node.Dial
//
// XXX <- use dialNode instead
func
(
node
*
Node
)
Dial
(
ctx
context
.
Context
,
peerType
proto
.
NodeType
,
addr
string
)
(
_
*
neonet
.
NodeLink
,
_
*
proto
.
AcceptIdentification
,
err
error
)
{
/*
func (node *Node) __Dial(ctx context.Context, peerType proto.NodeType, addr string) (_ *neonet.NodeLink, _ *proto.AcceptIdentification, err error) {
defer task.Runningf(&ctx, "dial %v (%v)", addr, peerType)(&err)
link, err := neonet.DialLink(ctx, node.Net, addr)
...
...
@@ -164,6 +166,7 @@ func (node *Node) Dial(ctx context.Context, peerType proto.NodeType, addr string
log.Info(ctx, "identification accepted")
return link, accept, nil
}
*/
// ----------------------------------------
...
...
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