Replies: 10 comments 18 replies
|
Some additional context about different storage options for wasm: https://rxdb.info/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm.html |
|
LadybugDB/ladybug-wasm#4 has been merged. It should be in tonight's nightly build. Please try it out and let us know how it works for you. |
|
Hi Arun, thanks for merging the OPFS PR (#4 in ladybug-wasm) so quickly! I'm trying to use the new mountOpfs() API in my project, but the current npm release (@lbug/lbug-wasm@0.13.1) doesn't include it yet. I checked npm view @lbug/lbug-wasm dist-tags and only see { latest: '0.13.1' } — no nightly tag. Could you let me know: What's the exact npm install command to get the nightly build with OPFS support? |
|
Thanks for the new @ladybugdb/wasm-core package! I installed the latest nightly (0.15.3-dev.1) and confirmed the mountOpfs() API is available on the FS class. However, calling fs.mountOpfs('/persist') returns: Thanks |
|
I am using Claude as well. Claude confirmed the binary does contain WASMFS (wasmfs_create_memory_backend, NodeBackend), but the OPFS backend is missing — there are no opfs_backend or wasmfs_create_opfs_backend symbols in the .wasm binary. This explains why FS.filesystems.OPFS is undefined at runtime. It looks like the build uses -sWASMFS but not -sWASMFS_OPFS — could you check the CMakeLists.txt? Thanks for your patience. |
|
OPFS mount fails with WASMFS build — JS wrapper uses legacy FS API I built LadybugDB WASM from main (post PR #330 merge) and tested OPFS mounting. Here's what I found: Single-threaded build: The -lopfs.js flag is linked, but wasmfsOPFSCreateAsyncAccessHandle and other OPFS symbols end up in missingLibrarySymbols. OPFS requires pthreads to function. Multi-threaded build (with -pthread): The OPFS backend is compiled in ("OPFS" appears in unexportedSymbols), but at runtime FSMountOpfs() fails with: Cannot read properties of undefined (reading 'OPFS') The multi-threaded build also exhausts the thread pool (-sPTHREAD_POOL_SIZE=8) when loaded through the single-worker architecture. Environment: Emscripten 5.0.4, Windows, Chrome, built from main @ commit post-PR #330. Would appreciate guidance on the right WASMFS API to mount OPFS, or if this needs a fix in the ladybug-wasm JS wrapper code. |
|
@kbatchu created a couple of PRs and kicked off the build https://github.com/LadybugDB/ladybug/actions/runs/23826241794 If this doesn't we'll have to revisit this at a later point, since there are other pressing priorities. |
|
Thanks for the quick turnaround on the OPFS fix in v0.15.4-dev.1! The JS wrapper rewrite is correct — FSMountOpfs now uses the WasmFS C API. The mount succeeds, but database file creation crashes: Unexpected child type // In lbug_wasm_worker.js (v0.15.4-dev.1) In Emscripten's source (src/lib/libwasmfs_opfs.js), this function is guarded by #if PTHREADS: $wasmfsOPFSProxyFinish: (ctx) => { Fix: Ensure -sPTHREADS (or -pthread) is set when the Emscripten linker processes -lopfs.js. This might mean the flag needs to be in the link step that pulls in libwasmfs_opfs.js, not just the compile step. Reproduction: await lbug.init(); |
|
@kbatchu everything working ok here? Thinking about 0.15.4 next week. |
|
https://ladybugdb.github.io/wasm-shell/ is using opfs now. |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Are there any concrete plans for implementing OPFS support for LadybugDB Wasm (like DuckDB)?
Integrating OPFS support into LadybugDB would be a game-changer for WebAI, especially when paired with DuckDB for a complete local-first data stack.
Thanks
Kiran
All reactions