{"action":"created","issue":{"url":"https://api.github.com/repos/OSSIA/API/issues/15","labels_url":"https://api.github.com/repos/OSSIA/API/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/OSSIA/API/issues/15/comments","events_url":"https://api.github.com/repos/OSSIA/API/issues/15/events","html_url":"https://github.com/OSSIA/API/pull/15","id":123983478,"number":15,"title":"Add callbacks for adding / removing child Node","user":{"login":"jcelerier","id":2772730,"avatar_url":"https://avatars.githubusercontent.com/u/2772730?v=3","gravatar_id":"","url":"https://api.github.com/users/jcelerier","html_url":"https://github.com/jcelerier","followers_url":"https://api.github.com/users/jcelerier/followers","following_url":"https://api.github.com/users/jcelerier/following{/other_user}","gists_url":"https://api.github.com/users/jcelerier/gists{/gist_id}","starred_url":"https://api.github.com/users/jcelerier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcelerier/subscriptions","organizations_url":"https://api.github.com/users/jcelerier/orgs","repos_url":"https://api.github.com/users/jcelerier/repos","events_url":"https://api.github.com/users/jcelerier/events{/privacy}","received_events_url":"https://api.github.com/users/jcelerier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-27T15:31:51Z","updated_at":"2016-01-04T16:00:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/OSSIA/API/pulls/15","html_url":"https://github.com/OSSIA/API/pull/15","diff_url":"https://github.com/OSSIA/API/pull/15.diff","patch_url":"https://github.com/OSSIA/API/pull/15.patch"},"body":"This commits adds a callback mechanism when a Node's\r\nchild gets added / removed.\r\n\r\nBecause it would IMHO be costly to have callbacks registered for each Node,\r\nI choose to put the callbacks list in the Device.\r\n\r\nIf a node is inside the hierarchy of a device (i.e. the important case)\r\ncalling emplaceAndNotify / eraseAndNotify will then run the callbacks\r\nregistered in the device.\r\n\r\nThis way a single function has to be registered.\r\n\r\nThis is used in i-score for the Local device (see recent commits).\r\nThis allows to automatically update the Device explorer when for instant\r\na Constraint is added (instead of having to do Refresh namespace each time).\r\n\r\nI kept separate emplace / emplaceAndNotify because if a Node is added\r\nby hand from i-score, we do not want (I think) to get notified of the\r\nnode that was just added."},"comment":{"url":"https://api.github.com/repos/OSSIA/API/issues/comments/168715656","html_url":"https://github.com/OSSIA/API/pull/15#issuecomment-168715656","issue_url":"https://api.github.com/repos/OSSIA/API/issues/15","id":168715656,"user":{"login":"theod","id":118426,"avatar_url":"https://avatars.githubusercontent.com/u/118426?v=3","gravatar_id":"","url":"https://api.github.com/users/theod","html_url":"https://github.com/theod","followers_url":"https://api.github.com/users/theod/followers","following_url":"https://api.github.com/users/theod/following{/other_user}","gists_url":"https://api.github.com/users/theod/gists{/gist_id}","starred_url":"https://api.github.com/users/theod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theod/subscriptions","organizations_url":"https://api.github.com/users/theod/orgs","repos_url":"https://api.github.com/users/theod/repos","events_url":"https://api.github.com/users/theod/events{/privacy}","received_events_url":"https://api.github.com/users/theod/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T16:00:27Z","updated_at":"2016-01-04T16:00:27Z","body":"Having the notification mechanism at the Device level sounds good to me.\r\nI need to look further into emplaceAndNotify in order to see if we can design stuff in an other manner as I don't like function name with a \"And\" into (I would prefer to have emplace and then to use notify if I need it but I guess they are some reason why you choose this ?)"}}