graph/db: version cacheable iteration methods
Add gossip version parameters to ForEachNodeCacheable and ForEachChannelCacheable in the Store interface and both implementations. Thread the version through SQL helpers and update call sites/tests accordingly.
This commit is contained in:
7 files changed
+83
-54
No files matched your search
+17
-15
@@ -1847,16 +1847,17 @@ func TestGraphTraversalCacheable(t *testing.T) {
|
||||
// iterating over each node, once again if the map is empty that
|
||||
// indicates that all edges have properly been reached.
|
||||
var nodes []route.Vertex
|
||||
err = graph.ForEachNodeCacheable(ctx, func(node route.Vertex,
|
||||
features *lnwire.FeatureVector) error {
|
||||
err = graph.ForEachNodeCacheable(
|
||||
ctx, lnwire.GossipVersion1, func(node route.Vertex,
|
||||
features *lnwire.FeatureVector) error {
|
||||
|
||||
delete(nodeMap, node)
|
||||
nodes = append(nodes, node)
|
||||
delete(nodeMap, node)
|
||||
nodes = append(nodes, node)
|
||||
|
||||
return nil
|
||||
}, func() {
|
||||
nodes = nil
|
||||
})
|
||||
return nil
|
||||
}, func() {
|
||||
nodes = nil
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, nodeMap, 0)
|
||||
|
||||
@@ -5062,15 +5063,16 @@ func BenchmarkForEachChannel(b *testing.B) {
|
||||
)
|
||||
|
||||
var nodes []route.Vertex
|
||||
err := graph.ForEachNodeCacheable(ctx, func(node route.Vertex,
|
||||
vector *lnwire.FeatureVector) error {
|
||||
err := graph.ForEachNodeCacheable(
|
||||
ctx, lnwire.GossipVersion1, func(node route.Vertex,
|
||||
vector *lnwire.FeatureVector) error {
|
||||
|
||||
nodes = append(nodes, node)
|
||||
nodes = append(nodes, node)
|
||||
|
||||
return nil
|
||||
}, func() {
|
||||
nodes = nil
|
||||
})
|
||||
return nil
|
||||
}, func() {
|
||||
nodes = nil
|
||||
})
|
||||
require.NoError(b, err)
|
||||
|
||||
for _, n := range nodes {
|
||||
|
||||
Reference in new issue
Block a user