{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/flannel/pulls/comments/37256013","id":37256013,"diff_hunk":"@@ -178,19 +176,49 @@ func (m *RemoteManager) WatchLeases(ctx context.Context, network string, cursor\n \n \tresp, err := m.httpGet(ctx, url)\n \tif err != nil {\n-\t\treturn subnet.WatchResult{}, err\n+\t\treturn err\n \t}\n \n \tif resp.StatusCode != http.StatusOK {\n-\t\treturn subnet.WatchResult{}, httpError(resp)\n+\t\treturn httpError(resp)\n+\t}\n+\n+\tif err := json.NewDecoder(resp.Body).Decode(wr); err != nil {\n+\t\treturn err\n \t}\n \n-\twr := subnet.WatchResult{}\n-\tif err := json.NewDecoder(resp.Body).Decode(&wr); err != nil {\n-\t\treturn subnet.WatchResult{}, err\n+\treturn nil\n+}\n+\n+func (m *RemoteManager) WatchLeases(ctx context.Context, network string, cursor interface{}) (subnet.LeaseWatchResult, error) {\n+\turl := m.mkurl(network, \"leases\")\n+\n+\twr := subnet.LeaseWatchResult{}\n+\terr := m.watch(ctx, url, cursor, &wr)\n+\tif err != nil {\n+\t\treturn subnet.LeaseWatchResult{}, err\n \t}\n \tif _, ok := wr.Cursor.(string); !ok {\n-\t\treturn subnet.WatchResult{}, fmt.Errorf(\"lease watch returned non-string cursor\")\n+\t\treturn subnet.LeaseWatchResult{}, fmt.Errorf(\"watch returned non-string cursor\")\n+\t}\n+\n+\treturn wr, nil\n+}\n+\n+func (m *RemoteManager) WatchNetworks(ctx context.Context, cursor interface{}) (subnet.NetworkWatchResult, error) {\n+\twr := subnet.NetworkWatchResult{}\n+\terr := m.watch(ctx, m.base+\"/\", cursor, &wr)\n+\tif err != nil {\n+\t\treturn subnet.NetworkWatchResult{}, err\n+\t}\n+\n+\t// Only return a cursor for the 'watch' operation\n+\tif cursor != nil {","path":"remote/client.go","position":63,"original_position":63,"commit_id":"11b89838a17b05abd547cf78ff0dccea44460f98","original_commit_id":"11b89838a17b05abd547cf78ff0dccea44460f98","user":{"login":"eyakubovich","id":3586053,"avatar_url":"https://avatars.githubusercontent.com/u/3586053?v=3","gravatar_id":"","url":"https://api.github.com/users/eyakubovich","html_url":"https://github.com/eyakubovich","followers_url":"https://api.github.com/users/eyakubovich/followers","following_url":"https://api.github.com/users/eyakubovich/following{/other_user}","gists_url":"https://api.github.com/users/eyakubovich/gists{/gist_id}","starred_url":"https://api.github.com/users/eyakubovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyakubovich/subscriptions","organizations_url":"https://api.github.com/users/eyakubovich/orgs","repos_url":"https://api.github.com/users/eyakubovich/repos","events_url":"https://api.github.com/users/eyakubovich/events{/privacy}","received_events_url":"https://api.github.com/users/eyakubovich/received_events","type":"User","site_admin":false},"body":"Sorry, I think you misunderstood me a bit. Yes, I proposed combining watch+get much like you've done here. However you should always return a cursor. Otherwise the watch won't work -- you kick the watch off by getting all the networks (no cursor passed in) and then watch for increments (using cursor) if you so desire. I think what you have for `WatchLeases` is perfect.","created_at":"2015-08-18T01:21:21Z","updated_at":"2015-08-18T01:21:21Z","html_url":"https://github.com/coreos/flannel/pull/284#discussion_r37256013","pull_request_url":"https://api.github.com/repos/coreos/flannel/pulls/284","_links":{"self":{"href":"https://api.github.com/repos/coreos/flannel/pulls/comments/37256013"},"html":{"href":"https://github.com/coreos/flannel/pull/284#discussion_r37256013"},"pull_request":{"href":"https://api.github.com/repos/coreos/flannel/pulls/284"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/flannel/pulls/284","id":42248538,"html_url":"https://github.com/coreos/flannel/pull/284","diff_url":"https://github.com/coreos/flannel/pull/284.diff","patch_url":"https://github.com/coreos/flannel/pull/284.patch","issue_url":"https://api.github.com/repos/coreos/flannel/issues/284","number":284,"state":"open","locked":false,"title":"subnet: add infrastructure and tests for network watches","user":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"body":"This PR depends on https://github.com/coreos/flannel/pull/282 (which is the first commit here too) so that one should get sorted out first.","created_at":"2015-08-12T14:51:57Z","updated_at":"2015-08-18T01:21:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"254ac9e3156c86be7ce99310676cec4c312a97bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/flannel/pulls/284/commits","review_comments_url":"https://api.github.com/repos/coreos/flannel/pulls/284/comments","review_comment_url":"https://api.github.com/repos/coreos/flannel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/flannel/issues/284/comments","statuses_url":"https://api.github.com/repos/coreos/flannel/statuses/11b89838a17b05abd547cf78ff0dccea44460f98","head":{"label":"dcbw:network-watch","ref":"network-watch","sha":"11b89838a17b05abd547cf78ff0dccea44460f98","user":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"repo":{"id":39463679,"name":"flannel","full_name":"dcbw/flannel","owner":{"login":"dcbw","id":10926354,"avatar_url":"https://avatars.githubusercontent.com/u/10926354?v=3","gravatar_id":"","url":"https://api.github.com/users/dcbw","html_url":"https://github.com/dcbw","followers_url":"https://api.github.com/users/dcbw/followers","following_url":"https://api.github.com/users/dcbw/following{/other_user}","gists_url":"https://api.github.com/users/dcbw/gists{/gist_id}","starred_url":"https://api.github.com/users/dcbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcbw/subscriptions","organizations_url":"https://api.github.com/users/dcbw/orgs","repos_url":"https://api.github.com/users/dcbw/repos","events_url":"https://api.github.com/users/dcbw/events{/privacy}","received_events_url":"https://api.github.com/users/dcbw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dcbw/flannel","description":"flannel is an etcd backed network fabric for containers","fork":true,"url":"https://api.github.com/repos/dcbw/flannel","forks_url":"https://api.github.com/repos/dcbw/flannel/forks","keys_url":"https://api.github.com/repos/dcbw/flannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcbw/flannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcbw/flannel/teams","hooks_url":"https://api.github.com/repos/dcbw/flannel/hooks","issue_events_url":"https://api.github.com/repos/dcbw/flannel/issues/events{/number}","events_url":"https://api.github.com/repos/dcbw/flannel/events","assignees_url":"https://api.github.com/repos/dcbw/flannel/assignees{/user}","branches_url":"https://api.github.com/repos/dcbw/flannel/branches{/branch}","tags_url":"https://api.github.com/repos/dcbw/flannel/tags","blobs_url":"https://api.github.com/repos/dcbw/flannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcbw/flannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcbw/flannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcbw/flannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcbw/flannel/statuses/{sha}","languages_url":"https://api.github.com/repos/dcbw/flannel/languages","stargazers_url":"https://api.github.com/repos/dcbw/flannel/stargazers","contributors_url":"https://api.github.com/repos/dcbw/flannel/contributors","subscribers_url":"https://api.github.com/repos/dcbw/flannel/subscribers","subscription_url":"https://api.github.com/repos/dcbw/flannel/subscription","commits_url":"https://api.github.com/repos/dcbw/flannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcbw/flannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcbw/flannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcbw/flannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcbw/flannel/contents/{+path}","compare_url":"https://api.github.com/repos/dcbw/flannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcbw/flannel/merges","archive_url":"https://api.github.com/repos/dcbw/flannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcbw/flannel/downloads","issues_url":"https://api.github.com/repos/dcbw/flannel/issues{/number}","pulls_url":"https://api.github.com/repos/dcbw/flannel/pulls{/number}","milestones_url":"https://api.github.com/repos/dcbw/flannel/milestones{/number}","notifications_url":"https://api.github.com/repos/dcbw/flannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcbw/flannel/labels{/name}","releases_url":"https://api.github.com/repos/dcbw/flannel/releases{/id}","created_at":"2015-07-21T18:48:32Z","updated_at":"2015-07-21T18:48:33Z","pushed_at":"2015-08-17T22:32:51Z","git_url":"git://github.com/dcbw/flannel.git","ssh_url":"git@github.com:dcbw/flannel.git","clone_url":"https://github.com/dcbw/flannel.git","svn_url":"https://github.com/dcbw/flannel","homepage":"","size":3093,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"7cdab689e5cd3d0036ca02a86750a5a0ee6449dd","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":21704134,"name":"flannel","full_name":"coreos/flannel","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/flannel","description":"flannel is an etcd backed network fabric for containers","fork":false,"url":"https://api.github.com/repos/coreos/flannel","forks_url":"https://api.github.com/repos/coreos/flannel/forks","keys_url":"https://api.github.com/repos/coreos/flannel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/flannel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/flannel/teams","hooks_url":"https://api.github.com/repos/coreos/flannel/hooks","issue_events_url":"https://api.github.com/repos/coreos/flannel/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/flannel/events","assignees_url":"https://api.github.com/repos/coreos/flannel/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/flannel/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/flannel/tags","blobs_url":"https://api.github.com/repos/coreos/flannel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/flannel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/flannel/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/flannel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/flannel/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/flannel/languages","stargazers_url":"https://api.github.com/repos/coreos/flannel/stargazers","contributors_url":"https://api.github.com/repos/coreos/flannel/contributors","subscribers_url":"https://api.github.com/repos/coreos/flannel/subscribers","subscription_url":"https://api.github.com/repos/coreos/flannel/subscription","commits_url":"https://api.github.com/repos/coreos/flannel/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/flannel/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/flannel/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/flannel/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/flannel/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/flannel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/flannel/merges","archive_url":"https://api.github.com/repos/coreos/flannel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/flannel/downloads","issues_url":"https://api.github.com/repos/coreos/flannel/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/flannel/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/flannel/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/flannel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/flannel/labels{/name}","releases_url":"https://api.github.com/repos/coreos/flannel/releases{/id}","created_at":"2014-07-10T17:45:29Z","updated_at":"2015-08-17T01:46:17Z","pushed_at":"2015-08-18T00:48:44Z","git_url":"git://github.com/coreos/flannel.git","ssh_url":"git@github.com:coreos/flannel.git","clone_url":"https://github.com/coreos/flannel.git","svn_url":"https://github.com/coreos/flannel","homepage":"","size":4204,"stargazers_count":876,"watchers_count":876,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":40,"forks":111,"open_issues":40,"watchers":876,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/flannel/pulls/284"},"html":{"href":"https://github.com/coreos/flannel/pull/284"},"issue":{"href":"https://api.github.com/repos/coreos/flannel/issues/284"},"comments":{"href":"https://api.github.com/repos/coreos/flannel/issues/284/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/flannel/pulls/284/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/flannel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/flannel/pulls/284/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/flannel/statuses/11b89838a17b05abd547cf78ff0dccea44460f98"}}}}