Commit 9f2bb7b3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 12a2af21
......@@ -203,21 +203,21 @@ func TestMasterStorage(t *testing.T) {
}
// shortcut for NodeInfo
nodei := func(laddr string, typ neo.NodeType, num int32, state neo.NodeState, idtstamp float64) neo.NodeInfo {
nodei := func(laddr string, typ neo.NodeType, num int32, state neo.NodeState, idtime neo.IdTime) neo.NodeInfo {
return neo.NodeInfo{
Type: typ,
Addr: xnaddr(laddr),
UUID: neo.UUID(typ, num),
State: state,
IdTimestamp: idtstamp,
Type: typ,
Addr: xnaddr(laddr),
UUID: neo.UUID(typ, num),
State: state,
IdTime: idtime,
}
}
// shortcut for nodetab change
node := func(x *neo.NodeApp, laddr string, typ neo.NodeType, num int32, state neo.NodeState, idtstamp float64) *traceNode {
node := func(x *neo.NodeApp, laddr string, typ neo.NodeType, num int32, state neo.NodeState, idtime neo.IdTime) *traceNode {
return &traceNode{
NodeTab: unsafe.Pointer(x.NodeTab),
NodeInfo: nodei(laddr, typ, num, state, idtstamp),
NodeInfo: nodei(laddr, typ, num, state, idtime),
}
}
......@@ -229,7 +229,7 @@ func TestMasterStorage(t *testing.T) {
gwg := &xsync.WorkGroup{}
// start master
Mclock := &vclock{100}
Mclock := &vclock{}
M := NewMaster("abc1", ":1", Mhost)
M.monotime = Mclock.monotime
Mctx, Mcancel := context.WithCancel(bg)
......@@ -241,7 +241,7 @@ func TestMasterStorage(t *testing.T) {
// M starts listening
tc.Expect(netlisten("m:1"))
tc.Expect(node(M.node, "m:1", neo.MASTER, 1, neo.RUNNING, 0))
tc.Expect(node(M.node, "m:1", neo.MASTER, 1, neo.RUNNING, neo.IdTimeNone))
tc.Expect(clusterState(&M.node.ClusterState, neo.ClusterRecovering))
// TODO create C; C tries connect to master - rejected ("not yet operational")
......@@ -266,10 +266,10 @@ func TestMasterStorage(t *testing.T) {
UUID: 0,
Address: xnaddr("s:1"),
ClusterName: "abc1",
IdTimestamp: 0,
IdTime: neo.IdTimeNone,
}))
tc.Expect(node(M.node, "s:1", neo.STORAGE, 1, neo.PENDING, 100.01))
tc.Expect(node(M.node, "s:1", neo.STORAGE, 1, neo.PENDING, 0.01))
tc.Expect(conntx("m:2", "s:2", 1, &neo.AcceptIdentification{
NodeType: neo.MASTER,
......@@ -306,7 +306,7 @@ func TestMasterStorage(t *testing.T) {
exc.Raiseif(err)
})
tc.Expect(node(M.node, "s:1", neo.STORAGE, 1, neo.RUNNING, 100.01))
tc.Expect(node(M.node, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
xwait(wg)
// XXX M.partTab <- S1
......@@ -364,10 +364,10 @@ func TestMasterStorage(t *testing.T) {
UUID: 0,
Address: xnaddr(""),
ClusterName: "abc1",
IdTimestamp: 0,
IdTime: neo.IdTimeNone,
}))
tc.Expect(node(M.node, "", neo.CLIENT, 1, neo.RUNNING, 100.02))
tc.Expect(node(M.node, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
tc.Expect(conntx("m:3", "c:1", 1, &neo.AcceptIdentification{
NodeType: neo.MASTER,
......@@ -390,18 +390,18 @@ func TestMasterStorage(t *testing.T) {
// C <- M NotifyNodeInformation C1,M1,S1
// FIXME this might come in parallel with ^^^ "C asks M about PT"
tc.Expect(conntx("m:3", "c:1", 0, &neo.NotifyNodeInformation{
IdTimestamp: 0, // XXX ?
IdTime: neo.IdTimeNone, // XXX ?
NodeList: []neo.NodeInfo{
nodei("m:1", neo.MASTER, 1, neo.RUNNING, 0),
nodei("s:1", neo.STORAGE, 1, neo.RUNNING, 100.01),
nodei("", neo.CLIENT, 1, neo.RUNNING, 100.02),
nodei("m:1", neo.MASTER, 1, neo.RUNNING, neo.IdTimeNone),
nodei("s:1", neo.STORAGE, 1, neo.RUNNING, 0.01),
nodei("", neo.CLIENT, 1, neo.RUNNING, 0.02),
},
}))
Cnode := *(**neo.NodeApp)(unsafe.Pointer(C)) // XXX hack, fragile
tc.Expect(node(Cnode, "m:1", neo.MASTER, 1, neo.RUNNING, 0))
tc.Expect(node(Cnode, "s:1", neo.STORAGE, 1, neo.RUNNING, 100.01))
tc.Expect(node(Cnode, "", neo.CLIENT, 1, neo.RUNNING, 100.02))
tc.Expect(node(Cnode, "m:1", neo.MASTER, 1, neo.RUNNING, neo.IdTimeNone))
tc.Expect(node(Cnode, "s:1", neo.STORAGE, 1, neo.RUNNING, 0.01))
tc.Expect(node(Cnode, "", neo.CLIENT, 1, neo.RUNNING, 0.02))
// C asks M about last tid XXX better master sends it itself on new client connected
......@@ -444,7 +444,7 @@ func TestMasterStorage(t *testing.T) {
UUID: neo.UUID(neo.CLIENT, 1),
Address: xnaddr(""),
ClusterName: "abc1",
IdTimestamp: 0, // XXX ?
IdTime: 0.02,
}))
tc.Expect(conntx("s:3", "c:2", 1, &neo.AcceptIdentification{
......
......@@ -147,7 +147,7 @@ func (m *Master) Run(ctx context.Context) (err error) {
Addr: naddr,
UUID: m.allocUUID(neo.MASTER),
State: neo.RUNNING,
IdTimestamp: 0, // XXX ok?
IdTime: neo.IdTimeNone, // XXX ok?
}
// update nodeTab with self
......@@ -979,8 +979,8 @@ func (m *Master) keepPeerUpdated(ctx context.Context, link *neo.NodeLink) (err e
// XXX +ClusterState
err = link.Send1(&neo.NotifyNodeInformation{
IdTimestamp: 0, // XXX what here?
NodeList: nodeiv,
IdTime: neo.IdTimeNone, // XXX what here?
NodeList: nodeiv,
})
if err != nil {
return err
......@@ -998,8 +998,8 @@ func (m *Master) keepPeerUpdated(ctx context.Context, link *neo.NodeLink) (err e
case nodeiv = <-nodech:
msg = &neo.NotifyNodeInformation{
IdTimestamp: 0, // XXX what here?
NodeList: nodeiv,
IdTime: neo.IdTimeNone, // XXX what here?
NodeList: nodeiv,
}
}
......@@ -1023,7 +1023,7 @@ func (m *Master) keepPeerUpdated(ctx context.Context, link *neo.NodeLink) (err e
func (m *Master) identify(ctx context.Context, n nodeCome) (node *neo.Node, resp neo.Msg) {
// XXX also verify ? :
// - NodeType valid
// - IdTimestamp ?
// - IdTime ?
uuid := n.idReq.UUID
nodeType := n.idReq.NodeType
......@@ -1098,7 +1098,7 @@ func (m *Master) identify(ctx context.Context, n nodeCome) (node *neo.Node, resp
Addr: n.idReq.Address,
UUID: uuid,
State: nodeState,
IdTimestamp: m.monotime(),
IdTime: neo.IdTime(m.monotime()),
}
node = m.node.NodeTab.Update(nodeInfo) // NOTE this notifies all nodeTab subscribers
......
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