Wow, this is really cool! Could you describe how one might go about using this to implement, say, a crdt chat room using maps and sets? Can I for instance just push crdts between clients in a serverless fashion?
Perhaps some examples would be instructive, but I've been hoping for something just like this recently, so thanks! V/r John On Wed, Apr 18, 2018, 9:05 PM Alex Redington <areding...@gmail.com> wrote: > Good evening! > > I submit for your evaluation and reasoned feedback a library I've been > working on to provide a set of convergent replicated data types to Clojure > and ClojureScript: > > https://github.com/aredington/schism > [com.holychao/schism "0.1.0"] > > Schism provides convergent collections for sets, vectors, lists, and maps, > along with edn readers and writers out of the gate. My intent is to provide > you with all the tools necessary to replicate a collection across two or > more computing nodes. > > Replication is a hard problem, so there are a few caveats to these tools > as I provide them: > > - You must identify nodes within your cluster. You may choose to identify > nodes with a random UUID, in which case schism will help you to do so. Node > identifiers must be clojure serializable data. > - Schism purposefully avoids carrying around a monotonically increasing > historical collection of data about deleted entries. Consequently there are > some ambiguities during convergence that may not exactly mirror local > modification. > - Schism is only solving the problem of synchronizing two in memory sets. > Maintaining identity of those two sets, tracking state changes, and long > term durability are responsibilities left to the schism user. > > Schism collections are persistent collections, so you should feel free to > work with them as a drop in replacement for a function which would work > against a Clojure collection. The usual utilities such as conj, assoc, > dissoc, disj, and rest are pure functions which will return you derived > copies, implicitly soing the convergence bookkeeping necessary in the > background. As you work with it, schism will maintain node and timestamp > information, with the goal of convergence providing the same result as if > all previous invocations had occurred on one local collection in memory. > Schism's requirements are your expectations of a Clojure collection, so > hash, =, and support for meta are all included, as well as many other > functions defined against Clojure's own collections. Particularly with hash > and =, you can expect a schism collection to return the same hashcode as > its Clojure equivalent, and to determine equality in the same way as its > Clojure equivalent would. > > I've built schism in the absence of a direct itch to scratch with it. > Should you find that it betrays your expectations of Clojure collections, > I'd greatly appreciate a bug report and will work to correct schism quickly. > > I hope that it assists you in solving your own problems. > > -Alex > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.