Fork me on GitHub
#datascript
<
2017-05-20
>
seantempesta05:05:10

@petrus: That or you can hack together your own solution. I ended up writing a simple sync solution where I create a filtered database for each user and then stream the datoms to them over sente to datascript. I’m not sure how to do optimistic writes though.

seantempesta05:05:41

How would you go about comparing two datascript database snapshots (d/db conn) in time? I’m want my user to be able to edit data and then I want to send the :db/add and :db/retract`s to the server to apply the changes. Datomic has d/since, but it doesn’t appear that datascript does.

seantempesta05:05:58

@nikki: Just curious. Isn’t it possible to transpile datascript to Objective C (maybe https://developers.google.com/j2objc/)? And it already runs in Java so I guess you could get it working in Android?

nikki06:05:48

but i'd still want to use it from JS running in JSC

misha06:05:34

@seantempesta if both snapshots are created by the same process – you could diff based on tx-ids

seantempesta06:05:16

@misha: Yeah, I’m looking at that. Will that cover retractions though?

misha06:05:32

or, what I did: you ds/listen! and just collect txs as db lives on, sending collected tx periodically to server with or w/o reducing them

misha06:05:42

ds/listen! will cover retracts usecase, but will be a bit more noisy for "hot" attributes: if you change same [e a] multiple times in a row, you'll get multiple txs instead of a single one. But this is reducible, since you have schema available

seantempesta06:05:07

hmm, not sure I follow the reducible part.

misha06:05:20

say you have cardinality one :foo/bar. changing it's value from :a to :b to :c will generate [[- :a][+ :b][- :b][+ :c]], it can be reduced to just [[+ :c]] (if you don't care about separate transactions for undo/analytics purposes)

petterik09:05:53

new, deleted or changed*

rauh09:05:14

You could use == for faster comparison of numbers.

rauh09:05:03

(`(== (count achunk) (count bchunk))`)

petterik09:05:29

I haven't gone deeper than this, but maybe it's possible to create something "queryable" from the diffs of the chunks? I don't know. Just re-running the queries when there's been a change has worked fine for me so far

misha19:05:57

Which queries? When is this diff to detect change (this is just boolean, right?) more suitable, than ds/listen! ?