routing: rename routing Graph method
In preparation for having the ChannelGraph directly implement the `routing.Graph` interface, we rename the `ForEachNodeChannel` method to `ForEachNodeDirectedChannel` since the ChannelGraph already uses the `ForEachNodeChannel` name and the new name is more appropriate since the ChannelGraph currently has a `ForEachNodeDirectedChannelTx` method which passes the same DirectedChannel type to the given call-back.
This commit is contained in:
7 files changed
+12
-11
No files matched your search
@@ -80,10 +80,11 @@ func (g *session) close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForEachNodeChannel calls the callback for every channel of the given node.
|
// ForEachNodeDirectedChannel calls the callback for every channel of the given
|
||||||
|
// node.
|
||||||
//
|
//
|
||||||
// NOTE: Part of the routing.Graph interface.
|
// NOTE: Part of the routing.Graph interface.
|
||||||
func (g *session) ForEachNodeChannel(nodePub route.Vertex,
|
func (g *session) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||||
|
|
||||||
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func newBandwidthManager(graph Graph, sourceNode route.Vertex,
|
|||||||
|
|
||||||
// First, we'll collect the set of outbound edges from the target
|
// First, we'll collect the set of outbound edges from the target
|
||||||
// source node and add them to our bandwidth manager's map of channels.
|
// source node and add them to our bandwidth manager's map of channels.
|
||||||
err := graph.ForEachNodeChannel(sourceNode,
|
err := graph.ForEachNodeDirectedChannel(sourceNode,
|
||||||
func(channel *graphdb.DirectedChannel) error {
|
func(channel *graphdb.DirectedChannel) error {
|
||||||
shortID := lnwire.NewShortChanIDFromInt(
|
shortID := lnwire.NewShortChanIDFromInt(
|
||||||
channel.ChannelID,
|
channel.ChannelID,
|
||||||
|
|||||||
+3
-3
@@ -12,9 +12,9 @@ import (
|
|||||||
// Graph is an abstract interface that provides information about nodes and
|
// Graph is an abstract interface that provides information about nodes and
|
||||||
// edges to pathfinding.
|
// edges to pathfinding.
|
||||||
type Graph interface {
|
type Graph interface {
|
||||||
// ForEachNodeChannel calls the callback for every channel of the given
|
// ForEachNodeDirectedChannel calls the callback for every channel of
|
||||||
// node.
|
// the given node.
|
||||||
ForEachNodeChannel(nodePub route.Vertex,
|
ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||||
cb func(channel *graphdb.DirectedChannel) error) error
|
cb func(channel *graphdb.DirectedChannel) error) error
|
||||||
|
|
||||||
// FetchNodeFeatures returns the features of the given node.
|
// FetchNodeFeatures returns the features of the given node.
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ func (g *mockGraphSessionChanDB) close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *mockGraphSessionChanDB) ForEachNodeChannel(nodePub route.Vertex,
|
func (g *mockGraphSessionChanDB) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||||
|
|
||||||
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ func (m *mockGraph) addChannel(id uint64, node1id, node2id byte,
|
|||||||
// forEachNodeChannel calls the callback for every channel of the given node.
|
// forEachNodeChannel calls the callback for every channel of the given node.
|
||||||
//
|
//
|
||||||
// NOTE: Part of the Graph interface.
|
// NOTE: Part of the Graph interface.
|
||||||
func (m *mockGraph) ForEachNodeChannel(nodePub route.Vertex,
|
func (m *mockGraph) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||||
|
|
||||||
// Look up the mock node.
|
// Look up the mock node.
|
||||||
|
|||||||
+2
-2
@@ -557,7 +557,7 @@ func getOutgoingBalance(node route.Vertex, outgoingChans map[uint64]struct{},
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over all channels of the to node.
|
// Iterate over all channels of the to node.
|
||||||
err := g.ForEachNodeChannel(node, cb)
|
err := g.ForEachNodeDirectedChannel(node, cb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0, err
|
return 0, 0, err
|
||||||
}
|
}
|
||||||
@@ -1325,7 +1325,7 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
|
|||||||
|
|
||||||
// Now, iterate over the node's channels in search for paths to this
|
// Now, iterate over the node's channels in search for paths to this
|
||||||
// node that can be used for blinded paths
|
// node that can be used for blinded paths
|
||||||
err = g.ForEachNodeChannel(node,
|
err = g.ForEachNodeDirectedChannel(node,
|
||||||
func(channel *graphdb.DirectedChannel) error {
|
func(channel *graphdb.DirectedChannel) error {
|
||||||
// Keep track of how many incoming channels this node
|
// Keep track of how many incoming channels this node
|
||||||
// has. We only use a node as an introduction node if it
|
// has. We only use a node as an introduction node if it
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ func (u *nodeEdgeUnifier) addGraphPolicies(g Graph) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over all channels of the to node.
|
// Iterate over all channels of the to node.
|
||||||
return g.ForEachNodeChannel(u.toNode, cb)
|
return g.ForEachNodeDirectedChannel(u.toNode, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
// unifiedEdge is the individual channel data that is kept inside an edgeUnifier
|
// unifiedEdge is the individual channel data that is kept inside an edgeUnifier
|
||||||
|
|||||||
Reference in new issue
Block a user