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

Drop the in-memory database #613

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crodas
Copy link
Contributor

@crodas crodas commented Feb 23, 2025

Description

Fixes #607

This PR drops the implementation of in-memory database traits.

They are useful for testing purposes since the tests should test our codebase and assume the database works as expected (although a follow-up PR should write a sanity test suite for all database trait implementors).

As complexity is worth with database requirements to simplify complexity and add more robustness, for instance, with the following plans to add support for transactions or buffered writes, it would become more complex and time-consuming to support a correct database trait. This PR drops the implementation and replaces it with a SQLite memory instance


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

@crodas crodas force-pushed the feature/in-memory-db-sqlite branch from 9f714c6 to e7c3161 Compare February 23, 2025 04:39
Fixes cashubtc#607

This PR drops the implementation of in-memory database traits.

They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).

As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance
@crodas crodas force-pushed the feature/in-memory-db-sqlite branch from e7c3161 to 1930988 Compare February 23, 2025 06:20
@@ -20,7 +20,7 @@ rand = "0.8.5"
bip39 = { version = "2.0", features = ["rand"] }
anyhow = "1"
cashu = { path = "../cashu", features = ["mint", "wallet"] }
cdk = { path = "../cdk", features = ["mint", "wallet"] }
cdk = { path = "../cdk", features = ["mint", "wallet", "memory_database"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think it makes sense to add a memory db feature? Or should we just keep it as you have to bring in one of the cdk-sqlite or redb crates. And whether the sqlite is in mem or not can be handled by that crate. The feature maybe is a little similar for the end user but it creates two para dimes to accomplish the same thing one enabling the feature one bringing in the create.

Related: #511

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR has already undergone several iterations, but in its final version, which has just two functions per DB implementation, I believe that moving those functions from cdk to the SQLite crate makes sense.

Regarding #511, that does make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Memory database
2 participants