mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-25 19:46:52 +02:00
graph/db: use batch loading for ChanUpdatesInHorizon
The following performance gains were measured using the new benchmark test. ``` name old time/op new time/op delta ChanUpdatesInHorizon-native-sqlite-10 18.5s ± 3% 2.0s ± 5% -89.11% (p=0.000 n=9+9) ChanUpdatesInHorizon-native-postgres-10 59.0s ± 3% 0.8s ±10% -98.65% (p=0.000 n=10+9) ```
This commit is contained in:
@@ -37,3 +37,37 @@ func makeQueryParams(numTotalArgs, numListArgs int) string {
|
||||
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// ChannelAndNodes is an interface that provides access to a channel and its
|
||||
// two nodes.
|
||||
type ChannelAndNodes interface {
|
||||
// Channel returns the GraphChannel associated with this interface.
|
||||
Channel() GraphChannel
|
||||
|
||||
// Node1 returns the first GraphNode associated with this channel.
|
||||
Node1() GraphNode
|
||||
|
||||
// Node2 returns the second GraphNode associated with this channel.
|
||||
Node2() GraphNode
|
||||
}
|
||||
|
||||
// Channel returns the GraphChannel associated with this interface.
|
||||
//
|
||||
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||
func (r GetChannelsByPolicyLastUpdateRangeRow) Channel() GraphChannel {
|
||||
return r.GraphChannel
|
||||
}
|
||||
|
||||
// Node1 returns the first GraphNode associated with this channel.
|
||||
//
|
||||
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||
func (r GetChannelsByPolicyLastUpdateRangeRow) Node1() GraphNode {
|
||||
return r.GraphNode
|
||||
}
|
||||
|
||||
// Node2 returns the second GraphNode associated with this channel.
|
||||
//
|
||||
// NOTE: This method is part of the ChannelAndNodes interface.
|
||||
func (r GetChannelsByPolicyLastUpdateRangeRow) Node2() GraphNode {
|
||||
return r.GraphNode_2
|
||||
}
|
||||
|
Reference in New Issue
Block a user