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

.

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