asami

Dave Mays 2023-11-10T17:02:43.624249Z

Looking around at the limited datalog based client-side databases and came across Asami, and was wondering if it offers time-travel abilities similar to XTDB or is a more traditional mutable database?

quoll 2023-11-10T18:55:39.717249Z

Exactly the same as XTDB

quoll 2023-11-10T18:57:22.726059Z

The same functions as Datomic: • as-ofas-of-tsincesince-t https://github.com/quoll/asami/wiki/7.-Asami-API#as-of

wikipunk 2023-11-10T19:26:12.389849Z

Does this mean that I could load a local asami database in CLJS with IndexedDB and use as-of/since queries in the UI with client data?

Dave Mays 2023-11-10T19:51:01.110449Z

Awesome thanks!

quoll 2023-11-10T20:06:00.069649Z

Not yet. The query namespace needs to be reimplemented to work with Javascript futures. My plan was to do this with the Promesa library, but I haven’t made any moves on this yet

👍 1
quoll 2023-11-10T20:11:32.268539Z

IndexedDB was originally supposed to have a synchronous API, but then Mozilla decided to abandon it, because, “No one will want it”

quoll 2023-11-10T20:11:50.804519Z

I screamed. Literally. I was yelling, “I want it!!!”

❤️ 1
quoll 2023-11-10T20:12:07.438229Z

But I was just yelling at my computer. No one heard me

😆 1
Dave Mays 2023-11-10T20:03:41.528749Z

Asami does support durable storage correct? I somehow ended up looking at this feature flag that made mention of "once it gets durable storage". Sorry for the dumb questions, Asami looks pretty exciting and I'm just sorting out where it's at before diving in: https://github.com/babashka/babashka/issues/640

quoll 2023-11-10T20:06:15.260729Z

Yes, it supports durable storage

quoll 2023-11-10T20:06:54.010089Z

You create a connection with a URI that starts with asami:local:

Dave Mays 2023-11-10T20:20:54.702819Z

Thanks! (And that is that both the JS and JVM versions support durable storage correct, not just JVM? I wasn't sure if the https://clojurians.slack.com/archives/C018H97E02D/p1699635763624249 meant no persistence on JS at all - or just that only a subset of the commands work. I don't think I'd need the time travel client side so much - that seems better suited to a server side thing anyway, but would want to store persistent data client side at least.) Anyway I'm excited about Asami and am just worried it sounds too good to be true haha.

Dave Mays 2023-12-19T11:49:41.262039Z

Curios if changing asami.query to Promesa is on the roadmap? (No pressure! Just curious. And wish I had the skills to help haha.)

quoll 2023-12-19T12:16:51.963129Z

Sort of. It needs to be duplicated, and the new namespace wrapped in Promesa. Kind of like how Node.js has both synch and asynch versions of file io

quoll 2023-11-10T21:26:06.885319Z

Unfortunately, the JS version doesn’t support persistence. This needs IndexDB, which requires an aync API. I could transact that way, but I can’t query with it until the asami.query namespace gets re-implemented to use Promesa.

quoll 2023-11-10T21:26:26.189019Z

If it’s not a large DB, then the solution for now has been to save it.

quoll 2023-11-10T21:26:59.185939Z

( "save-name" (prn-str (asami.core/export-data db)))

quoll 2023-11-10T21:41:59.284179Z

This lets you save your work for next time. When you come back, you can say: (asami.core/import-data ( "save-name"))