{"action":"created","comment":{"url":"https://api.github.com/repos/async-interop/event-loop/pulls/comments/63329718","id":63329718,"diff_hunk":"@@ -0,0 +1,57 @@\n+<?php\n+\n+namespace Interop\\Async;\n+\n+trait Registry {","path":"src/Registry.php","position":null,"original_position":5,"commit_id":"39923742091e22822606c4a8aa6041efa054bbd9","original_commit_id":"698d292d2c402400b2c342d5d39b41c92e4dd06b","user":{"login":"kelunik","id":2743004,"avatar_url":"https://avatars.githubusercontent.com/u/2743004?v=3","gravatar_id":"","url":"https://api.github.com/users/kelunik","html_url":"https://github.com/kelunik","followers_url":"https://api.github.com/users/kelunik/followers","following_url":"https://api.github.com/users/kelunik/following{/other_user}","gists_url":"https://api.github.com/users/kelunik/gists{/gist_id}","starred_url":"https://api.github.com/users/kelunik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelunik/subscriptions","organizations_url":"https://api.github.com/users/kelunik/orgs","repos_url":"https://api.github.com/users/kelunik/repos","events_url":"https://api.github.com/users/kelunik/events{/privacy}","received_events_url":"https://api.github.com/users/kelunik/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-05-16T09:34:15Z","updated_at":"2016-05-16T09:34:15Z","html_url":"https://github.com/async-interop/event-loop/pull/31#discussion_r63329718","pull_request_url":"https://api.github.com/repos/async-interop/event-loop/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/comments/63329718"},"html":{"href":"https://github.com/async-interop/event-loop/pull/31#discussion_r63329718"},"pull_request":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/async-interop/event-loop/pulls/31","id":70044117,"html_url":"https://github.com/async-interop/event-loop/pull/31","diff_url":"https://github.com/async-interop/event-loop/pull/31.diff","patch_url":"https://github.com/async-interop/event-loop/pull/31.patch","issue_url":"https://api.github.com/repos/async-interop/event-loop/issues/31","number":31,"state":"open","locked":false,"title":"Add loop bound state registry","user":{"login":"kelunik","id":2743004,"avatar_url":"https://avatars.githubusercontent.com/u/2743004?v=3","gravatar_id":"","url":"https://api.github.com/users/kelunik","html_url":"https://github.com/kelunik","followers_url":"https://api.github.com/users/kelunik/followers","following_url":"https://api.github.com/users/kelunik/following{/other_user}","gists_url":"https://api.github.com/users/kelunik/gists{/gist_id}","starred_url":"https://api.github.com/users/kelunik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelunik/subscriptions","organizations_url":"https://api.github.com/users/kelunik/orgs","repos_url":"https://api.github.com/users/kelunik/repos","events_url":"https://api.github.com/users/kelunik/events{/privacy}","received_events_url":"https://api.github.com/users/kelunik/received_events","type":"User","site_admin":false},"body":"The registry allows to store information bound to a specific loop. This can be useful to store state of globals like a DNS resolver.\r\n\r\n**Rationale for a global DNS resolver**\r\n\r\nNobody wants to inject a resolver into everything that does some sort of I/O. Using IP addresses everywhere instead of hostnames also doesn't make sense.\r\n\r\nTherefore there should be a global default DNS resolver. But this resolver needs a read watcher for the response. If the loop gets swapped and a DNS request is made, the resolver would never get the read event, since the stream is only watched in the old loop. The resolver also doesn't get any info about the loop swap, so it can't use a new watcher.\r\n\r\nWith a loop bound registry, it can just store the connection in the loop and will use a new connection when the loop is swapped, because the state doesn't exist any longer. Once the loop is put back, it can use the old connection again.\r\n\r\nThis API should only be used by real global objects. Most packages won't need to use this API, but it's required for the mentioned use cases.","created_at":"2016-05-13T19:12:04Z","updated_at":"2016-05-16T09:34:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c4bb06b5ede8e85a100505d419fbe74290ee60c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/async-interop/event-loop/pulls/31/commits","review_comments_url":"https://api.github.com/repos/async-interop/event-loop/pulls/31/comments","review_comment_url":"https://api.github.com/repos/async-interop/event-loop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/async-interop/event-loop/issues/31/comments","statuses_url":"https://api.github.com/repos/async-interop/event-loop/statuses/39923742091e22822606c4a8aa6041efa054bbd9","head":{"label":"async-interop:registry","ref":"registry","sha":"39923742091e22822606c4a8aa6041efa054bbd9","user":{"login":"async-interop","id":16273482,"avatar_url":"https://avatars.githubusercontent.com/u/16273482?v=3","gravatar_id":"","url":"https://api.github.com/users/async-interop","html_url":"https://github.com/async-interop","followers_url":"https://api.github.com/users/async-interop/followers","following_url":"https://api.github.com/users/async-interop/following{/other_user}","gists_url":"https://api.github.com/users/async-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/async-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/async-interop/subscriptions","organizations_url":"https://api.github.com/users/async-interop/orgs","repos_url":"https://api.github.com/users/async-interop/repos","events_url":"https://api.github.com/users/async-interop/events{/privacy}","received_events_url":"https://api.github.com/users/async-interop/received_events","type":"Organization","site_admin":false},"repo":{"id":50024001,"name":"event-loop","full_name":"async-interop/event-loop","owner":{"login":"async-interop","id":16273482,"avatar_url":"https://avatars.githubusercontent.com/u/16273482?v=3","gravatar_id":"","url":"https://api.github.com/users/async-interop","html_url":"https://github.com/async-interop","followers_url":"https://api.github.com/users/async-interop/followers","following_url":"https://api.github.com/users/async-interop/following{/other_user}","gists_url":"https://api.github.com/users/async-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/async-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/async-interop/subscriptions","organizations_url":"https://api.github.com/users/async-interop/orgs","repos_url":"https://api.github.com/users/async-interop/repos","events_url":"https://api.github.com/users/async-interop/events{/privacy}","received_events_url":"https://api.github.com/users/async-interop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/async-interop/event-loop","description":"A PHP interface describing an event loop.","fork":false,"url":"https://api.github.com/repos/async-interop/event-loop","forks_url":"https://api.github.com/repos/async-interop/event-loop/forks","keys_url":"https://api.github.com/repos/async-interop/event-loop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/async-interop/event-loop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/async-interop/event-loop/teams","hooks_url":"https://api.github.com/repos/async-interop/event-loop/hooks","issue_events_url":"https://api.github.com/repos/async-interop/event-loop/issues/events{/number}","events_url":"https://api.github.com/repos/async-interop/event-loop/events","assignees_url":"https://api.github.com/repos/async-interop/event-loop/assignees{/user}","branches_url":"https://api.github.com/repos/async-interop/event-loop/branches{/branch}","tags_url":"https://api.github.com/repos/async-interop/event-loop/tags","blobs_url":"https://api.github.com/repos/async-interop/event-loop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/async-interop/event-loop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/async-interop/event-loop/git/refs{/sha}","trees_url":"https://api.github.com/repos/async-interop/event-loop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/async-interop/event-loop/statuses/{sha}","languages_url":"https://api.github.com/repos/async-interop/event-loop/languages","stargazers_url":"https://api.github.com/repos/async-interop/event-loop/stargazers","contributors_url":"https://api.github.com/repos/async-interop/event-loop/contributors","subscribers_url":"https://api.github.com/repos/async-interop/event-loop/subscribers","subscription_url":"https://api.github.com/repos/async-interop/event-loop/subscription","commits_url":"https://api.github.com/repos/async-interop/event-loop/commits{/sha}","git_commits_url":"https://api.github.com/repos/async-interop/event-loop/git/commits{/sha}","comments_url":"https://api.github.com/repos/async-interop/event-loop/comments{/number}","issue_comment_url":"https://api.github.com/repos/async-interop/event-loop/issues/comments{/number}","contents_url":"https://api.github.com/repos/async-interop/event-loop/contents/{+path}","compare_url":"https://api.github.com/repos/async-interop/event-loop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/async-interop/event-loop/merges","archive_url":"https://api.github.com/repos/async-interop/event-loop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/async-interop/event-loop/downloads","issues_url":"https://api.github.com/repos/async-interop/event-loop/issues{/number}","pulls_url":"https://api.github.com/repos/async-interop/event-loop/pulls{/number}","milestones_url":"https://api.github.com/repos/async-interop/event-loop/milestones{/number}","notifications_url":"https://api.github.com/repos/async-interop/event-loop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/async-interop/event-loop/labels{/name}","releases_url":"https://api.github.com/repos/async-interop/event-loop/releases{/id}","deployments_url":"https://api.github.com/repos/async-interop/event-loop/deployments","created_at":"2016-01-20T10:52:37Z","updated_at":"2016-05-16T08:52:00Z","pushed_at":"2016-05-16T09:34:06Z","git_url":"git://github.com/async-interop/event-loop.git","ssh_url":"git@github.com:async-interop/event-loop.git","clone_url":"https://github.com/async-interop/event-loop.git","svn_url":"https://github.com/async-interop/event-loop","homepage":"","size":39,"stargazers_count":31,"watchers_count":31,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":13,"forks":4,"open_issues":13,"watchers":31,"default_branch":"master"}},"base":{"label":"async-interop:master","ref":"master","sha":"30fc5464cc15478a69d5f14ef0d5818d5edc0478","user":{"login":"async-interop","id":16273482,"avatar_url":"https://avatars.githubusercontent.com/u/16273482?v=3","gravatar_id":"","url":"https://api.github.com/users/async-interop","html_url":"https://github.com/async-interop","followers_url":"https://api.github.com/users/async-interop/followers","following_url":"https://api.github.com/users/async-interop/following{/other_user}","gists_url":"https://api.github.com/users/async-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/async-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/async-interop/subscriptions","organizations_url":"https://api.github.com/users/async-interop/orgs","repos_url":"https://api.github.com/users/async-interop/repos","events_url":"https://api.github.com/users/async-interop/events{/privacy}","received_events_url":"https://api.github.com/users/async-interop/received_events","type":"Organization","site_admin":false},"repo":{"id":50024001,"name":"event-loop","full_name":"async-interop/event-loop","owner":{"login":"async-interop","id":16273482,"avatar_url":"https://avatars.githubusercontent.com/u/16273482?v=3","gravatar_id":"","url":"https://api.github.com/users/async-interop","html_url":"https://github.com/async-interop","followers_url":"https://api.github.com/users/async-interop/followers","following_url":"https://api.github.com/users/async-interop/following{/other_user}","gists_url":"https://api.github.com/users/async-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/async-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/async-interop/subscriptions","organizations_url":"https://api.github.com/users/async-interop/orgs","repos_url":"https://api.github.com/users/async-interop/repos","events_url":"https://api.github.com/users/async-interop/events{/privacy}","received_events_url":"https://api.github.com/users/async-interop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/async-interop/event-loop","description":"A PHP interface describing an event loop.","fork":false,"url":"https://api.github.com/repos/async-interop/event-loop","forks_url":"https://api.github.com/repos/async-interop/event-loop/forks","keys_url":"https://api.github.com/repos/async-interop/event-loop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/async-interop/event-loop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/async-interop/event-loop/teams","hooks_url":"https://api.github.com/repos/async-interop/event-loop/hooks","issue_events_url":"https://api.github.com/repos/async-interop/event-loop/issues/events{/number}","events_url":"https://api.github.com/repos/async-interop/event-loop/events","assignees_url":"https://api.github.com/repos/async-interop/event-loop/assignees{/user}","branches_url":"https://api.github.com/repos/async-interop/event-loop/branches{/branch}","tags_url":"https://api.github.com/repos/async-interop/event-loop/tags","blobs_url":"https://api.github.com/repos/async-interop/event-loop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/async-interop/event-loop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/async-interop/event-loop/git/refs{/sha}","trees_url":"https://api.github.com/repos/async-interop/event-loop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/async-interop/event-loop/statuses/{sha}","languages_url":"https://api.github.com/repos/async-interop/event-loop/languages","stargazers_url":"https://api.github.com/repos/async-interop/event-loop/stargazers","contributors_url":"https://api.github.com/repos/async-interop/event-loop/contributors","subscribers_url":"https://api.github.com/repos/async-interop/event-loop/subscribers","subscription_url":"https://api.github.com/repos/async-interop/event-loop/subscription","commits_url":"https://api.github.com/repos/async-interop/event-loop/commits{/sha}","git_commits_url":"https://api.github.com/repos/async-interop/event-loop/git/commits{/sha}","comments_url":"https://api.github.com/repos/async-interop/event-loop/comments{/number}","issue_comment_url":"https://api.github.com/repos/async-interop/event-loop/issues/comments{/number}","contents_url":"https://api.github.com/repos/async-interop/event-loop/contents/{+path}","compare_url":"https://api.github.com/repos/async-interop/event-loop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/async-interop/event-loop/merges","archive_url":"https://api.github.com/repos/async-interop/event-loop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/async-interop/event-loop/downloads","issues_url":"https://api.github.com/repos/async-interop/event-loop/issues{/number}","pulls_url":"https://api.github.com/repos/async-interop/event-loop/pulls{/number}","milestones_url":"https://api.github.com/repos/async-interop/event-loop/milestones{/number}","notifications_url":"https://api.github.com/repos/async-interop/event-loop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/async-interop/event-loop/labels{/name}","releases_url":"https://api.github.com/repos/async-interop/event-loop/releases{/id}","deployments_url":"https://api.github.com/repos/async-interop/event-loop/deployments","created_at":"2016-01-20T10:52:37Z","updated_at":"2016-05-16T08:52:00Z","pushed_at":"2016-05-16T09:34:06Z","git_url":"git://github.com/async-interop/event-loop.git","ssh_url":"git@github.com:async-interop/event-loop.git","clone_url":"https://github.com/async-interop/event-loop.git","svn_url":"https://github.com/async-interop/event-loop","homepage":"","size":39,"stargazers_count":31,"watchers_count":31,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":13,"forks":4,"open_issues":13,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/31"},"html":{"href":"https://github.com/async-interop/event-loop/pull/31"},"issue":{"href":"https://api.github.com/repos/async-interop/event-loop/issues/31"},"comments":{"href":"https://api.github.com/repos/async-interop/event-loop/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/async-interop/event-loop/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/async-interop/event-loop/statuses/39923742091e22822606c4a8aa6041efa054bbd9"}}}}