Datomic 1.0.6527 extended the datomic.Connection interface
with an additional optional parameter on the transact and transactAsync
methods to support the :io-context argument.
datomic.api/transactAsync wrapper calls these new interface methods
even if there are no extra arguments in the clojure call,
which means Datomock doesn't work with Datomic 1.0.6527.
This commit wraps the MockConnection defrecord form in a defmacro which
uses reflection to determine if datomic.Connection has the extra interface
method and conditionally emits an implementation if it does.
We must use a macro and not simply extend-type MockConnection because
datomic.Connection is a true Java interface, not a Clojure protocol.
The implementation ignores extra io-context arguments and just calls
the existing method.
This is enough to get Datomock working, but the transact result will never
have an :io-stats key. This is acceptable because memory db io-stats
are not useful anyway.
I tested this locally and left in the latest-datomic-pro and run-test.sh changes
I used to do so; but you need a recent datomic license to get access
to this version of datomic. These datomic.Connection changes are not
available on any version of datomic-free.
I also bumped the latest-datomic to the latest datomic-free version
and fixed some broken links in the changelog.
Datomic 1.0.6527 extended the datomic.Connection interface with an additional optional parameter on the transact and transactAsync methods to support the :io-context argument.
datomic.api/transactAsync wrapper calls these new interface methods even if there are no extra arguments in the clojure call, which means Datomock doesn't work with Datomic 1.0.6527.
This commit wraps the MockConnection defrecord form in a defmacro which uses reflection to determine if datomic.Connection has the extra interface method and conditionally emits an implementation if it does. We must use a macro and not simply extend-type MockConnection because datomic.Connection is a true Java interface, not a Clojure protocol.
The implementation ignores extra io-context arguments and just calls the existing method. This is enough to get Datomock working, but the transact result will never have an :io-stats key. This is acceptable because memory db io-stats are not useful anyway.
I tested this locally and left in the latest-datomic-pro and run-test.sh changes I used to do so; but you need a recent datomic license to get access to this version of datomic. These datomic.Connection changes are not available on any version of datomic-free.
I also bumped the latest-datomic to the latest datomic-free version and fixed some broken links in the changelog.