simolus3 / hrana.dart

Access to libsql servers from Dart.
BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

Embedded replica support #3

Open leccles1 opened 3 months ago

leccles1 commented 3 months ago

Hey Simon,

Incredible to see this package pop up, I'd spent the last couple weeks attempting to write my own Hrana client. I previously reached out on the sqlite3 package with regards to libsql support .

I was wondering if embedded replica support is on the horizon at all - I know the sync functionality isn't part of the Hrana specification so apologies if this question is out of the scope/relevance of this library

Thanks!

simolus3 commented 3 months ago

This is not really in scope for either package:sqlite3 or package:hrana - re-implementing the synchronization mechanism in Dart would just be very complex.

I think it would be interesting to explore a package:libsql that is mostly compatible with an async variant of package:sqlite3 (using the same result types). Given that libsql is only really accessible from Rust when one wants to benefit from native async support, we'd necessarily have to write a custom wrapper to access it from dart:ffi (awaiting stuff in rust and then using Dart send ports to communicate results). That's possible, but super annoying without native assets since it's a lot of work to ship precompiled native libraries at the moment.

If I find some time I can work on a prototype earlier, but I think this depends on native assets (https://github.com/dart-lang/sdk/issues/50565) to be distributable.