-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature: Support for multiple "SQLiteClientTypes" (Storage Options) #2
Comments
Thank you so much for doing this! I'm currently travelling but will take a look as soon as I can. I totally support the idea behind the changes, will look at the code and will provide feedback. Thanks again! |
cool. No worries and no stress :-) |
Usually, I'm a big fan of having multiple client types so things are well decoupled so I would agree with you. |
cool i separated them with the last commit also adding your code guidelines |
Ok thank you for the update. Looking at this more carefully, here are a few high level elements:
Let me know what you think. |
I agree. With an object passed we are a lot more flexible to enhance that in the future and not rely on multiple separate parameters.
Agree. We should try to make that library as easy to use as possible. I can give it a try if you want with your suggestions or do you want to change it? |
I'll take a jab at it. |
What do you think of such a behaviour? #4 I made it very barebone just to understand if it would make sense. Will add all the other Client Types and will try to make it backwards compatible by keeping the parameters in SqliteClient and by instantiating by default the OpfsWorker Client. Let me know if as a developer, this API would suit you. Second, as a contributor, let me know if you think the structure would make sense to you. Thanks!! |
I checked out your branch and I love it! It makes a lot more sense for external useage that you just work with the sqliteClient and internally we have then an adapter that handles the communication depending on the type. Let me know if you want me to also do something or you want to finalize the missing clientTypes on your end. |
Great! I will update it for the remaining clients and will let you know! ETA, probably should have something done by early next week, will try sooner. |
I've made the modifications and published a test version at Meanwhile, my next steps are to add an automated test infrastructure and I also need to update the readme. |
Oops, yes absolutely, an oversight on my part. I moved the the promise above to ensure that when there's an answer from the worker, that we always have the promises saved but I moved the code above the creation of the message. I've published a new test version: I'm setting the test infrastructure in this project, I should be able to publish an official version next week. |
I've updated the code, setup the test infrastructure, I've updated the README.md and published a new version: Let me know how it works and if you have any other ideas! Thanks a lot for your time. |
Sorry for my late reply. It looks very good and works perfectly! i would suggest also updating the client-demo playground. |
Hi @etiennenoel,
first of all thanks a lot for this easy to use and awesome client library!
Since the deprecation of websql this is the backbone of our solution.
Unfortunately we currently are tackling some performance issues that occur during big data operations (see sqlite/sqlite-wasm#61). So we want to try using the OPFS SAH Approach (like mentioned in the issue) as well as for other scenarios maybe even the memory db approach.
As we really love your client library (very nice implementation, easy to use and understand) i would like to contribute to this project by allowing different Client Types:
I forked this sqlite-client repository and implemented these new client types. I tried to stick as much as possible to your coding conventions. But please feel free to change it or give critical feedback. For the creation of the various client types i introduced a SqliteClientFactory that would return the corresponding SQLiteClient instance. Also i wanted to be backwards compatible so you can continue using
new SqliteClient(filename, "c", webSqliteWorkerPath)
(would create the OPFS client type) so existing code should still work.In addition to this repository i also forked your https://github.com/neptune-software/sqlite-client-demo repository to play with the endresult of the new options.
Here some screenshots to give you an idea how it looks like:
Plain Memory DB running inside the main thread:
Plain Memory DB running inside the worker thread:
"Legacy Client" (instantiate the client with
new SqliteClient(filename, "c", webSqliteWorkerPath)
to be backwards compatible will create an OPFS client :"OPFS_SAH" client (instantiate the client with the new factory
Testing the implementation
Step1:
clone my fork and switch to the branch feature/differentClientTypes
https://github.com/neptune-software/sqlite-client/tree/feature/differentClientTypes
In the new cloned repo run
npm i
andnpm run package
andnpm link
(to get a local link to this repository on the machine)Step2:
clone the other forked repo and also switch to the branch feature/differentClientTypes
https://github.com/neptune-software/sqlite-client-demo/tree/feature/differentClientTypes
run
cd examples/vanilla-js
run
npm i
run
npm link @magieno/sqlite-client
(that will use the local version of the sqlite-client repository)run
npm run build
run
npm run start:server
open the browser with http://localhost:3000/
The text was updated successfully, but these errors were encountered: