Skip to content
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

sqldb+invoices: turn sqldb into a go module #8603

Merged
merged 5 commits into from
Apr 10, 2024

Conversation

bhandras
Copy link
Collaborator

As a preliminary change before we unify the transaction retry between sqldb and kvdb we extract the SQL invoice store implementation into the invoices package and make sqldb a versioned package.

Copy link

coderabbitai bot commented Mar 29, 2024

Walkthrough

The recent updates encompass modernizing dependencies and restructuring the invoice management system. The grpc library upgrade enhances communication capabilities. The transition from sqldb to the new invoices module impacts implementation and testing. Utility functions are renamed for clarity, aligning with the evolving project architecture.

Changes

File(s) Change Summary
.github/workflows/main.yml Updated google.golang.org/grpc to v1.59.0; github.com/golang/protobuf remains at v1.5.3.
config_builder.go, .../invoices_test.go, .../invoiceregistry_test.go Switched from sqldb.NewInvoiceStore to invoices.NewSQLStore/invpkg.NewSQLStore for InvoiceDB. Updated function signatures.
docs/release-notes/release-notes-0.18.0.md Detailed sqldb transformation to invoices in lnd version 0.18.0, referenced in PR 8603.
invoices/sql_store.go Renamed and reorganized packages; updated types and interfaces from sqldb to invoices.
sqldb/sqlutils.go Renamed functions to SQLInt32, SQLInt64, SQLStr, and SQLTime for handling nullable field conversions.

🐇✨
In the realm of code, where changes bound,
A rabbit hopped, leaving trails profound.
From sqldb to invoices, a leap so bold,
With grpc updated, a story told.
Through tests and docs, the changes unfold.
🌟📜🛠


Recent Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6377f98 and c804894.
Files ignored due to path filters (4)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum
  • sqldb/go.mod is excluded by !**/*.mod
  • sqldb/go.sum is excluded by !**/*.sum
Files selected for processing (7)
  • .github/workflows/main.yml (1 hunks)
  • config_builder.go (1 hunks)
  • docs/release-notes/release-notes-0.18.0.md (1 hunks)
  • invoices/invoiceregistry_test.go (1 hunks)
  • invoices/invoices_test.go (1 hunks)
  • invoices/sql_store.go (55 hunks)
  • sqldb/sqlutils.go (2 hunks)
Files skipped from review as they are similar to previous changes (6)
  • .github/workflows/main.yml
  • config_builder.go
  • invoices/invoiceregistry_test.go
  • invoices/invoices_test.go
  • invoices/sql_store.go
  • sqldb/sqlutils.go
Additional comments not posted (2)
docs/release-notes/release-notes-0.18.0.md (2)

421-423: The documentation accurately reflects the significant change of turning sqldb into a separate Go module. This is a crucial update for users and developers, ensuring clarity on the structural changes within the project.


418-426: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-453]

Consider reviewing the overall structure and formatting of the document to ensure consistency and readability. Specifically, ensure that headings are correctly used and that there's a clear separation between different types of updates. This will enhance the document's usability for readers.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

sqldb/sqlutils.go Show resolved Hide resolved
type InvoiceQueries interface { //nolint:interfacebloat
// SQLInvoiceQueries is an interface that defines the set of operations that can
// be executed against the invoice SQL database.
type SQLInvoiceQueries interface { //nolint:interfacebloat
Copy link
Member

@Roasbeef Roasbeef Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should instead live in channeldb?

This way then the invoice package declares the interface, but doesn't necessarily implement it itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My simple reasoning for also moving the interface here was that the SQL InvoiceDB implementation depends on this interface hence it's maybe best kept along with the implementation itself. If we move though perhaps sqldb might be a better choice?

@saubyk saubyk requested a review from guggero April 4, 2024 15:18
@saubyk saubyk added the database Related to the database/storage of LND label Apr 4, 2024
@saubyk saubyk added this to the v0.18.0 milestone Apr 4, 2024
@bhandras bhandras changed the title [wip]: turn sqldb into a package sqldb+invoices: turn sqldb into a package Apr 4, 2024
@bhandras bhandras marked this pull request as ready for review April 4, 2024 15:37
@Chinwendu20
Copy link
Contributor

Is there a reason, why this has to be a versioned package? The PR description does not make that clear. Thanks.

@bhandras
Copy link
Collaborator Author

bhandras commented Apr 5, 2024

Is there a reason, why this has to be a versioned package? The PR description does not make that clear. Thanks.

In order to reuse the same retry code in both kvdb and sqldb we need to makesqldb a package (to avoid kvdb depending on lnd). See follow up PR.

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

go.mod Show resolved Hide resolved
docs/release-notes/release-notes-0.18.0.md Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

config_builder.go Show resolved Hide resolved
docs/release-notes/release-notes-0.18.0.md Outdated Show resolved Hide resolved
invoices/invoiceregistry_test.go Show resolved Hide resolved
@bhandras bhandras changed the title sqldb+invoices: turn sqldb into a package sqldb+invoices: turn sqldb into a go module Apr 9, 2024
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦚

@guggero guggero merged commit 976f5d2 into lightningnetwork:master Apr 10, 2024
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Related to the database/storage of LND
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants