Commit 998a49e8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 36f1205a
// Copyright (C) 2017-2020 Nexedi SA and Contributors.
// Copyright (C) 2017-2021 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
......@@ -30,7 +30,7 @@ import (
// ---- events ----
// NOTE to ease testing we use strings only to reprsent addresses or where
// NOTE to ease testing we use strings only to represent addresses or where
// event happenned - not e.g. net.Addr or *NodeTab.
// xnet.TraceDial
......@@ -48,9 +48,6 @@ type eventNetConnect struct {
// xnet.TraceListen
// event: node starts listening
//
// XXX we don't actually need this event - nodes always start with already provided listener
// TODO -> remove.
type eventNetListen struct {
Laddr string
}
......@@ -64,8 +61,7 @@ type eventNeoSend struct {
// event: cluster state changed
type eventClusterState struct {
//Ptr *neo.ClusterState // pointer to variable which holds the state
Where string // XXX document what Where means - (host name of a node ?)
Where string // ~ e.g. name of a node containing changed state code
State proto.ClusterState
}
......@@ -75,20 +71,17 @@ func clusterState(where string, v proto.ClusterState) *eventClusterState {
// event: nodetab entry changed
type eventNodeTab struct {
//NodeTab unsafe.Pointer // *neo.NodeTable XXX not to noise test diff
Where string // host of running node XXX ok? XXX -> TabName?
Where string // ~ name of a node containing changed nodeTab
NodeInfo proto.NodeInfo
}
// event: master ready to start changed
type eventMStartReady struct {
//Master unsafe.Pointer // *Master XXX not to noise test diff
Where string // host (XXX name) of running node
Where string // ~ name of the master node
Ready bool
}
func masterStartReady(where string, ready bool) *eventMStartReady {
//return &eventMStartReady{unsafe.Pointer(m), ready}
return &eventMStartReady{where, ready}
}
......@@ -166,13 +159,13 @@ type EventRouter struct {
// state on that node changes, etc...
byNode map[string /*host*/]string /*stream*/
// state on host changes. Takes precendece over byNode.
// state on host changes. Takes precedence over byNode.
//
// XXX not needed? ( I was once considering state change events on C to
// be routed to MC, because state change on C is due to M sends.
// However everything is correct if we put those C state changes on to
// byNode("C") and simply verify events on tMC and then tC in that order.
// keeping events local to C on tC, not tMC helps TestCluster to
// byNode("C") and simply verify events on "m-c" and then "c" in that order.
// keeping events local to C on "c", not "m-c" helps TestCluster to
// organize trace channels in uniform way )
byState map[string /*host*/]string /*stream*/
......
......@@ -45,12 +45,12 @@ type TraceCollector struct {
func NewTraceCollector(rx interface { RxEvent(interface{}) }) *TraceCollector {
return &TraceCollector{
pg: &tracing.ProbeGroup{},
rx: rx,
pg: &tracing.ProbeGroup{},
rx: rx,
node2Name: make(map[*xneo.Node]string),
nodeTab2Owner: make(map[*xneo.NodeTable]string),
clusterState2Owner: make(map[*proto.ClusterState]string),
node2Name: make(map[*xneo.Node]string),
nodeTab2Owner: make(map[*xneo.NodeTable]string),
clusterState2Owner: make(map[*proto.ClusterState]string),
}
}
......@@ -114,19 +114,16 @@ func (t *TraceCollector) traceNeoMsgSendPre(l *neonet.NodeLink, connID uint32, m
}
func (t *TraceCollector) traceClusterState(cs *proto.ClusterState) {
//t.rx.RxEvent(&eventClusterState{cs, *cs})
where := t.clusterState2Owner[cs]
t.rx.RxEvent(&eventClusterState{where, *cs})
}
func (t *TraceCollector) traceNode(nt *xneo.NodeTable, n *xneo.PeerNode) {
//t.rx.RxEvent(&eventNodeTab{unsafe.Pointer(nt), n.NodeInfo})
where := t.nodeTab2Owner[nt]
t.rx.RxEvent(&eventNodeTab{where, n.NodeInfo})
}
func (t *TraceCollector) traceMasterStartReady(m *Master, ready bool) {
//t.rx.RxEvent(masterStartReady(m, ready))
where := t.node2Name[m.node]
t.rx.RxEvent(&eventMStartReady{where, ready})
}
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