Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
998a49e8
Commit
998a49e8
authored
Feb 19, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
36f1205a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
23 deletions
+13
-23
go/neo/t_events_test.go
go/neo/t_events_test.go
+8
-15
go/neo/t_tracego_test.go
go/neo/t_tracego_test.go
+5
-8
No files found.
go/neo/t_events_test.go
View file @
998a49e8
// Copyright (C) 2017-202
0
Nexedi SA and Contributors.
// Copyright (C) 2017-202
1
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 repr
e
sent 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 prece
nde
ce over byNode.
// state on host changes. Takes prece
den
ce 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*/
...
...
go/neo/t_tracego_test.go
View file @
998a49e8
...
...
@@ -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
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment