becomingbabyman / cause Goto Github PK
View Code? Open in Web Editor NEWAn EDN-like CRDT (Causal Tree) for Clojure & ClojureScript that automatically tracks history and resolves conflicts.
License: MIT License
An EDN-like CRDT (Causal Tree) for Clojure & ClojureScript that automatically tracks history and resolves conflicts.
License: MIT License
There are several reasons why we'd want to start a CausalBase with empty leaf collections, including initializing a new data structure. Currently we're unable to do so.
Repro:
(require '[causal.core :as cause])
(def db (cause/base))
(cause/transact db [[nil nil {:foo {}}]])
=> Error: The cause of this node is not in the tree.
at new cljs$core$ExceptionInfo (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37198:10)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37259:9)
at Function.cljs$core$IFn$_invoke$arity$2 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37255:26)
at Function.cljs$core$IFn$_invoke$arity$4 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.shared.js:292:25)
at Object.causal$protocols$CausalTree$insert$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.map.js:542:79)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.protocols.js:168:19)
at http://localhost:8000/js/compiled/cljs-runtime/causal.base.core.js:191:32
at http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19649:89
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19650:3)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19646:78)
*e
=> #error {:message "The cause of this node is not in the tree.", :data {:causes #{:cause-must-exist}}}
I'm unable to add a map with UUID keys. Reproducing case:
(cause/transact (cause/base) [[nil nil {#uuid "79f12947-b05b-4b57-8a19-1f4ef587a08a" {:id #uuid "79f12947-b05b-4b57-8a19-1f4ef587a08a"}}]])
Error Message (CLJS):
Error: The cause of this node is not in the tree.
at new cljs$core$ExceptionInfo (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37198:10)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37259:9)
at Function.cljs$core$IFn$_invoke$arity$2 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:37255:26)
at Function.cljs$core$IFn$_invoke$arity$4 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.shared.js:292:25)
at Object.causal$protocols$CausalTree$insert$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.collections.map.js:544:79)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/causal.protocols.js:168:19)
at http://localhost:8000/js/compiled/cljs-runtime/causal.base.core.js:191:32
at http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19649:89
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19650:3)
at Function.cljs$core$IFn$_invoke$arity$3 (http://localhost:8000/js/compiled/cljs-runtime/cljs.core.js:19646:78)[:app] Compiling ..
Currently, it is possible to view the EDN current-state of a CausalBase. However, there is no way to serialize the entire CausalBase (including history, etc.) for, e.g., putting it in LocalStorage in a browser or sending it on the wire.
CausalBase should implement the CLJ(S) multimethods and protocols necessary to serialize its entirety to EDN, and should add EDN readers for de-serializing back into memory.
Transit would also be nice to have, but could be maintained as a separate project, to keep dependencies lean and clean.
In Datomic, the transaction result includes tx-data
, which is a fully-resolved and complete version of the transaction originally submitted (i.e. with tempids resolved, transaction functions applied, maps flattened, etc.).
It would be very helpful to include something similar in the result of a CausalBase transaction, e.g. for sending on the wire to other participants with their own local versions of the CRDT.
The entities which we're storing as CausalBase
s already have their own unique identifier (UUID). Similarly to how we can set the site-id
to something custom, we should be able to set the identifier portion of the ID vector to our own identifier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.