multi: pass reset to GraphSession
This commit is contained in:
9 files changed
+23
-14
No files matched your search
+4
-2
@@ -233,12 +233,14 @@ func (c *ChannelGraph) FetchNodeFeatures(node route.Vertex) (
|
||||
// instance which can be used to perform queries against the channel graph. If
|
||||
// the graph cache is not enabled, then the call-back will be provided with
|
||||
// access to the graph via a consistent read-only transaction.
|
||||
func (c *ChannelGraph) GraphSession(cb func(graph NodeTraverser) error) error {
|
||||
func (c *ChannelGraph) GraphSession(cb func(graph NodeTraverser) error,
|
||||
reset func()) error {
|
||||
|
||||
if c.graphCache != nil {
|
||||
return cb(c)
|
||||
}
|
||||
|
||||
return c.V1Store.GraphSession(cb)
|
||||
return c.V1Store.GraphSession(cb, reset)
|
||||
}
|
||||
|
||||
// ForEachNodeCached iterates through all the stored vertices/nodes in the
|
||||
|
||||
@@ -149,7 +149,7 @@ type V1Store interface { //nolint:interfacebloat
|
||||
// GraphSession will provide the call-back with access to a
|
||||
// NodeTraverser instance which can be used to perform queries against
|
||||
// the channel graph.
|
||||
GraphSession(cb func(graph NodeTraverser) error) error
|
||||
GraphSession(cb func(graph NodeTraverser) error, reset func()) error
|
||||
|
||||
// ForEachChannel iterates through all the channel edges stored within
|
||||
// the graph and invokes the passed callback for each edge. The callback
|
||||
|
||||
@@ -3977,8 +3977,8 @@ func (c *KVStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error) {
|
||||
|
||||
// GraphSession will provide the call-back with access to a NodeTraverser
|
||||
// instance which can be used to perform queries against the channel graph.
|
||||
func (c *KVStore) GraphSession(cb func(graph NodeTraverser) error) error {
|
||||
reset := func() {}
|
||||
func (c *KVStore) GraphSession(cb func(graph NodeTraverser) error,
|
||||
reset func()) error {
|
||||
|
||||
return c.db.View(func(tx walletdb.ReadTx) error {
|
||||
return cb(&nodeTraverserSession{
|
||||
|
||||
@@ -2757,10 +2757,10 @@ func (s *SQLStore) IsClosedScid(scid lnwire.ShortChannelID) (bool, error) {
|
||||
// instance which can be used to perform queries against the channel graph.
|
||||
//
|
||||
// NOTE: part of the V1Store interface.
|
||||
func (s *SQLStore) GraphSession(cb func(graph NodeTraverser) error) error {
|
||||
var ctx = context.TODO()
|
||||
func (s *SQLStore) GraphSession(cb func(graph NodeTraverser) error,
|
||||
reset func()) error {
|
||||
|
||||
reset := func() {}
|
||||
var ctx = context.TODO()
|
||||
|
||||
return s.db.ExecTx(ctx, sqldb.ReadTxOpt(), func(db SQLQueries) error {
|
||||
return cb(newSQLNodeTraverser(db, s.cfg.ChainHash))
|
||||
|
||||
Reference in new issue
Block a user