What’s the recommended way to use in-memory databases - for automated tests - via the Datomic Client API?
Is that something I could/should do with
So far I was using the Peer API for that purpose, but if I want to transition to using the Client API, then I can’t use that approach anymore, can I?
I’m aware of the https://github.com/ComputeSoftware/datomic-client-memdb library, which has been deprecated in favour of
dev-local recently, but I don’t see how
dev-local serves the in-memory use-case.
According to https://docs.datomic.com/on-prem/peer-server.html, we can start a peer-server, which exposes an in-memory db, but it doesn’t allow my automated test suite to isolate my tests into different, independent in-memory DBs.
I also haven’t found any official way to directly start a temporary peer-server from my application’s process, without shelling out.
I did look into what happens when I
bin/run -m datomic.peer-server ..., so I could start a peer-server, but I have no idea how to shut it down.
I’ve added these to
CURRENT is a link to
then I could do the following:
;; Start a Peer Server for convenience
;; Based on
;; bin/run -m peer-server -h localhost -p 8998 \
;; -a myaccesskey,mysecret -d hello,datomic:mem://hello
(require '[datomic.peer-server :as peer-server]
'[clojure.tools.cli :as cli])
(-> ["-h" "localhost"
(datomic.peer-server/create (:options peer-server-config)))