6
6
"time"
7
7
)
8
8
9
- // routerStats is a struct that tracks various updates to the graph and
9
+ // builderStats is a struct that tracks various updates to the graph and
10
10
// facilitates aggregate logging of the statistics.
11
- type routerStats struct {
11
+ type builderStats struct {
12
12
numChannels uint32
13
13
numUpdates uint32
14
14
numNodes uint32
@@ -18,28 +18,28 @@ type routerStats struct {
18
18
}
19
19
20
20
// incNumEdges increments the number of discovered edges.
21
- func (g * routerStats ) incNumEdgesDiscovered () {
21
+ func (g * builderStats ) incNumEdgesDiscovered () {
22
22
g .mu .Lock ()
23
23
g .numChannels ++
24
24
g .mu .Unlock ()
25
25
}
26
26
27
27
// incNumUpdates increments the number of channel updates processed.
28
- func (g * routerStats ) incNumChannelUpdates () {
28
+ func (g * builderStats ) incNumChannelUpdates () {
29
29
g .mu .Lock ()
30
30
g .numUpdates ++
31
31
g .mu .Unlock ()
32
32
}
33
33
34
34
// incNumNodeUpdates increments the number of node updates processed.
35
- func (g * routerStats ) incNumNodeUpdates () {
35
+ func (g * builderStats ) incNumNodeUpdates () {
36
36
g .mu .Lock ()
37
37
g .numNodes ++
38
38
g .mu .Unlock ()
39
39
}
40
40
41
41
// Empty returns true if all stats are zero.
42
- func (g * routerStats ) Empty () bool {
42
+ func (g * builderStats ) Empty () bool {
43
43
g .mu .RLock ()
44
44
isEmpty := g .numChannels == 0 &&
45
45
g .numUpdates == 0 &&
@@ -48,8 +48,8 @@ func (g *routerStats) Empty() bool {
48
48
return isEmpty
49
49
}
50
50
51
- // Reset clears any router stats and sets the lastReset field to now.
52
- func (g * routerStats ) Reset () {
51
+ // Reset clears any stats and sets the lastReset field to now.
52
+ func (g * builderStats ) Reset () {
53
53
g .mu .Lock ()
54
54
g .numChannels = 0
55
55
g .numUpdates = 0
@@ -58,8 +58,8 @@ func (g *routerStats) Reset() {
58
58
g .mu .Unlock ()
59
59
}
60
60
61
- // String returns a human-readable description of the router stats.
62
- func (g * routerStats ) String () string {
61
+ // String returns a human-readable description of the stats.
62
+ func (g * builderStats ) String () string {
63
63
g .mu .RLock ()
64
64
str := fmt .Sprintf ("Processed channels=%d updates=%d nodes=%d in " +
65
65
"last %v" , g .numChannels , g .numUpdates , g .numNodes ,
0 commit comments