Skip to content

Conversation

@jackd
Copy link
Contributor

@jackd jackd commented Nov 25, 2024

As requests in #265, I couldn't get any web tests working so I wouldn't at all be surprised if they're broken... but might be best to seek feedback on the overall design before getting too finicky there.

Copy link
Owner

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get any web tests working so I wouldn't at all be surprised if they're broken

I suppose due to the build setup, right? Let me know if there's something I can do to help (you can also download the sqlite3.wasm from a recent release into example/web/sqlite3.wasm to run tests, but that bundle won't expose the new commit hook methods).

The changes in general look good to me though, so I'm also happy to test the web-specific bits here.

///
/// Updates are only sent across worker channels while a subscription to this
/// stream is active.
Stream<void> get rollbacks;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear how we would best translate this feature to sqlite3_web. We can't provide commit hooks that would be able to revert a transaction because that would require an async roundtrip between the worker and the main page.

We could provide a "read-only" Stream<void> get commits stream that installs a () => true filter reporting events if necessary. But I'm also fine with not exposing this in sqlite3_web until it is needed (sqlite3_web also provides the option of compiling custom workers where users have full control over the database, so they could install commit / rollback filters on the database if they need to).

@jackd
Copy link
Contributor Author

jackd commented Jan 2, 2025

Terribly sorry, work got hectic for a bit, then Christmas... and now I'm heading away for a few weeks. Just popping by to say this'll be near the top of the list of things I want to get onto when I'm back :)

@jackd
Copy link
Contributor Author

jackd commented Jan 18, 2025

@simolus3 I've reverted the breaking name change and added a commits stream that should be compatible with a custom commitFilter. I believe the issue I'm having running web tests is down to me being on WSL. I'm not going to pretend to understand what's going on with the wasm code, just tried to make it look similar to updates... but that's obviously not working.

@simolus3
Copy link
Owner

Thanks for following up on this! The web tests will require a new version of the WebAssembly module. We strip functions that we aren't calling in Dart out of the module to reduce its size. So every time that we add new functions possibly called in Dart, we need to preserve backwards compatibility with older modules that don't have those functions.

The setup to compile the modules is quite complex and I have no idea on how it might be done on Windows. I'll compile a module that has those functions, that was we can get the web part ready.

Copy link
Owner

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I've moved some bits around to re-use code between the different types of streams.

Thank you for your contribution!

@simolus3 simolus3 merged commit a290e87 into simolus3:main Jan 18, 2025
14 checks passed
@jackd jackd deleted the transaction-hooks branch January 18, 2025 22:59
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

Successfully merging this pull request may close these issues.

2 participants