Skip to content

Commit 6169b47

Browse files
committed
graph: rename routerStats to builderStats
This logic used to be handled by the router. Update to reflect new owner.
1 parent d757b3b commit 6169b47

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

graph/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ type Builder struct {
153153

154154
// stats tracks newly processed channels, updates, and node
155155
// announcements over a window of defaultStatInterval.
156-
stats *routerStats
156+
stats *builderStats
157157

158158
quit chan struct{}
159159
wg sync.WaitGroup
@@ -171,7 +171,7 @@ func NewBuilder(cfg *Config) (*Builder, error) {
171171
ntfnClientUpdates: make(chan *topologyClientUpdate),
172172
channelEdgeMtx: multimutex.NewMutex[uint64](),
173173
statTicker: ticker.New(defaultStatInterval),
174-
stats: new(routerStats),
174+
stats: new(builderStats),
175175
quit: make(chan struct{}),
176176
}, nil
177177
}

graph/stats.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"time"
77
)
88

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
1010
// facilitates aggregate logging of the statistics.
11-
type routerStats struct {
11+
type builderStats struct {
1212
numChannels uint32
1313
numUpdates uint32
1414
numNodes uint32
@@ -18,28 +18,28 @@ type routerStats struct {
1818
}
1919

2020
// incNumEdges increments the number of discovered edges.
21-
func (g *routerStats) incNumEdgesDiscovered() {
21+
func (g *builderStats) incNumEdgesDiscovered() {
2222
g.mu.Lock()
2323
g.numChannels++
2424
g.mu.Unlock()
2525
}
2626

2727
// incNumUpdates increments the number of channel updates processed.
28-
func (g *routerStats) incNumChannelUpdates() {
28+
func (g *builderStats) incNumChannelUpdates() {
2929
g.mu.Lock()
3030
g.numUpdates++
3131
g.mu.Unlock()
3232
}
3333

3434
// incNumNodeUpdates increments the number of node updates processed.
35-
func (g *routerStats) incNumNodeUpdates() {
35+
func (g *builderStats) incNumNodeUpdates() {
3636
g.mu.Lock()
3737
g.numNodes++
3838
g.mu.Unlock()
3939
}
4040

4141
// Empty returns true if all stats are zero.
42-
func (g *routerStats) Empty() bool {
42+
func (g *builderStats) Empty() bool {
4343
g.mu.RLock()
4444
isEmpty := g.numChannels == 0 &&
4545
g.numUpdates == 0 &&
@@ -48,8 +48,8 @@ func (g *routerStats) Empty() bool {
4848
return isEmpty
4949
}
5050

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() {
5353
g.mu.Lock()
5454
g.numChannels = 0
5555
g.numUpdates = 0
@@ -58,8 +58,8 @@ func (g *routerStats) Reset() {
5858
g.mu.Unlock()
5959
}
6060

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 {
6363
g.mu.RLock()
6464
str := fmt.Sprintf("Processed channels=%d updates=%d nodes=%d in "+
6565
"last %v", g.numChannels, g.numUpdates, g.numNodes,

0 commit comments

Comments
 (0)