This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-02
Channels
- # announcements (3)
- # asami (29)
- # babashka (62)
- # beginners (131)
- # biff (7)
- # calva (31)
- # cider (5)
- # clerk (14)
- # clj-kondo (3)
- # cljsrn (12)
- # clojars (18)
- # clojure (72)
- # clojure-austin (17)
- # clojure-dev (6)
- # clojure-europe (31)
- # clojure-indonesia (1)
- # clojure-nl (1)
- # clojure-norway (18)
- # clojure-sweden (11)
- # clojure-uk (6)
- # clr (47)
- # conjure (42)
- # cursive (88)
- # datalevin (2)
- # datomic (25)
- # emacs (42)
- # exercism (1)
- # fulcro (10)
- # funcool (8)
- # gratitude (2)
- # honeysql (16)
- # introduce-yourself (5)
- # jobs-discuss (26)
- # leiningen (5)
- # lsp (31)
- # malli (21)
- # matcher-combinators (14)
- # missionary (2)
- # nbb (1)
- # off-topic (40)
- # pathom (38)
- # portal (2)
- # re-frame (7)
- # reagent (18)
- # reitit (1)
- # releases (5)
- # shadow-cljs (62)
- # sql (12)
- # testing (4)
- # xtdb (37)
@quoll I have noticed that d/transact
(with :update-fn
leveraging graph/graph-transact
) returns a new db version even if no changes have been transacted. This is not ideal because it makes it harder to verify whether any changes were performed or not. I can always use a volatile! and set it within the update-fn to communicate this but it feels “dirty”. What was the reason for updating the version even if the graph is the very same instance?
It was an explicit choice though. It’s possible to change this, but until now I have been comfortable with the reasoning I went with
Ok! Is there some simple way to detect whether anything has changed? Or is vreset!-ing a volatile insude the update-fn to communicate that to the caller the best way?
@holyjak OK… I just looked at all the code for the in-memory implementation (I did not look at the tests yet, nor did I check the implementation of the durable store).
If nothing was changed, then the result of a transaction should include a tx-data
field that is an empty seq
I thought about that but with a custom update-fn, no tx-data is returned.
I remember from your impl that you use volatile inside the update-fn to communicate back the stuff that is then returned in tx-data
(I only looked at the duable impl)
With the in-memory version anyway (and I think it’s the same), add an extra arg tot he call to graph-transact
: (volatile! [[] [] {}])
Ah, I saw the generated
argument but did not know what it was/did
Well, using this is an improvement - instead of modifying my own volatile!, I can use this one and be 100% sure that if it is empty then no change was done
If you look at the in-memory storage, you can see that it adds to retracts
and asserts
whenever anything is added or removed. Then these go into the volatile at the end:
https://github.com/quoll/asami/blob/1194563a030dc1adb596bcb788e4ee798bb39e82/src/asami/common_index.cljc#L24-L41
Past Paula often surprises me how she did the right thing when I wasn’t expecting her to. I am often grateful to her