On Nov 4 2019, Amirouche Boubekki wrote:
Can I have some guidance on how to create bindings for sqlite lsm extensions?
sqlite lsm extension is similar to leveldb used in gerbil. But unlike gerbil bindings, I would like the db calls to not block other gambit threads [0].
[0] https://github.com/vyzo/gerbil/blob/master/src/std/db/_leveldb.scm
I was said on gitter to rely on some kind of socket to do that. But I am not sure how to proceed.
To get started I would like to have a single POSIX thread database side and the gambit main thread communicating via a pipe or something similar. Eventually, my program must not require multiple programs to be started ie. a single command, possibly with multiple POSIX processus or threads (prefered).
It will be nice if it is portable across OS.
Thanks in advance for your help!
I did something like this for chicken and would be happy to help it ported over to gambit.
Works so far with Linux/Android. And if we get the only bi-directional pipe there ported to Windows, it should be portable enough.
https://github.com/0-8-15/sqlite3pth
There is also an example how the sqlite thread can call back to Scheme to have the latter supply blocks of memory via sqlites VFS driver. (The example stores the whole DB in a string. ;-/ )
When porting, we might want to simplify the code a bit.
Best
/Jörg