This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-25
Channels
- # aleph (2)
- # aws (2)
- # beginners (37)
- # boot (23)
- # cider (29)
- # clara (34)
- # cljs-dev (2)
- # cljsrn (17)
- # clojure (230)
- # clojure-dev (47)
- # clojure-italy (11)
- # clojure-nl (2)
- # clojure-poland (5)
- # clojure-russia (52)
- # clojure-sg (1)
- # clojure-spec (70)
- # clojure-uk (73)
- # clojurescript (31)
- # core-async (9)
- # cursive (15)
- # datomic (39)
- # events (1)
- # graphql (1)
- # lein-figwheel (2)
- # luminus (13)
- # off-topic (2)
- # onyx (29)
- # other-lisps (1)
- # parinfer (15)
- # pedestal (14)
- # re-frame (41)
- # reagent (24)
- # ring (4)
- # ring-swagger (12)
- # rum (1)
- # spacemacs (3)
- # specter (1)
- # test-check (13)
- # timbre (9)
- # unrepl (29)
- # vim (5)
@apsey, that's very interesting.
> a way to get the transactor host from the connection
I don't know if this is part of the public API
> encode and decode data that is being transacted or queried
I'm not sure what this would get for you?
Datomic has a new HTTP endpoint you can query to get some status info, but I'm not sure if that's what you need here
Datomic has a lot of the HA stuff built-in, as well as connection retries I think
But it's all internal, I'm not sure how well it's exposed to the user
Is it possible to just monitor the queries and transactions, and fail if they fail, but in the background retry to try and let Finagle handle the self-healing and backoff?
hey y’all, what are the best practices around creating datomic connections? I’m using datomic for a web app, and is it ok to call d/connect once per API request?
> Datomic connections do not adhere to an acquire/use/release pattern. They are thread-safe and long lived. Connections are cached such that calling datomic.api/connect multiple times with the same database value will return the same connection object.
from d/connect
docstring
however as a matter of code architecture, I would suggest maybe using the Component architecture that does use a long-lived connection
It makes reloading easy, and helps you easily use a memory database for testing
You can do it either way, but if you need to inject a URI to connect to, then you may as well inject a full Datomic Component
@U0AQ1R7FG not relying on URIs also gives you the opportunity to do things like forking etc.
@danielcompton @U06GS6P1N Thanks for the help!
Here's a fully worked component that might be useful as a starting point:
(ns app.system.datomic
(:require [com.stuartsierra.component :as component]
[datomic.api :as d]
[app.datomic.schema :as schema]
[clojure.spec :as s]
[clojure.string :as str]
[suspendable.core :as suspendable]
[clojure.tools.logging :as log])
(:import (datomic Connection)))
(s/def :datomic/conn (partial instance? Connection))
(s/def :datomic/uri (s/and string?
#(str/starts-with? % "datomic:")))
(defrecord Datomic [uri conn]
component/Lifecycle
(start [component]
(let [created? (d/create-database uri)
conn (d/connect uri)]
(when created?
(log/info "Creating a new datomic database:" uri))
(schema/ensure-schema conn)
(assoc component :conn conn)))
(stop [component]
(when conn (d/release conn))
(assoc component :conn nil))
suspendable/Suspendable
(suspend [component]
component)
(resume [component old-component]
(if (and (= (dissoc component :conn) (dissoc old-component :conn))
(some? (:conn old-component))
;; Try and sync the db, to ensure that we are still connected
;; If not, we shut down the component and try to reconnect.
(try
(deref (d/sync (:conn old-component)) 500 false)
(catch Exception e
false)))
(assoc component :conn (:conn old-component))
(do (component/stop old-component)
(component/start component)))))
(defn new-datomic [{:keys [uri] :as config}]
(map->Datomic {:uri uri}))
(s/fdef new-datomic
:args (s/cat :config (s/keys :req-un [:datomic/uri])))
YMMV ofcHello! Question regarding txReportQueue. So if I subscribe from a Peer to txReportQueue at Time=t0 where maxTxId=XXX and keep getting messages until Time=t1 where maxTxId=YYY, if for some reason connection to datomic breaks from t1 to Time=t3 where maxTxId=ZZZ, when my Peer recovers will it get all the txIds YYY-ZZZ or it will start getting after ZZZ?
No, txReportQueue is a realtime notification system, use the Log API for catching up
Hey all. Noob question. Is it possible to start datomic in local (in memory) mode, and then migrate to a backing store, without losing all the in memory datoms?
http://docs.datomic.com/backup.html seems to suggest swapping out the backing store is possible.
@danielcompton can you guide me to the new HTTP endpoint status info API?
I am still researching, but I dont think it is possible to activate
finagle only in the failing cases, if that is what you are suggesting
@bbloom https://github.com/tonsky/datascript/blob/master/src/datascript/btset.cljc perhaps?
that’s probably worth studying - thx @robert-stuttaford
https://gist.github.com/tonsky/c5605058f29c620242eb7e0130234a8c <- does look promising for my needs
Can I call functions from my application’s namespace / librairies in a Datalog queries? I tried but got an error. I suspected it’s because the quoted query could not reference the functions I was using, so I tried syntax quoting (which auto-prefixes every symbol), but then the variables (e.g. ?trete
) got prefixed too and everything broke
> Function names outside clojure.core need to be fully qualified, and their namespaces must be loaded before use in query.
Can datomic-console-0.1.214 be installed and run with datomic-free-0.9.5561.50 ?
could be I blew the installation, but for me it's crashing at startup with
console_1 | Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class
console_1 | at java.lang.ClassLoader.defineClass1(Native Method)
console_1 | at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
console_1 | at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
...
same issue with datomic-free-0.9.5561.54 and each version back to 0.9.5544
ah, nevermind. I found this comment in the Google group https://groups.google.com/forum/#!topic/datomic/TiRcDBqs9cM