Fork me on GitHub
#datomic
<
2017-06-16
>
claudiu09:06:51

Hi, Does datomic help with problems like multiregion. Ex: having a server in australia & one in europe. When a user from australia creates an "article" (transactor would be in europe), is it different vs mysql single master with multi-region read-replicas ?

jaret14:06:30

@claudiu You can have peers from multiple regions performing reads but there is no cross-region support for writes with the transactor.

jaret14:06:11

Those peers can also all write to the same transactor, but you cannot have multiple transactors in different regions working against the same DB

eraserhd18:06:10

Someone posted a script here for exporting a datomic db to txs that could be committed against an empty db. I don't remember who. Anyone remember this?

devth18:06:39

has anyone figured out a clean/sound way to specify ordering on a set of many cardinality refs? or are people just using :pos-like solutions as already discussed in google groups threads? (e.g. https://groups.google.com/forum/#!topic/datomic/uq9vBspB3zk)

Lone Ranger19:06:26

happy friday everyone 🙂

Lone Ranger19:06:40

anyone know if there's an efficient way to do a "diff" between history versions of a db?

bbqbaron19:06:56

sorry, dumb question: isn’t that just the atoms in the log between their t values?

Lone Ranger19:06:04

@bbqbaron I couldn't tell if it's a dumb question or not 😅 the use case is I have a client side datascript DB that I want to sync with the server side datomic db... the very course-grained idea is that if the client-db historical # is behind the server-db historical # to do a diff and update the client-db with the missing data

bbqbaron19:06:28

so, i haven’t used datascript, but assuming it’s a non-permanent datomic equivalent for the browser, then i’d probably just grab all the datoms in the server’s log greater than the client-side db’s basis-t (i think that’s the name) and transact them on the datascript db

bbqbaron19:06:44

momentarily ignoring questions of performance, etc

Lone Ranger19:06:03

yeah that sounds like a fantastic approach, I'll look into that

bbqbaron19:06:24

(i guess you can’t prove that the list of datoms is the actual diff, now that i think about it. it could contain cul-de-sacs of transactions that undo themselves)

bbqbaron19:06:30

(such that sending them would be a waste)

bbqbaron19:06:33

but otherwise, great!

Lone Ranger19:06:45

I'll work on that now and let you know how it goes 🙂

souenzzo20:06:28

Datomic has some trigger to do something like:

(let [coonection (d/connect db-uri)
      connection-with-middlewire (d/on-transact connection (fn [db tx-data] ,,,,))]
  (reset! conn connection-with-middlewire))
Then, every time that anyone transact on this conn, the tx-data will be processed by this fn..

Lone Ranger20:06:42

ah, yeah, transactor functions... haven't gotten into those yet 🙂 @bbqbaron this seems to be getting pretty close to what you were talking about, dug this up from the day of datomic materials (`https://github.com/Datomic/day-of-datomic/blob/master/tutorial/basis_t_and_log.clj`):

(def conn (d/connect uri))
(def db (d/db conn))
(def basis-t (d/basis-t db))
(def basis-tx (d/t->tx basis-t))
(def log (d/log conn))
(-> (d/tx-range log basis-tx (inc basis-tx))
    seq first :data count)

bbqbaron20:06:53

that does seem to get the log from a given tx range for a given db. i haven’t done this particular operation myself, but it definitely looks related

Lone Ranger20:06:29

I'm debating whether or not this is worth the effort compared to traditional APIs

Lone Ranger20:06:29

the idea of having a client side db and saying goodbye to APIs seems great but... really it's just a lot of APIs going on behind the scenes

Lone Ranger20:06:52

I'm actually kind of surprised datomic corp hasn't jumped in on this yet

bbqbaron20:06:40

that is, on the idea of having some kind of self-maintaining shared client/browser state that uses sockets or whatnot?

Lone Ranger21:06:39

mhm. Or just the client side db at all

Lone Ranger21:06:01

I really do think that once this tech matures it could change the game for front end

Lone Ranger21:06:43

what is currently most attractive to me about the clojure is the ecosystem ... database, server, AND client all handled with the same language

Lone Ranger21:06:01

if pallet works out it would be my devops solution too

Lone Ranger21:06:33

I mean cognitect created clojurescript... why not bring their flagship product to cljs too?

Lone Ranger22:06:11

I'm curious if the reason why they haven't has more to do with dev resource limitations or if there are strategic reasons why they choose not to