matrix-org / matrix-rust-sdk-crypto-wasm

Apache License 2.0
13 stars 7 forks source link

Support Sqlite storage type #168

Open Half-Shot opened 3 days ago

Half-Shot commented 3 days ago

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 commented 3 days ago

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

Hywan commented 3 days ago

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 commented 2 days ago

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 commented 2 days ago

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 😛.