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> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
...@@ -30,7 +30,7 @@ import ( ...@@ -30,7 +30,7 @@ import (
// ---- events ---- // ---- 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. // event happenned - not e.g. net.Addr or *NodeTab.
// xnet.TraceDial // xnet.TraceDial
...@@ -48,9 +48,6 @@ type eventNetConnect struct { ...@@ -48,9 +48,6 @@ type eventNetConnect struct {
// xnet.TraceListen // xnet.TraceListen
// event: node starts listening // event: node starts listening
//
// XXX we don't actually need this event - nodes always start with already provided listener
// TODO -> remove.
type eventNetListen struct { type eventNetListen struct {
Laddr string Laddr string
} }
...@@ -64,8 +61,7 @@ type eventNeoSend struct { ...@@ -64,8 +61,7 @@ type eventNeoSend struct {
// event: cluster state changed // event: cluster state changed
type eventClusterState struct { type eventClusterState struct {
//Ptr *neo.ClusterState // pointer to variable which holds the state Where string // ~ e.g. name of a node containing changed state code
Where string // XXX document what Where means - (host name of a node ?)
State proto.ClusterState State proto.ClusterState
} }
...@@ -75,20 +71,17 @@ func clusterState(where string, v proto.ClusterState) *eventClusterState { ...@@ -75,20 +71,17 @@ func clusterState(where string, v proto.ClusterState) *eventClusterState {
// event: nodetab entry changed // event: nodetab entry changed
type eventNodeTab struct { type eventNodeTab struct {
//NodeTab unsafe.Pointer // *neo.NodeTable XXX not to noise test diff Where string // ~ name of a node containing changed nodeTab
Where string // host of running node XXX ok? XXX -> TabName?
NodeInfo proto.NodeInfo NodeInfo proto.NodeInfo
} }
// event: master ready to start changed // event: master ready to start changed
type eventMStartReady struct { type eventMStartReady struct {
//Master unsafe.Pointer // *Master XXX not to noise test diff Where string // ~ name of the master node
Where string // host (XXX name) of running node
Ready bool Ready bool
} }
func masterStartReady(where string, ready bool) *eventMStartReady { func masterStartReady(where string, ready bool) *eventMStartReady {
//return &eventMStartReady{unsafe.Pointer(m), ready}
return &eventMStartReady{where, ready} return &eventMStartReady{where, ready}
} }
...@@ -166,13 +159,13 @@ type EventRouter struct { ...@@ -166,13 +159,13 @@ type EventRouter struct {
// state on that node changes, etc... // state on that node changes, etc...
byNode map[string /*host*/]string /*stream*/ 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 // 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. // 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 // 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. // byNode("C") and simply verify events on "m-c" and then "c" in that order.
// keeping events local to C on tC, not tMC helps TestCluster to // keeping events local to C on "c", not "m-c" helps TestCluster to
// organize trace channels in uniform way ) // organize trace channels in uniform way )
byState map[string /*host*/]string /*stream*/ byState map[string /*host*/]string /*stream*/
......
...@@ -114,19 +114,16 @@ func (t *TraceCollector) traceNeoMsgSendPre(l *neonet.NodeLink, connID uint32, m ...@@ -114,19 +114,16 @@ func (t *TraceCollector) traceNeoMsgSendPre(l *neonet.NodeLink, connID uint32, m
} }
func (t *TraceCollector) traceClusterState(cs *proto.ClusterState) { func (t *TraceCollector) traceClusterState(cs *proto.ClusterState) {
//t.rx.RxEvent(&eventClusterState{cs, *cs})
where := t.clusterState2Owner[cs] where := t.clusterState2Owner[cs]
t.rx.RxEvent(&eventClusterState{where, *cs}) t.rx.RxEvent(&eventClusterState{where, *cs})
} }
func (t *TraceCollector) traceNode(nt *xneo.NodeTable, n *xneo.PeerNode) { func (t *TraceCollector) traceNode(nt *xneo.NodeTable, n *xneo.PeerNode) {
//t.rx.RxEvent(&eventNodeTab{unsafe.Pointer(nt), n.NodeInfo})
where := t.nodeTab2Owner[nt] where := t.nodeTab2Owner[nt]
t.rx.RxEvent(&eventNodeTab{where, n.NodeInfo}) t.rx.RxEvent(&eventNodeTab{where, n.NodeInfo})
} }
func (t *TraceCollector) traceMasterStartReady(m *Master, ready bool) { func (t *TraceCollector) traceMasterStartReady(m *Master, ready bool) {
//t.rx.RxEvent(masterStartReady(m, ready))
where := t.node2Name[m.node] where := t.node2Name[m.node]
t.rx.RxEvent(&eventMStartReady{where, ready}) 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