Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty structures initialised with vector clock #2

Open
frankiesardo opened this issue Feb 5, 2021 · 0 comments
Open

Empty structures initialised with vector clock #2

frankiesardo opened this issue Feb 5, 2021 · 0 comments

Comments

@frankiesardo
Copy link

Using sets as an example: the current result of an empty convergent set is

(def set1 (with-node :node1 (convergent-set)))
;; => #schism/set[#{} {} {}]

Whereas if a set is initialised with some state is

(def set2 (with-node :node2 (convergent-set :a)))
;; => => #schism/set[#{:a} {:node2 #inst"..."} {:a [:node2 #inst"..."]}]

I found this caused problems when you try to merge the second into the empty set

(with-node :node1 (converge set1 set2))
;; => Execution error (NullPointerException) at schism.impl.core/to-millis.

Because the first set is missing a vector clock.

Should convergent data structures be initialised with a vector clock in all cases? Changing the initialisation with

-(defn new-set
-  ([] (Set. (hash-set)
-            (hash-map)
-            (hash-map)))
+ (defn new-set
+   ([] (vc/update-clock now nil
+                     (Set. (hash-set)
+                           (hash-map)
+                           (hash-map)))) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant