Good morning
I have difficulties choosing names, I would like your opinion: 1. compute node / computation node / other 2. render node / rendering node / other 3. subscriber tree / subscription tree / other
Maybe some more fluent in English that I am could weight in. @yogthos: any suggestion ?
my vote would be for the first style with compute node, etc
@yogthos a last one: diff-propagation / propagate-diff / .. something else? (itβs a fn which finds the subscribers to update, based on the subcriber tree and a diff)
I changed my function from yesterday, now it takes into account the 2nd param for key-based subscriptions - the value to return when the data is missing.
;; Testing
#_ (-> empty-subscription-tree
(subscribe-on-path [:user :first-name] 1 :not-found)
(subscribe-on-path [:user :last-name] 2 nil))
; => {:children {:user {:children {:first-name {:subscribers {1 :not-found}}
; :last-name {:subscribers {2 nil}}}}}}
#_ (-> *1
(unsubscribe-from-path [:user :first-name] 1)
(unsubscribe-from-path [:user :last-name] 2))
; => {}
I'd got with propagat-diff to keep cosistent
and looks good with the default value return
Current progress on the propagate-diff
function:
(ns vrac.compute
(:require [diffuse.helper :as h]))
; ...
(def current-subscriber-tree (-> empty-subscription-tree
(subscribe-on-path [:user :first-name] 1 :not-found)
(subscribe-on-path [:user :last-name] 2 nil)
(subscribe-on-path [:user] 3 :nobody)))
(propagate-diff current-subscriber-tree
(h/map-dissoc :user))
; => [[{3 :nobody} {:type :missing}] [{1 :not-found} {:type :missing}] [{2 nil} {:type :missing}]]
(propagate-diff current-subscriber-tree
(h/map-update :user (h/map-dissoc :first-name)))
; => [[{3 :nobody} {:type :map, :key-op {:first-name :dissoc}}] [{1 :not-found} {:type :missing}]]
(propagate-diff current-subscriber-tree
(h/map-update :user (h/map-assoc :first-name "Coco")))
; => [[{3 :nobody} {:type :map, :key-op {:first-name [:assoc "Coco"]}}] [{1 :not-found} {:type :value, :value "Coco"}]]
(propagate-diff current-subscriber-tree
(h/map-update :user (h/map-assoc :last-name "the cat")))
; => [[{3 :nobody} {:type :map, :key-op {:last-name [:assoc "the cat"]}}] [{2 nil} {:type :value, :value "the cat"}]]
β End of my morning Vrac dev routine. Suggestions are welcome, as always.
@yogthos I just finished implementing the propagate-diff
function. Next, I will see what I can do about the compute graph. I will be happy to get your help in this area. See you tomorrow.
https://github.com/green-coder/vrac/commit/5b929950350128adaf1126a610e6338748bc82de
oh yeah sure glad to chat about it
and I'll take a look at the diffing code
Thx !!
one question is there any chance of collisions with keys in here {:children {:user {:children {:first-name {:subscribers {1 :not-found}}}}}}
would it make sense to namespace :children
, :subsribers
, etc
no chance of key collisions, they operate at different depth.
π
Side note: I updated the Diffuse library to include the missing h/missing
diff type