Fork me on GitHub
#vrac
<
2020-09-04
>
Vincent Cantin03:09:46

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

Vincent Cantin03:09:10

Maybe some more fluent in English that I am could weight in. @yogthos: any suggestion ?

yogthos04:09:23

my vote would be for the first style with compute node, etc

πŸ‘ 3
Vincent Cantin04:09:33

@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)

Vincent Cantin04:09:55

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))
; => {}

yogthos04:09:02

I'd got with propagat-diff to keep cosistent

πŸ‘ 3
yogthos04:09:24

and looks good with the default value return

bubblebobble 3
Vincent Cantin05:09:54

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"}]]

Vincent Cantin05:09:37

β€” End of my morning Vrac dev routine. Suggestions are welcome, as always.

Vincent Cantin21:09:31

@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

yogthos21:09:23

oh yeah sure glad to chat about it

yogthos21:09:53

and I'll take a look at the diffing code

yogthos21:09:09

one question is there any chance of collisions with keys in here {:children {:user {:children {:first-name {:subscribers {1 :not-found}}}}}}

yogthos21:09:36

would it make sense to namespace :children , :subsribers, etc

Vincent Cantin21:09:14

no chance of key collisions, they operate at different depth.

Vincent Cantin21:09:22

Side note: I updated the Diffuse library to include the missing h/missing diff type