This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-16
Channels
- # beginners (1)
- # boot (69)
- # carry (1)
- # cider (29)
- # cljs-dev (17)
- # cljsrn (100)
- # clojure (13)
- # clojure-austin (13)
- # clojure-brasil (1)
- # clojure-dev (1)
- # clojure-korea (3)
- # clojure-russia (3)
- # clojure-spec (20)
- # clojure-uk (5)
- # clojurescript (45)
- # cloverage (3)
- # datomic (5)
- # figwheel (1)
- # hoplon (198)
- # klipse (25)
- # lein-figwheel (2)
- # leiningen (3)
- # off-topic (35)
- # om (7)
- # om-next (2)
- # onyx (8)
- # proton (8)
- # re-frame (3)
- # untangled (1)
- # vim (13)
So I’m building up a spec to validate an input map, and one key of that map is a datomic database.
For this reason I’ve written a spec that checks for the datomic.db.Db
type.
Because I want to be able to exercise etc. my spec, I’ve also written it with a generator:
(s/def :datomic/db
(s/with-gen
#(instance? datomic.db.Db %)
#(sgen/return (let [uri "datomic:"
conn (partial d/connect uri)]
(d/create-database uri)
(d/db (conn))))))
Is this a good way to go?
And how would garbage collection work on the memory databases generated via exercise
? Since the memory db doesn’t seem linked to a specific var but is created indirectly via a uri, is there a risk that I may fill up my memory with this?
Or would the fact that I’m reusing the same uri preventing multiple dbs from being created?
@achesnais datomic connections cache, so you’d only pay for one in that instance. i believe it won’t gc until you d/release
it