-
Notifications
You must be signed in to change notification settings - Fork 103
[sql-9] sessions: small sql preparations #967
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
Conversation
In preparation for adding a new `sql_store.go` file later on.
Keep all KVDB logic contained within the same file.
To better reflect the DB backing the CRUD and to prepare for a new `SQLStore` type.
And move an error here which we plan to use across DB types.
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.
Overall, this looks great 👌. I was able to compile & run litd on regtest with no issues. I also confirmed the unit tests passed.
Regarding the code, the refactors seem pretty straight-forward. I'm still getting familiar with the codebase, so don't have any implementation specific feedback just yet.
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.
Looks good 🚀! Leaving a comment regarding one nil
check that'd be needed with this refactor, but other than that, this looks good to go 🔥
terminal.go
Outdated
@@ -1457,6 +1457,11 @@ func (g *LightningTerminal) shutdownSubServers() error { | |||
} | |||
} | |||
|
|||
if err := g.sessionDB.Close(); err != nil { |
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.
Should also check that g.sessionDB != nil
, incase g.start
errors before setting the sessionDB
field.
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.
def - good catch 🙏
Give the sessionRpcServer access to the session store via the session.Store interface instead of the raw DB pointer. This will make it possible to swop out the implementation (which is currently bbolt) with something else such as a SQL implementation. We move the responsibility of closing the DB to the main LiT server.
8a2147f
to
29f6db7
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 🚀🎉
This is a pure refactor that just does a bit of code-move and variable re-naming in preparation for adding
sql
variations of things.We also make sure to use the
session.Store
interface in the code-base instead of the raw DB pointer.Part of #966