-
Notifications
You must be signed in to change notification settings - Fork 124
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
Web-capable Box API; based on IndexedDB #185
Comments
Yes, that shouldn't be too hard to do. I've already thought about this a little a while back and how I've seen this done in Dart is:
|
Also a thing to consider: not all browsers support IndexedDB, so if we wanted to have a complete solution, we'll need (to do) something like https://pub.dev/packages/idb_shim |
With like 97% of browsers supporting it we might be fine. Another thing to consider: if we'd have the lower-level implemented in Type-/JavaScript, we could use that for plain web apps too. That probably makes sense when we start adding more features like queries. |
Since this would require API changes (switch to interfaces) we should try to prepare those prior to 1.0, with the actual implementation coming later as a minor release. |
notes:
|
|
As long as you write TypeScript just like JS, e.g. no generics (Box) |
Turns out we don't actually need interfaces, just two variants of the concrete classes - the conditional import ensures the right implementation is imported. See #189 |
While we might not need interfaces (at least for now), it might be that we want them for the flexibility. Just tossing in that thought; more a discussion for later, I guess. |
I think that conditional is a compile-time thingy, it's not polymorphic dynamic binding. |
Any news? |
While we'll keep the first steps quite simple, we should also discuss the target architecture we'll want in the end. To start this, I could imagine the following layers from top to bottom (let me know you see are technical show stoppers):
While this is a more "heavy" approach, it would allow us to use the entire existing ObjectBox functionality (including Sync). |
SQLite solution looks more reliable than IndexDB. |
Do you have a reference for that? I don't know |
Regarding moor: following their docs I landed here: https://github.com/sql-js/sql.js/ which "doesn't persist the changes made to the database", which would not exactly make a good K/V storage for us… |
|
Correct, but sql-js isn't, being in-memory it's not durable. |
@vaind |
@zs-dima I'm sorry, that does not help. I think you lack some background on the proposed stack and the purpose of the lowest (HAL/storage) layer. sql.js does not look like a fit becuse it offers SQL without storage, which is the exact opposite of what we are looking for. We rather need storage without SQL. 🙂 |
Or, no storage and NoSQL 🙃 Seriously, the idea of being in-memory only might become interesting, at least as an intermediate solution: we could use a native in-memory K/V. But not sure if that is really less work. |
(Responding here where the architecture discussion takes place.) That looks like a good approach if we could get the ObjectBox core compiled with Emscripten. In that case, no JS/TS wrapper would be necessary at all. @greenrobot do you think it makes sense to try this approach (compile the core with Emscripten)? |
@greenrobot did you check on the #190 (comment) and #185 (comment) ? what do you think? |
My understanding a few months back was that ObjectBox cannot run in WebAssembly unmodified due to missing mmap functionality in wasm. If people are willing to investigate more, I'd suggest to create another issue that's just about wasm. |
I need migrate my App's local db and look like ObjectBox fit perfectly but my app require web support :( Any previews for this feature? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Curious as to what's the state of this? Or should one create an interface/adapter themselves and use something else for storage in the web? |
A quick update on this: we are currently working on an alternative lower layer for the database. While this is not directly related solution this issue, it would fit the use case and together with wasm, we might make it work for Dart/Flutter too. This won't use IndexedDB but plain files. Don't expect anything soon yet, however... |
This comment was marked as off-topic.
This comment was marked as off-topic.
No have a way to use the objectbox library as a memory DB? If I recall good Isar v4 already do something like that. |
To support the Flutter Web platform, we need an alternative to native libraries, as wasm does not seem to cover everything the native libs do; e.g. "proper" file APIs.
To provide a minimal valuable implementation, implement the Box API using IndexedDB (and FlatBuffers similar to how we use it in the native side). No relations, indexes etc.
Once that works, open a ticket to do simple queries next.
The text was updated successfully, but these errors were encountered: