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

Support Sqlite storage type #168

Open
Half-Shot opened this issue Nov 19, 2024 · 9 comments
Open

Support Sqlite storage type #168

Half-Shot opened this issue Nov 19, 2024 · 9 comments

Comments

@Half-Shot
Copy link

As part of my quest to look at moving the bots and bridges away from the nodejs binding layer, I'd like to talk about potentially enabling SQLite support for this binding layer. In the NodeJS project, we do https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/blob/main/src/machine.rs#L113-L155.

@richvdh
Copy link
Member

richvdh commented Nov 19, 2024

I guess this would require the use of Sqlite's support for wasm. Not sure what would be involved in wiring that up.

@Hywan
Copy link
Member

Hywan commented Nov 19, 2024

I don't think we should use Sqlite compiled as Wasm. Instead, we should expose SQLite API via Wasm imports, and use SQLite compiled as a NodeJS bindings from C. It would be probably much faster and easier.

@richvdh
Copy link
Member

richvdh commented Nov 19, 2024

Instead, we should expose SQLite API via Wasm imports

You mean, build our own wrapper around the sqlite API, and somehow thread that through to the rust layer? That sounds like a lot of work.

@Hywan
Copy link
Member

Hywan commented Nov 20, 2024

It's probably a lot of work because the Matrix Rust SDK expects rusqlite API entirely. I wonder how it compiles to wasm32-unknown-unknown and how linking is done. We should try.

It's probably more work than maintaining matrix-rust-sdk-crypto-nodejs if you ask me 😛.

@Half-Shot
Copy link
Author

Well, the issue exists because nobody really maintains matrix-rust-sdk-crypto-nodejs right now and that leads to the integrations lagging behind the clients, causing people to pull out their hair.

But if doing the work to make our integrations support the maintained wasm bindings is more work than just having someone maintain the nodejs bindings, then that's fine too. The current situation is untenable though.

@richvdh
Copy link
Member

richvdh commented Dec 3, 2024

Other than the overhead of maintaining two sets of bindings, another advantage of supporting sqlite through the wasm bindings rather than maintaining matrix-rust-sdk-crypto-nodejs would be that you could also use matrix-js-sdk for nodejs projects.

@richvdh
Copy link
Member

richvdh commented Dec 5, 2024

Yet another option here might be to use https://www.npmjs.com/package/indexeddb, which implements indexeddb backed by the local filesystem. That said, its 35 weekly downloads aren't entirely reassuring.

@Half-Shot
Copy link
Author

image

it's vintage 🍷

@richvdh
Copy link
Member

richvdh commented Dec 5, 2024

In fairness 0.0.1 was only published 4 years ago. I guess if it works, don't change it?

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

No branches or pull requests

3 participants