vrac

Template-based web library [WIP] - https://github.com/green-coder/vrac Zulip archive: https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/vrac Clojureverse archive: https://clojurians-log.clojureverse.org/vrac
2020-09-04T03:51:54.431500Z

Good morning

2020-09-04T03:53:46.433100Z

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

2020-09-04T03:55:10.434Z

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

yogthos 2020-09-04T04:14:23.435400Z

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

1πŸ‘
2020-09-04T04:29:33.436700Z

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

2020-09-04T04:32:55.437900Z

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

yogthos 2020-09-04T04:41:02.438700Z

I'd got with propagat-diff to keep cosistent

1πŸ‘
yogthos 2020-09-04T04:42:24.439Z

and looks good with the default value return

1
2020-09-04T05:43:54.440300Z

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

2020-09-04T05:44:37.441100Z

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

2020-09-04T21:17:31.443900Z

@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

yogthos 2020-09-04T21:18:23.444200Z

oh yeah sure glad to chat about it

yogthos 2020-09-04T21:18:53.444600Z

and I'll take a look at the diffing code

2020-09-04T21:20:51.444800Z

Thx !!

yogthos 2020-09-04T21:21:09.445500Z

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

yogthos 2020-09-04T21:21:36.446500Z

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

2020-09-04T21:22:14.447200Z

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

yogthos 2020-09-04T21:22:22.447400Z

πŸ‘

2020-09-04T21:23:22.448200Z

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