Commit 37bb05e1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0ee8a94f
......@@ -24,7 +24,6 @@ import (
"context"
"fmt"
"sync"
// "testing"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
......@@ -48,18 +47,9 @@ type tCluster struct {
//tpy *PyTracer // for tracing py nodes
erouter *EventRouter
// edispatch *tracetest.EventDispatcher
tabMu sync.Mutex
nodeTab map[string/*node*/]*tNode
// // checkTab keeps event checkers for the following event streams:
// // 1) events specific to a node, and
// // 2) events specific to exchange in between node1-node2 for
// // communications that originate at node1.
// //
// // NOTE that node1-node2 and node2-node1 are different and come with
// // separate event checkers.
// checkTab map[string/*node, or node1->node2*/]*tracetest.EventChecker
}
// tNode represents information about a test node ... XXX
......@@ -93,16 +83,12 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
name: name,
network: pipenet.New("testnet"), // test network
nodeTab: make(map[string]*tNode),
// checkTab: make(map[string]*tracetest.EventChecker),
//... XXX
T: ttest,
nodeTab: make(map[string]*tNode),
T: ttest,
}
t.erouter = NewEventRouter()
// t.edispatch = tracetest.NewEventDispatcher(t.erouter)
t.gotracer = NewTraceCollector(ttest)
t.erouter = NewEventRouter()
t.gotracer = NewTraceCollector(ttest)
ttest.SetEventRouter(t.erouter.RouteEvent)
t.gotracer.Attach()
......@@ -112,14 +98,9 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
// Stop stops the cluster.
//
// All processes of the cluster are stopped ... XXX
// XXX do we need error return?
func (t *tCluster) Stop() error {
//... XXX
func (t *tCluster) Stop() {
t.gotracer.Detach()
//XXX t.pytracer.Detach()
return nil
}
// Checker returns tracechecker corresponding to name.
......@@ -168,24 +149,15 @@ func (t *tCluster) registerNewNode(name string) *tNode {
panic(fmt.Sprintf("test cluster: node %q registered twice", name))
}
// tracechecker for events on node
// c1 := tracetest.NewChan(name) // trace of events local to node
// trace of events local to node
t.erouter.BranchNode(name, name)
// t.checkTab[name] = tracetest.NewEventChecker(t.TB, t.edispatch, c1)
// tracecheckers for events on links of all node1-node2 pairs
// trace for events on links of all node1-node2 pairs
for name2 := range t.nodeTab {
// trace of events with cause root being node1 -> node2 send
// c12 := tracetest.NewChan(name + "-" + name2)
// ----//---- node2 -> node1 send
// c21 := tracetest.NewChan(name2 + "-" + name)
//
// t12 := tracetest.NewEventChecker(t.TB, t.edispatch, c12)
// t21 := tracetest.NewEventChecker(t.TB, t.edispatch, c21)
// traces for events of 2 streams:
// 1) with cause root being node1 -> node2 send, and
// 2) ----//---- node1 <- node2 send.
t.erouter.BranchLink(name + "-" + name2, name+"-"+name2, name2+"-"+name)
// t.checkTab[name + "-" + name2] = t12
// t.checkTab[name2 + "-" + name] = t21
}
node := &tNode{}
......
......@@ -152,6 +152,13 @@ func δnode(where string, laddr string, typ proto.NodeType, num int32, state pro
// EventRouter implements NEO-specific routing of events to trace test channels.
//
// A test has to define routing rules using BranchNode, BranchState and BranchLink.
//
// EventRouter maintains routes for the following event streams:
// 1) events specific to a node, and
// 2) events specific to exchange in between node1-node2 for
// communications that originate at node1.
//
// NOTE that node1-node2 and node2-node1 are different and come as separate streams.
type EventRouter struct {
mu sync.Mutex
......
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