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

Use LocalForage as storage adapter? #575

Closed
lgleim opened this issue Oct 8, 2016 · 6 comments
Closed

Use LocalForage as storage adapter? #575

lgleim opened this issue Oct 8, 2016 · 6 comments
Labels

Comments

@lgleim
Copy link

lgleim commented Oct 8, 2016

Hi, I'm looking into using Kinto + Kino.js for an offline first mobile application. I'm planning on using Ionic/Cordova for the project and have previously been playing around a lot with PouchDB. One issue that keeps coming up is storage limitations and the issue, that iOS does not support IndexedDB.
PouchDB solves this by choosing from various different storage backends depending on the environment. In order to circumvent the storage limits in Cordova deployments the Cordova SQLite storage plugin or Cordova SQLite Plugin 2 may be used.
I have previously also heard a lot about localForage, also developed by Mozilla, which allows to adaptively select a storage backend depending on the environment and for which a cordova sqlite storage driver exists.

Would it be possible to provide a storage adapter based on LocalForage or does it lack crucial features such as indexing?

@lgleim
Copy link
Author

lgleim commented Oct 8, 2016

This may be related to #16 (comment)

@lgleim lgleim changed the title Use LocalForage for storage adapter? Use LocalForage as storage adapter? Oct 8, 2016
@lgleim
Copy link
Author

lgleim commented Oct 9, 2016

After stumbling upon https://mail.mozilla.org/pipermail/kinto/2016-March/000094.html and https://mail.mozilla.org/pipermail/kinto/2016-March/000095.html I guess localForage is not really an option.
Alternatively I found the https://github.com/ABB-Austin/cordova-plugin-indexeddb-async plugin. This probably solves any remaining issue that might not be solved using the default innodb shim. The question that remains for me is how to deal with hitting the storage limits of various platforms. Any insights?

@leplatrem
Copy link
Contributor

Hi!

Thank you for your detailed feedback!

provide a storage adapter based on LocalForage

As you read on the ML, it is possible to write a LocalForage adapter. It won't support transaction though.

how to deal with hitting the storage limits of various platforms

Maybe implementing a WebSQL adapter — like PouchDB — would be a valid approach here.
But what is the order of size of your data?

@lgleim
Copy link
Author

lgleim commented Oct 10, 2016

The size of data (without attachements, which I plan to load on demand) is in the range of more then 5mb, potentially more then 50mb but nowhere near 500mb.
I am aware of the limitations with the query api however the same is true for PouchDB. I am not sure of couchbase lite solves this in a better way but since it is also based on sqlite internally, I do not expect much better performance either.

Instead of reimplementing with LocalForage I do think it is much easier to hack the cordova-plugin-indexeddb-async to always fallback to an sqlite-based backend (cf. hitachienergy/cordova-plugin-indexeddb-async#2).

@lgleim
Copy link
Author

lgleim commented Nov 7, 2016

I'm closing this for now. Feel free to reopen if it becomes relevant again.

@lgleim lgleim closed this as completed Nov 7, 2016
@agarwalkartik
Copy link

@lgleim Hey, I am also trying to solve a similar problem. Could you tell how did you finally overcome the memory limitations? Thanks!

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

No branches or pull requests

3 participants