This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-04
Channels
- # adventofcode (161)
- # asami (2)
- # babashka (56)
- # beginners (128)
- # calva (57)
- # cider (10)
- # circleci (1)
- # clj-kondo (4)
- # clojure (13)
- # clojure-europe (44)
- # clojure-france (32)
- # clojure-italy (3)
- # clojure-nl (18)
- # clojure-spec (7)
- # clojure-uk (26)
- # clojurescript (18)
- # code-reviews (15)
- # community-development (7)
- # conjure (5)
- # cryogen (8)
- # cursive (31)
- # datomic (18)
- # emacs (8)
- # events (4)
- # figwheel-main (7)
- # fulcro (42)
- # juxt (3)
- # kaocha (58)
- # lambdaisland (1)
- # malli (1)
- # minimallist (1)
- # pathom (11)
- # pedestal (9)
- # re-frame (28)
- # reagent (20)
- # reclojure (4)
- # releases (1)
- # reveal (23)
- # schema (2)
- # shadow-cljs (7)
- # test-check (67)
- # xtdb (23)
Hi all! I'm swapping out on-disk storage with dev-local for an in-memory database (I don't need durability for CI/tests) and I've followed the docs here by adding :storage-dir :mem
to my client config…
https://docs.datomic.com/cloud/dev-local.html#memdb
That call is blowing up with this trace however:
1. Caused by java.lang.IllegalArgumentException
No implementation of method: :as-file of protocol:
#' found for class: clojure.lang.Keyword
core_deftype.clj: 583 clojure.core/-cache-protocol-fn
io.clj: 35
io.clj: 424
io.clj: 418
impl.clj: 331 datomic.dev-local.impl/require-storage-dir!
impl.clj: 328 datomic.dev-local.impl/require-storage-dir!
impl.clj: 340 datomic.dev-local.impl/create-client
impl.clj: 337 datomic.dev-local.impl/create-client
impl.clj: 373 datomic.dev-local.impl.DevLocal/fn
Atom.java: 37 clojure.lang.Atom/swap
core.clj: 2352 clojure.core/swap!
core.clj: 2345 clojure.core/swap!
impl.clj: 361 datomic.dev-local.impl.DevLocal/_impl_configure_system
impl.clj: 433 datomic.dev-local.impl/ensure-client
impl.clj: 423 datomic.dev-local.impl/ensure-client
Var.java: 384 clojure.lang.Var/invoke
impl.clj: 24 datomic.client.api.impl/dynarun
impl.clj: 21 datomic.client.api.impl/dynarun
impl.clj: 31 datomic.client.api.impl/dynacall
impl.clj: 28 datomic.client.api.impl/dynacall
api.clj: 100 datomic.client.api/client
api.clj: 48 datomic.client.api/client
That looks to me like I should have a :storage-dir
that's resolvable to a file but the docs say this keyword :mem
is supported. Given it's gone 5pm here and it's been a long week I'm guessing this is me missing something obvious but it's not jumping out at me…
I'll try jacking in and see if I can jump to the source to see how this works. Clojure is so awesome! 😄My client config looks like this:
{:server-type :dev-local
:storage-dir :mem
:system "ci"}
@U083D6HK9 it's the call to datomic.client.api/client
in this component:
(defrecord Datomic [client-config conn db-name]
component/Lifecycle
(start [c]
(let [client (d/client client-config)
_ (d/create-database client {:db-name db-name})
conn (d/connect client {:db-name db-name})
tx-data (schema c)]
(d/transact conn {:tx-data tx-data})
(assoc c :client client :conn conn)))
(stop [c]
#_(some-> c :client (d/delete-database {:db-name db-name}))
(dl/release-db client-config)
(dissoc c :client :conn)))
Can you try updating to the latest 0.9.229? Also ensure you're on the latest client version 0.8.102.
Progress! Looks like updating the dev-local dep has gotten me the :mem
support I need. Now I just need to pass in :system
and :db-name
to release-db
.
I wonder if I can merge the client config and the arg-map
passed to release-db
et al… :thinking_face:
Makes sense. Thanks for the pointers, @U083D6HK9!