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-07-02T05:57:39.448Z

Is it possible to make an atomic transaction consists of a d/q, some clojure computation, and a d/transact call? How do I ensure that no other thread can change the state of the database before I finish the final d/transact?

zhuxun2 2020-07-02T06:14:47.451500Z

Would something like this work?

(locking conn
  (let [res (d/q ...)]
    ...computation...
    (d/transact conn ...))

Björn Ebbinghaus 2020-07-02T15:10:41.452200Z

@zhuxun2 Have a look at the compare-and-swap function. https://docs.datomic.com/cloud/transactions/transaction-functions.html#db-cas

👍 2