It stands to reason that all transactions submitted (via datomic.api/transact
) and transacted (demonstrated via deref
) on a single peer would be included in all subsequent DB values obtained (via datomic.api/db
) on the Peer, but I'd love to know if that is guaranteed.
For example, if a test transacts data resulting in some T, and the rest of the test only cares that it runs against a DB value with T' >= T, is the following sufficient?:
@(datomic.api/transact conn tx) ; T
(let [db' (datomic.api/db conn)] ; T' >= T?
,,(do-something-with db')
Or is it strictly necessary to do:
(let [{:keys [db-after]} @(datomic.api/transact conn tx)]
,,(do-something-with db-after))
I know that the former tends to work, but I'm particularly interested if it's guaranteed to work.
I do understand that additional transactions from other threads / clients / etc. may have been included in db'
in the first scenario, so I realize the code is not equivalent in the general case. I'm only concerned about tx
having been transacted and included in the fetched db'
value.
Thank you!
(Apologies for formatting—I can't seem to convince this thing to care about my whitespace.)