One straightforward approach would be to use tx-listen to listen to all your db 
transactions and then just append the datoms to a file.  This would be very 
easy with node-webkit, because you can take advantage of node's asynchronous 
io.  Then when your app restarts just read the file and apply the transactions 
in order.

This would retain the entire history (like Datomic), which may not be what you 
want.  But you could easily build on this to suit many use cases.  You could 
create separate files for different entities, and/or choose which data to 
persist the entire history vs. just the current state.  Append-only is easy, 
but once you start getting fancy there are a ton of edge cases to worry about.  
In that case, you could look at using a logging framework to manage the gory 
details.

You could even embed a database to back everything up, there are about a 
billion choices in npm.  Even if you choose to use an embedded db on the node 
side, tx-listen is probably the easiest place to hook in.  Another route would 
be to add some metadata to your entities in Datascript to make it easier to 
query what you want to persist.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to