Commit a57954f1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0d1abff4
...@@ -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: nodeType, NodeType: myInfo.NodeType,
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 {
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment