datahike

https://datahike.io/, Join the conversation at https://discord.com/invite/kEBzMvb, history for this channel is available at https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/datahike
zhuxun2 2020-10-18T04:29:25.033500Z

Is it possible to atomically make a query and use its result to make a transaction, so that there would be no other transactions (made by other concurrent processes) in-between the query and the transaction?

timo 2020-10-19T09:29:45.035600Z

Hi @zhuxun2. Thanks for the questions! I am not aware of this functionality. Probably @konrad.kuehne or @whilo can answer regarding an implementation suggestion.

whilo 2020-10-19T17:01:12.036Z

@zhuxun2 You need to use transactor functions for that. We have inherited the convention from DataScript: [:db.fn/call f args] where f is a function reference and will take db as first argument. You can then run a query in there on the database if you need to.

👍 2
whilo 2020-10-19T17:01:54.036300Z

This is very flexible, but blocks other transactions for the duration of the call to this function (which is necessary for atomicity).

zhuxun2 2020-10-18T06:26:54.034800Z

Also, why is d/transact sync and d/transact! async? The opposite is what I would expect.

timo 2020-10-19T09:33:01.035800Z

transact calls transact! under the hood and therefore it is this way round. The transact!-function will not be part of the public api in the future, but it will still be available for usage. There will be an async api comparable to the datomic.client.api and we hope to finish this soon.