Fork me on GitHub
#onyx
<
2019-08-06
>
Quest05:08:25

In the latest version of [com.datomic/datomic-pro "0.9.5951"], the namespace com.datomic:client-api:jar:0.8.35:compile is included. I'd like to use the Peer API, but this namespace inclusion is tripping up the automatic :peer vs :cloud vs :client discovery mechanism in onyx.datomic.api --

(defn- _datomic-lib-type []
  (if (find-ns 'datomic.client.api)
    (try (require '[datomic.client.impl.cloud])
         :cloud
         (catch FileNotFoundException _ :client))
    :peer))

(def datomic-lib-type (memoize _datomic-lib-type))
The oldest release I'm allowed to go back to in http://my.datomic.com is "0.9.5783", which still has com.datomic:client-api:jar:0.8.7. I found two ways around this:
;; A) project.clj
[com.datomic/datomic-pro "0.9.5951"
                  :exclusions [[com.datomic/client-api]]]

;; B) shim in your (-main) namespace
;;      UPDATE: further testing reveals that this shim doesn't work. use :exclusions
(alter-var-root #'onyx.datomic.api/datomic-lib-type (constantly :peer))
As far as a permanent solution: I don't believe the client-api includes namespace datomic.api, so might fix it to check for that namespace first. The last version of the client API I could find to test with is [com.datomic/client-pro "0.8.28"], which definitely doesn't have that namespace. If preferred, I can open a PR with the fix, but I wanted to check with this channel first to confirm that this is actually what's going on here.

lmergen06:08:00

@quest I would be happy to accept any PR that fixes this. I think the datomic plugin hasn’t been updated in some time, so your analysis makes sense.

👍 4
Quest17:08:29

@lmergen Opened https://github.com/onyx-platform/onyx-datomic/pull/37 Note -- this is likely to break anyone who was including both Datomic Pro & Datomic Client in the same uberjar. The README.md warns against this, but it's still possible to do

lmergen17:08:41

great! I’ll take a look at it next weekend