graph: add ReadOnlyGraph interface to GraphSource interface

In this commit, we take the existing graphsession.ReadyOnlyGraph
interface and remove its usage of a kvdb.RTx and replace it with a more
abstract `RTx` interface type.

The new GraphSource interface is expanded to include the
graphsession.ReadOnlyGraph interface and the implementation of it,
DBSource, is expanded to include the new methods. It converts the
given RTx to the underlying kvdb read transaction where needed.
This commit is contained in:
Elle Mouton
2024-11-11 16:24:46 +02:00
parent 6c008ff8fb
commit aa2480464b
6 changed files with 135 additions and 15 deletions

View File

@@ -1026,7 +1026,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
}
paymentSessionSource := &routing.SessionSource{
GraphSessionFactory: graphsession.NewGraphSessionFactory(
dbs.GraphDB,
graphSource,
),
SourceNode: sourceNode,
MissionControl: s.defaultMC,
@@ -1060,7 +1060,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
s.chanRouter, err = routing.New(routing.Config{
SelfNode: selfNode.PubKeyBytes,
RoutingGraph: graphsession.NewRoutingGraph(dbs.GraphDB),
RoutingGraph: graphsession.NewRoutingGraph(graphSource),
Chain: cc.ChainIO,
Payer: s.htlcSwitch,
Control: s.controlTower,