channeldb+lnd: eliminate direct graph access via *channeldb.DB pointer, enable custom graph db implementations #6294
Labels
database
Related to the database/storage of LND
graph
intermediate
Issues suitable for developers moderately familiar with the codebase and LN
refactoring
During the 0.14 cycle, we did a lot of refactoring to extract much of the internal sub-system initialization from the
main()
function inlng.go
. This was a necessary step along the road to enabling things like the new remote signer operating mode, which from the PoV oflnd
is just the same existing wallet/signing interfaces used. In this operating mode,lnd
isn't explicitly aware that it's actually speaking with a signer over the RPC interface. This interaction is enabled by the fact that our internal wallet/signing interface closely mirrors the wallet/signing sub-servers.In a similar vein, if we start to surface more storage-level interfaces as part of the
DatabaseBuilder
abstraction, then we enable users to pass in custom implementations of app-specific storage engines like the invoice registry or channel graph.One easy win here on the road to creating more performance optimized storage implementations for various sub-systems is abstracting away usage of the "channel graph" across the codebase. Today most of the time, the graph is interact with via a direct
*channeldb.DB
pointer. If we add a layer of indirection here with another interface, then it enables more advancedlnd
operating modes like having a fleet of nodes share the same channel graph (no need for them all to download it again once a new node is added to the cluster, etc). Ignoring some of the database concurrency control implications for a second, this would allow new nodes which are part of shared infrastructure to more instantly be initialized, as they don't need to sync the graph from the p2p network. This also serves to de-duplicate information that can safely be shared across relatedlnd
nodes.Steps to Completion
lnd/routing/graph.go
Line 10 in e7505c3
*channeldb.DB
interface which is part of the main db/storage config with the interface created above.The text was updated successfully, but these errors were encountered: