mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 14:00:08 +02:00
graph: rename routerStats to builderStats
This logic used to be handled by the router. Update to reflect new owner.
This commit is contained in:
@ -153,7 +153,7 @@ type Builder struct {
|
|||||||
|
|
||||||
// stats tracks newly processed channels, updates, and node
|
// stats tracks newly processed channels, updates, and node
|
||||||
// announcements over a window of defaultStatInterval.
|
// announcements over a window of defaultStatInterval.
|
||||||
stats *routerStats
|
stats *builderStats
|
||||||
|
|
||||||
quit chan struct{}
|
quit chan struct{}
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
@ -171,7 +171,7 @@ func NewBuilder(cfg *Config) (*Builder, error) {
|
|||||||
ntfnClientUpdates: make(chan *topologyClientUpdate),
|
ntfnClientUpdates: make(chan *topologyClientUpdate),
|
||||||
channelEdgeMtx: multimutex.NewMutex[uint64](),
|
channelEdgeMtx: multimutex.NewMutex[uint64](),
|
||||||
statTicker: ticker.New(defaultStatInterval),
|
statTicker: ticker.New(defaultStatInterval),
|
||||||
stats: new(routerStats),
|
stats: new(builderStats),
|
||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// routerStats is a struct that tracks various updates to the graph and
|
// builderStats is a struct that tracks various updates to the graph and
|
||||||
// facilitates aggregate logging of the statistics.
|
// facilitates aggregate logging of the statistics.
|
||||||
type routerStats struct {
|
type builderStats struct {
|
||||||
numChannels uint32
|
numChannels uint32
|
||||||
numUpdates uint32
|
numUpdates uint32
|
||||||
numNodes uint32
|
numNodes uint32
|
||||||
@ -18,28 +18,28 @@ type routerStats struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// incNumEdges increments the number of discovered edges.
|
// incNumEdges increments the number of discovered edges.
|
||||||
func (g *routerStats) incNumEdgesDiscovered() {
|
func (g *builderStats) incNumEdgesDiscovered() {
|
||||||
g.mu.Lock()
|
g.mu.Lock()
|
||||||
g.numChannels++
|
g.numChannels++
|
||||||
g.mu.Unlock()
|
g.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// incNumUpdates increments the number of channel updates processed.
|
// incNumUpdates increments the number of channel updates processed.
|
||||||
func (g *routerStats) incNumChannelUpdates() {
|
func (g *builderStats) incNumChannelUpdates() {
|
||||||
g.mu.Lock()
|
g.mu.Lock()
|
||||||
g.numUpdates++
|
g.numUpdates++
|
||||||
g.mu.Unlock()
|
g.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// incNumNodeUpdates increments the number of node updates processed.
|
// incNumNodeUpdates increments the number of node updates processed.
|
||||||
func (g *routerStats) incNumNodeUpdates() {
|
func (g *builderStats) incNumNodeUpdates() {
|
||||||
g.mu.Lock()
|
g.mu.Lock()
|
||||||
g.numNodes++
|
g.numNodes++
|
||||||
g.mu.Unlock()
|
g.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty returns true if all stats are zero.
|
// Empty returns true if all stats are zero.
|
||||||
func (g *routerStats) Empty() bool {
|
func (g *builderStats) Empty() bool {
|
||||||
g.mu.RLock()
|
g.mu.RLock()
|
||||||
isEmpty := g.numChannels == 0 &&
|
isEmpty := g.numChannels == 0 &&
|
||||||
g.numUpdates == 0 &&
|
g.numUpdates == 0 &&
|
||||||
@ -48,8 +48,8 @@ func (g *routerStats) Empty() bool {
|
|||||||
return isEmpty
|
return isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset clears any router stats and sets the lastReset field to now.
|
// Reset clears any stats and sets the lastReset field to now.
|
||||||
func (g *routerStats) Reset() {
|
func (g *builderStats) Reset() {
|
||||||
g.mu.Lock()
|
g.mu.Lock()
|
||||||
g.numChannels = 0
|
g.numChannels = 0
|
||||||
g.numUpdates = 0
|
g.numUpdates = 0
|
||||||
@ -58,8 +58,8 @@ func (g *routerStats) Reset() {
|
|||||||
g.mu.Unlock()
|
g.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns a human-readable description of the router stats.
|
// String returns a human-readable description of the stats.
|
||||||
func (g *routerStats) String() string {
|
func (g *builderStats) String() string {
|
||||||
g.mu.RLock()
|
g.mu.RLock()
|
||||||
str := fmt.Sprintf("Processed channels=%d updates=%d nodes=%d in "+
|
str := fmt.Sprintf("Processed channels=%d updates=%d nodes=%d in "+
|
||||||
"last %v", g.numChannels, g.numUpdates, g.numNodes,
|
"last %v", g.numChannels, g.numUpdates, g.numNodes,
|
||||||
|
Reference in New Issue
Block a user