This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-08
Channels
- # admin-announcements (3)
- # arachne (1)
- # aws (2)
- # beginners (10)
- # boot (287)
- # cider (5)
- # clara (2)
- # cljs-dev (150)
- # cljsjs (2)
- # clojure (99)
- # clojure-austin (1)
- # clojure-brasil (1)
- # clojure-dev (13)
- # clojure-greece (55)
- # clojure-japan (1)
- # clojure-nl (2)
- # clojure-russia (24)
- # clojure-spec (184)
- # clojure-taiwan (1)
- # clojure-uk (45)
- # clojurescript (55)
- # clojurex (1)
- # cursive (20)
- # datascript (16)
- # datomic (1)
- # devcards (4)
- # events (10)
- # figwheel (1)
- # funcool (7)
- # hoplon (48)
- # immutant (1)
- # jobs (6)
- # lambdaisland (2)
- # lein-figwheel (19)
- # mount (36)
- # off-topic (37)
- # om (16)
- # om-next (17)
- # onyx (29)
- # planck (53)
- # proton (1)
- # pure-frame (1)
- # re-frame (40)
- # reagent (44)
- # remote-jobs (1)
- # ring (2)
- # robots (2)
- # rum (5)
- # slack-help (4)
- # spacemacs (27)
- # specter (82)
- # test-check (18)
- # test200 (1)
- # untangled (17)
Just inserted ~2k DataScript EAVT tuples into RethinkDB via http://Horizon.io, looking forward to straightforward persistence and changefeeds!
@tonsky: exactly: something really simple. I was looking at Firebase to just (1) persist EAVT datoms, (2) coordinate dissemination of novelty to connected clients (though I had that working in Sente, wasn't hard), and (3) handle Twitter/Github/etc. auth. Trying Horizon (even tho Firebase has a ClojureScript wrapper), I've previously used RethinkDB, before EAVT. My front-end app grabs all datoms from Horizon/Rethink and dumps them in its DataScript instance. I haven't thought through how I'm going to write rollback: transacting on the client makes tx-data vectors, but there's no DataScript/Datomic on the backend to incorporate them, so hmmm. Maybe not such a good idea, replacing my Clojure/DataScript backend 😛
@tonsky: hmm, I see what you mean. Yes, I use clj->js:
; so our namespaced keywords attributes stored with namespace
(extend-type Keyword
IEncodeJS
(-clj->js
[kw]
(subs (str kw) 1)))
(defn datom-to-obj [v]
(apply hash-map (interleave ["e" "a" "v" "t"] (take 4 v))))
(let [datoms (clj->js (map datom-to-obj (map #(take 4 %) full-datascript-db)))] ; send to RethinkDB...)
So I'll have to extend any rich cljs types (sets, keywords, etc.) I use as values with IEncodeClojure to retrieve them properly…
Re: writing—I was thinking about retractions, the 5th element of tx-data
vector (does 5th element that have a name?). I'll just have to partition tx-data
s into additions and retraction, then translate that appropriately to Rethink/Horizon
I was also thinking, what happens if RethinkDB rejects a transaction? Maybe because of permissions. Then I'll have to roll back the change made to the client's DataScript db
I will try to hang on to older copies of the db and update conn
only in a success handler
If I had Datascript/Datomic on backend, I could eschew optimistic updates—clients could just send speculative tx-logs (I can get speculative transactions via with-db
right?) over WebSocket and update their local dbs when the server broadcasts an accepted change. But with Horizon/Rethink, everything has to be optimistic 😂