graph/db: introduce ForEachChannelCacheable
Implement ForEachChannelCacheable which is like ForEachChannel but its call-back takes the cached versions of channel info & policies. This is then used during graph cache population. This will be useful once the SQL implementation is added so that we can reduce the number of DB trips on cache population.
This commit is contained in:
3 files changed
+90
-9
No files matched your search
@@ -159,6 +159,22 @@ type V1Store interface { //nolint:interfacebloat
|
||||
*models.ChannelEdgePolicy,
|
||||
*models.ChannelEdgePolicy) error) error
|
||||
|
||||
// ForEachChannelCacheable iterates through all the channel edges stored
|
||||
// within the graph and invokes the passed callback for each edge. The
|
||||
// callback takes two edges as since this is a directed graph, both the
|
||||
// in/out edges are visited. If the callback returns an error, then the
|
||||
// transaction is aborted and the iteration stops early.
|
||||
//
|
||||
// NOTE: If an edge can't be found, or wasn't advertised, then a nil
|
||||
// pointer for that particular channel edge routing policy will be
|
||||
// passed into the callback.
|
||||
//
|
||||
// NOTE: this method is like ForEachChannel but fetches only the data
|
||||
// required for the graph cache.
|
||||
ForEachChannelCacheable(cb func(*models.CachedEdgeInfo,
|
||||
*models.CachedEdgePolicy,
|
||||
*models.CachedEdgePolicy) error) error
|
||||
|
||||
// DisabledChannelIDs returns the channel ids of disabled channels.
|
||||
// A channel is disabled when two of the associated ChanelEdgePolicies
|
||||
// have their disabled bit on.
|
||||
|
||||
Reference in new issue
Block a user