This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-13
Channels
- # beginners (202)
- # boot (7)
- # cider (14)
- # clara (2)
- # cljs-dev (7)
- # clojure (56)
- # clojure-italy (9)
- # clojure-spec (6)
- # clojure-uk (12)
- # clojurescript (40)
- # core-async (3)
- # datomic (6)
- # duct (1)
- # editors (10)
- # emacs (5)
- # fulcro (24)
- # off-topic (16)
- # onyx (4)
- # pedestal (1)
- # planck (8)
- # portkey (2)
- # re-frame (31)
- # reagent (23)
- # tools-deps (8)
- # vim (3)
i'm pretty new to datomic and not sure if i'm asking the "right" question, but maybe someone can help? i have two apps that use datomic (cloud). one app is responsible for authenticating a user and then linking them to some entity in datomic. the other app kicks off this process, gets back a confirmation that some datoms were updated, and then queries for that linked entity. the first time the query runs i get back nothing, and then all subsequent queries return the linked value. how asynchronous is transacting vs. reading?
or in other words, how can i guarantee that another peer/client has immediate access to the data after a transaction has occurred?
@joshkh have a look at the sync
fn discussed literally just before you posted a question
@joshkh you can do something like
;; On srv1
(let [tx-data (do-auth-stuff request)
{:keys [db-after]} @(d/transact conn tx-data)
basis-t (d/basis-t db-after)]
(send-to-srv-2 basis-t))
;; On srv2
(let [db @(d/sync conn basis-t)]
(do-srv2-stuff db ...))
Then, db
on srv2 will "wait" to a db with this basis-t. But as @misha said, d/sync
without a t
will ask the transactor "the newst db at this time"out of curiosity, is d/sync only available on-prem and not applicable to datomic cloud? i see it here: https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/sync but not here: https://docs.datomic.com/client-api/index.html