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
f1f7eb02
Commit
f1f7eb02
authored
Feb 19, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
110de273
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
25 deletions
+22
-25
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+7
-6
go/neo/t_tracego_test.go
go/neo/t_tracego_test.go
+15
-19
No files found.
go/neo/t_cluster_test.go
View file @
f1f7eb02
...
...
@@ -52,9 +52,10 @@ type tEnv struct {
// Create it with tEnv.NewCluster.
// Create nodes with .NewMaster, .NewStorage and .NewClient.
//
// NOTE network addresses are predictable due to using pipenet/lonet for inter-node networking.
// The cluster is tested based on synchronous event tracing -
// see package lab.nexedi.com/kirr/go123/tracing/tracetest for context.
//
//
XXX text about events tracing
//
NOTE network addresses are predictable due to using pipenet/lonet for inter-node networking.
type
tCluster
struct
{
*
tEnv
// original testing env this cluster was created at
...
...
@@ -62,8 +63,8 @@ type tCluster struct {
network
*
virtnet
.
SubNetwork
// nodes interoperate via network
traceOn
bool
// whether tracing is currently on or off
gotracer
*
TraceCollector
// for tracing go nodes XXX -> GoTracer
//tpy *PyTracer
// for tracing py nodes
gotracer
*
GoTracer
// for tracing go nodes
//tpy *PyTracer
// for tracing py nodes TODO
erouter
*
EventRouter
// to which stream an event should go
tabMu
sync
.
Mutex
...
...
go/neo/t_tracego_test.go
View file @
f1f7eb02
...
...
@@ -29,12 +29,8 @@ import (
"lab.nexedi.com/kirr/neo/go/neo/xneo"
)
// GoTraceCollector collects events from NEO/go trace points and sends them to event dispatcher.
//
// TraceCollector connects to NEO-specific trace points via probes and sends events to dispatcher.
//
// XXX naming -> GoTracer (and PyTracer for NEO/py)
type
TraceCollector
struct
{
// GoTracer collects events from NEO/go trace points and sends them to event dispatcher.
type
GoTracer
struct
{
pg
*
tracing
.
ProbeGroup
rx
interface
{
RxEvent
(
interface
{})
}
...
...
@@ -43,8 +39,8 @@ type TraceCollector struct {
clusterState2Owner
map
[
*
proto
.
ClusterState
]
string
}
func
NewTraceCollector
(
rx
interface
{
RxEvent
(
interface
{})
})
*
TraceCollecto
r
{
return
&
TraceCollecto
r
{
func
NewTraceCollector
(
rx
interface
{
RxEvent
(
interface
{})
})
*
GoTrace
r
{
return
&
GoTrace
r
{
pg
:
&
tracing
.
ProbeGroup
{},
rx
:
rx
,
...
...
@@ -59,7 +55,7 @@ func NewTraceCollector(rx interface { RxEvent(interface{}) }) *TraceCollector {
//trace:import "lab.nexedi.com/kirr/neo/go/neo/xneo"
// Attach attaches the tracer to appropriate trace points.
func
(
t
*
TraceCollecto
r
)
Attach
()
{
func
(
t
*
GoTrace
r
)
Attach
()
{
tracing
.
Lock
()
//neo_traceMsgRecv_Attach(t.pg, t.traceNeoMsgRecv)
neonet_traceMsgSendPre_Attach
(
t
.
pg
,
t
.
traceNeoMsgSendPre
)
...
...
@@ -69,7 +65,7 @@ func (t *TraceCollector) Attach() {
tracing
.
Unlock
()
}
func
(
t
*
TraceCollecto
r
)
Detach
()
{
func
(
t
*
GoTrace
r
)
Detach
()
{
t
.
pg
.
Done
()
}
...
...
@@ -77,7 +73,7 @@ func (t *TraceCollector) Detach() {
//
// This way it can translate e.g. *NodeTable -> owner node name when creating
// corresponding event.
func
(
t
*
TraceCollecto
r
)
RegisterNode
(
node
*
xneo
.
Node
,
name
string
)
{
func
(
t
*
GoTrace
r
)
RegisterNode
(
node
*
xneo
.
Node
,
name
string
)
{
tracing
.
Lock
()
defer
tracing
.
Unlock
()
...
...
@@ -88,14 +84,14 @@ func (t *TraceCollector) RegisterNode(node *xneo.Node, name string) {
t
.
clusterState2Owner
[
&
node
.
State
.
Code
]
=
name
}
func
(
t
*
TraceCollecto
r
)
TraceNetDial
(
ev
*
xnet
.
TraceDial
)
{
func
(
t
*
GoTrace
r
)
TraceNetDial
(
ev
*
xnet
.
TraceDial
)
{
t
.
rx
.
RxEvent
(
&
eventNetDial
{
Dialer
:
ev
.
Dialer
,
Addr
:
ev
.
Addr
,
})
}
func
(
t
*
TraceCollector
)
TraceNetConnect
(
ev
*
xnet
.
TraceConnect
)
{
func
(
t
*
GoTracer
)
TraceNetConnect
(
ev
*
xnet
.
TraceConnect
)
{
t
.
rx
.
RxEvent
(
&
eventNetConnect
{
Src
:
ev
.
Src
.
String
(),
Dst
:
ev
.
Dst
.
String
(),
...
...
@@ -103,27 +99,27 @@ func (t *TraceCollector) TraceNetConnect(ev *xnet.TraceConnect) {
})
}
func
(
t
*
TraceCollecto
r
)
TraceNetListen
(
ev
*
xnet
.
TraceListen
)
{
func
(
t
*
GoTrace
r
)
TraceNetListen
(
ev
*
xnet
.
TraceListen
)
{
t
.
rx
.
RxEvent
(
&
eventNetListen
{
Laddr
:
ev
.
Laddr
.
String
()})
}
func
(
t
*
TraceCollector
)
TraceNetTx
(
ev
*
xnet
.
TraceTx
)
{}
// we use traceNeoMsgSend instead
func
(
t
*
GoTracer
)
TraceNetTx
(
ev
*
xnet
.
TraceTx
)
{}
// we use traceNeoMsgSend instead
func
(
t
*
TraceCollecto
r
)
traceNeoMsgSendPre
(
l
*
neonet
.
NodeLink
,
connID
uint32
,
msg
proto
.
Msg
)
{
func
(
t
*
GoTrace
r
)
traceNeoMsgSendPre
(
l
*
neonet
.
NodeLink
,
connID
uint32
,
msg
proto
.
Msg
)
{
t
.
rx
.
RxEvent
(
&
eventNeoSend
{
l
.
LocalAddr
()
.
String
(),
l
.
RemoteAddr
()
.
String
(),
connID
,
msg
})
}
func
(
t
*
TraceCollecto
r
)
traceClusterState
(
cs
*
proto
.
ClusterState
)
{
func
(
t
*
GoTrace
r
)
traceClusterState
(
cs
*
proto
.
ClusterState
)
{
where
:=
t
.
clusterState2Owner
[
cs
]
t
.
rx
.
RxEvent
(
&
eventClusterState
{
where
,
*
cs
})
}
func
(
t
*
TraceCollecto
r
)
traceNode
(
nt
*
xneo
.
NodeTable
,
n
*
xneo
.
PeerNode
)
{
func
(
t
*
GoTrace
r
)
traceNode
(
nt
*
xneo
.
NodeTable
,
n
*
xneo
.
PeerNode
)
{
where
:=
t
.
nodeTab2Owner
[
nt
]
t
.
rx
.
RxEvent
(
&
eventNodeTab
{
where
,
n
.
NodeInfo
})
}
func
(
t
*
TraceCollecto
r
)
traceMasterStartReady
(
m
*
Master
,
ready
bool
)
{
func
(
t
*
GoTrace
r
)
traceMasterStartReady
(
m
*
Master
,
ready
bool
)
{
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