This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-14
Channels
- # ai (4)
- # babashka (4)
- # beginners (46)
- # biff (5)
- # calva (12)
- # clojure (6)
- # clojure-austin (13)
- # clojure-dev (27)
- # clojure-europe (62)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-spec (2)
- # clojure-uk (12)
- # clojurescript (10)
- # cursive (3)
- # datahike (26)
- # datalevin (9)
- # datomic (7)
- # gratitude (4)
- # honeysql (9)
- # hyperfiddle (12)
- # instaparse (2)
- # lsp (65)
- # membrane (7)
- # missionary (2)
- # off-topic (8)
- # polylith (33)
- # portal (7)
- # quil (1)
- # re-frame (4)
- # reagent (18)
- # releases (3)
- # ring (3)
- # spacemacs (2)
- # specter (4)
Hey folks! Its me again 🙂
It is possible to call transaction functions with in datahike.http.server
? like we have in https://docs.datomic.com/pro/transactions/transaction-functions.html#writing
I know that we can do it when executing Datahike locally (https://github.com/macielti/carimbo/blob/71a3d75974437fff054a02c383908567b65dc8ba/src/carimbo/db/datahike/transaction.clj#L26-L52). But I need this transaction function to be executed on the Datahike server in order to guarantee consistency.
datahike server acts like a datomic transactor afaik. the level of consistency guarantee should be roughly the same as with datomic. I am not into the details though. https://github.com/replikativ/datahike/blob/main/http-server/datahike/http/server.clj#L164
I have the scenario where I have two API instances writing to the same Database. The flow consists in doing some validations on top of the data present on the database, so I have to apply the validation on top of an query result. After the validation result I persist the changes on the database.
The problem is that between the query and the persistence transactions, other instance can change the data.
ok, datomic has these kind of transactions in the sense of multiple operation consistency?
With Datahike I know that we can use :db.fn/call
to have a transaction function being executed with in a single transaction context.
Here is an example https://github.com/macielti/carimbo/blob/71a3d75974437fff054a02c383908567b65dc8ba/src/carimbo/db/datahike/transaction.clj#L45
But I can make it work only with the "local transactor" without using a remote peer
I think the consistency guarantee is more like this:
Every peer sees completed transactions as of a particular point in time, called a time basis. The time basis of transactions is a global ordering of transactions for a particular system. Peers always see all transactions up to their time basis, in order, with no gaps.
datahike (and datomic afaik as well) only can guarantee sequential or linearizable consistency
snapshot isolation is not achievable with this kind of distributed setup with a central transactor.
While using datahike.http.server
in order to establish one single writer, all transactions that arrive on Datahike Server should be executed in a serialized way, that is correct?
I found that Issue that is more related with what I am trying to achieve https://github.com/replikativ/datahike/issues/389 It is already possible to install a function on the Database in the context of an distributed setting with Datahike?
ok, probably @U1C36HC6N can help here
@U0686RN9X0W For now the best thing to do is to add the functions you need to the server jar. I know this is a bit inconvenient, but we haven't got to the point of supporting transacting functions like Datomic yet.
I am also not sure what the most convenient way for this is. In a sense having open source access to the server and just loading it in the jar gives you a lot more freedom.
I agree with you. I am going to try to make a PoC about adding the function directly on the server. Do you have some example?