Commit 4ba6eacf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 23e2d875
......@@ -116,7 +116,8 @@ func (cli *Client) Run(ctx context.Context) error {
ctx, cancel := context.WithCancel(ctx)
cli.talkMasterCancel = cancel
// cli.node.OnShutdown = cancel // XXX ok?
return cli.talkMaster(ctx)
// return cli.talkMaster(ctx)
return cli.node.talkMaster(ctx)
}
// Close implements zodb.IStorageDriver.
......
......@@ -38,7 +38,8 @@ type TraceCollector struct {
pg *tracing.ProbeGroup
rx interface { RxEvent(interface{}) }
node2Name map[*xneo.NodeApp]string
// node2Name map[*xneo.NodeApp]string
node2Name map[interface{}]string // XXX -> *_MasteredNode
nodeTab2Owner map[*xneo.NodeTable]string
clusterState2Owner map[*proto.ClusterState]string
}
......@@ -48,7 +49,7 @@ func NewTraceCollector(rx interface { RxEvent(interface{}) }) *TraceCollector {
pg: &tracing.ProbeGroup{},
rx: rx,
node2Name: make(map[*xneo.NodeApp]string),
node2Name: make(map[interface{}]string),
nodeTab2Owner: make(map[*xneo.NodeTable]string),
clusterState2Owner: make(map[*proto.ClusterState]string),
}
......@@ -77,15 +78,26 @@ func (t *TraceCollector) Detach() {
//
// This way it can translate e.g. *NodeTable -> owner node name when creating
// corresponding event.
func (t *TraceCollector) RegisterNode(node *xneo.NodeApp, name string) {
func (t *TraceCollector) RegisterNode(node /*XXX -> *_MasteredNode*/interface{}, name string) {
tracing.Lock()
defer tracing.Unlock()
// XXX verify there is no duplicate names
// XXX verify the same pointer is not registerd twice
switch node := node.(type) {
default:
panic(/*bad type*/ node)
case *xneo.NodeApp:
t.node2Name[node] = name
t.nodeTab2Owner[node.NodeTab] = name
t.clusterState2Owner[&node.ClusterState] = name
case *_MasteredNode:
t.node2Name[node] = name
t.nodeTab2Owner[node.state.NodeTab] = name
t.clusterState2Owner[&node.state.Code] = name
}
}
func (t *TraceCollector) TraceNetDial(ev *xnet.TraceDial) {
......
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