-
Notifications
You must be signed in to change notification settings - Fork 2.2k
graph/db: introduce a V1Store
interface
#9791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
graph/db: introduce a V1Store
interface
#9791
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
8fdf7d4
to
d195d0c
Compare
In this commit, we introduce the `V1Store` interface which the existing `graphdb.KVStore` implements today. The idea is to eventually create a SQL DB backed implementation of this interface.
Use the new `V1Store` interface as a field in the `ChannelGraph` rather than a pointer to the `KVStore` implementation in preparation for allowing a SQL implementation of `V1Store` to be used by the `ChannelGraph`. Note that two tests are adjusted in this commit to be skipped if the V1Store is not the `KVStore` implementation since the tests are very bbolt specific.
So that we can pass in the abstract V1Store in preparation for adding a SQL implementation of the KVStore.
d195d0c
to
30e8fe4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, LGTM 🎉
|
||
// V1Store represents the main interface for the channel graph database for all | ||
// channels and nodes gossiped via the V1 gossip protocol as defined in BOLT 7. | ||
type V1Store interface { //nolint:interfacebloat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah yeah, linter, you're not wrong. But don't judge us on this, we're working on it 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
}, func() {}) | ||
require.NoError(t, err, "error reading db") | ||
_, err = deserializeChanEdgePolicy(r) | ||
require.ErrorIs(t, err, ErrEdgePolicyOptionalFieldNotFound) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, so the whole kvdb.View()
call was basically a no-op in the first place...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed 🤓
55ca87b
into
lightningnetwork:elle-graph
In this PR, we introduce the
V1Store
interface which the existinggraphdb.KVStore
implements today. This is in preparation for addinga SQL implementation of this interface eventually.
We then start using this interface from within the
ChannelGraph
instead of directly usinga
KVStore
pointer.part of #9795