{"action":"created","issue":{"url":"https://api.github.com/repos/fxbox/taxonomy/issues/40","repository_url":"https://api.github.com/repos/fxbox/taxonomy","labels_url":"https://api.github.com/repos/fxbox/taxonomy/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/fxbox/taxonomy/issues/40/comments","events_url":"https://api.github.com/repos/fxbox/taxonomy/issues/40/events","html_url":"https://github.com/fxbox/taxonomy/issues/40","id":143304344,"number":40,"title":"Move watcher logic from adapters to the adapter manager","user":{"login":"cr","id":170331,"avatar_url":"https://avatars.githubusercontent.com/u/170331?v=3","gravatar_id":"","url":"https://api.github.com/users/cr","html_url":"https://github.com/cr","followers_url":"https://api.github.com/users/cr/followers","following_url":"https://api.github.com/users/cr/following{/other_user}","gists_url":"https://api.github.com/users/cr/gists{/gist_id}","starred_url":"https://api.github.com/users/cr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cr/subscriptions","organizations_url":"https://api.github.com/users/cr/orgs","repos_url":"https://api.github.com/users/cr/repos","events_url":"https://api.github.com/users/cr/events{/privacy}","received_events_url":"https://api.github.com/users/cr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fxbox/taxonomy/labels/Priority:%20Enhancement","name":"Priority: Enhancement","color":"fc2929"},{"url":"https://api.github.com/repos/fxbox/taxonomy/labels/Quality:%20API","name":"Quality: API","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-24T17:08:18Z","updated_at":"2016-03-24T22:12:50Z","closed_at":null,"body":"Managing watchers requires significant portions of code in adapters that is beginning to look like massive boilerplate. Instead, managing watchers, range checking and notification should happen centrally in the adapter manager.\r\n\r\nI suggest to have adapters declare on getter registration whether or not a getter support updates. One way to go about this might be to modify the return type to pass an optional mpsc channel that the adapter uses to inform the adapter manager of every update to the getter's value:\r\n\r\n```rust\r\nfn add_getter(&self, setter: Channel<Getter>) -> Result<Option<Channel<Updater>>, Error>;\r\n```\r\n\r\nThat way we can completely remove *register_watch()* from the *Adapter: Send* trait and can have a well-tested central implementation of all the watcher logic."},"comment":{"url":"https://api.github.com/repos/fxbox/taxonomy/issues/comments/201046369","html_url":"https://github.com/fxbox/taxonomy/issues/40#issuecomment-201046369","issue_url":"https://api.github.com/repos/fxbox/taxonomy/issues/40","id":201046369,"user":{"login":"Yoric","id":10190,"avatar_url":"https://avatars.githubusercontent.com/u/10190?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoric","html_url":"https://github.com/Yoric","followers_url":"https://api.github.com/users/Yoric/followers","following_url":"https://api.github.com/users/Yoric/following{/other_user}","gists_url":"https://api.github.com/users/Yoric/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoric/subscriptions","organizations_url":"https://api.github.com/users/Yoric/orgs","repos_url":"https://api.github.com/users/Yoric/repos","events_url":"https://api.github.com/users/Yoric/events{/privacy}","received_events_url":"https://api.github.com/users/Yoric/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T22:12:50Z","updated_at":"2016-03-24T22:12:50Z","body":"How so what?"}}