{"action":"created","comment":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/comments/79482480","id":79482480,"diff_hunk":"@@ -55,3 +58,22 @@ type snapDetails struct {\n \tPrivate     bool   `json:\"private\"`\n \tConfinement string `json:\"confinement\"`\n }\n+\n+type snapDeltaDetail struct {\n+\tFromRevision    int    `json:\"from_revision\"`\n+\tToRevision      int    `json:\"to_revision\"`\n+\tFormat          string `json:\"format\"`\n+\tAnonDownloadURL string `json:\"anon_download_url,omitempty\"`\n+\tDownloadURL     string `json:\"download_url,omitempty\"`\n+\tSize            int64  `json:\"binary_filesize,omitempty\"`\n+\tSha3_384        string `json:\"download_sha3_384,omitempty\"`\n+}\n+\n+func getDefaultDetailFields() []string {\n+\tfields := getStructFields(snapDetails{})\n+\t// Don't include deltas in the default DetailFields. Instead they'll","path":"store/details.go","position":34,"original_position":34,"commit_id":"6f2f7b37e4ad0bd99ab451b2b5c2a2facc051558","original_commit_id":"6f2f7b37e4ad0bd99ab451b2b5c2a2facc051558","user":{"login":"absoludity","id":497518,"avatar_url":"https://avatars.githubusercontent.com/u/497518?v=3","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"body":"Yes, I'd done that initially, but then we thought we may need to be more conservative and only request deltas when feature-switch was on (so that we're not affecting the default behaviour when deltas are not on). I'll update.","created_at":"2016-09-19T20:33:05Z","updated_at":"2016-09-19T20:33:05Z","html_url":"https://github.com/snapcore/snapd/pull/1942#discussion_r79482480","pull_request_url":"https://api.github.com/repos/snapcore/snapd/pulls/1942","_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments/79482480"},"html":{"href":"https://github.com/snapcore/snapd/pull/1942#discussion_r79482480"},"pull_request":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1942"}}},"pull_request":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/1942","id":85769762,"html_url":"https://github.com/snapcore/snapd/pull/1942","diff_url":"https://github.com/snapcore/snapd/pull/1942.diff","patch_url":"https://github.com/snapcore/snapd/pull/1942.patch","issue_url":"https://api.github.com/repos/snapcore/snapd/issues/1942","number":1942,"state":"open","locked":false,"title":"store,snap: initial support for delta downloads","user":{"login":"absoludity","id":497518,"avatar_url":"https://avatars.githubusercontent.com/u/497518?v=3","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"body":"This branch updates the store ListRefresh function to request and parse download delta information *only* when the SNAPPY_DELTA_DOWNLOAD_FORMATS env var is set.\r\n\r\nIn particular, the X-Ubuntu-Delta-Formats header is only included in the request if the env var is set (but when set, the header is added for all requests - I didn't see any examples of adding headers for a specific call - let me know if I should do that instead).\r\n\r\nThe current code defaulted the Store.detailFields to all fields on the private snapDetails struct, so with the aim of being conservative and maintaining the current set of fields requested in the general case, I've added the getDefaultDetailFields() helper, and only the ListRefresh function (when the above env var is set) will include \"deltas\" in the requested fields.\r\n\r\nI couldn't see any reason for the private package global detailFields - other than for use in comparison in tests - which could now use the getDefaultDetailFields() helper, so I've removed it (again, let me know if there's a good reason for it and I'll happily revert that), but I hope it's clearer either way.\r\n\r\nI'd like to follow this up with a branch which will - again, only when the SNAPPY_DELTA_DOWNLOAD_FORMATS is set - download an available delta when set.\r\n\r\nThanks!\r\n\r\n","created_at":"2016-09-19T10:32:58Z","updated_at":"2016-09-19T20:33:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06604bee3d533898a744fc3849ed288b4035c6ef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/snapcore/snapd/pulls/1942/commits","review_comments_url":"https://api.github.com/repos/snapcore/snapd/pulls/1942/comments","review_comment_url":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snapcore/snapd/issues/1942/comments","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/6f2f7b37e4ad0bd99ab451b2b5c2a2facc051558","head":{"label":"absoludity:test-deltas","ref":"test-deltas","sha":"6f2f7b37e4ad0bd99ab451b2b5c2a2facc051558","user":{"login":"absoludity","id":497518,"avatar_url":"https://avatars.githubusercontent.com/u/497518?v=3","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"repo":{"id":63668372,"name":"snapd","full_name":"absoludity/snapd","owner":{"login":"absoludity","id":497518,"avatar_url":"https://avatars.githubusercontent.com/u/497518?v=3","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/absoludity/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":true,"url":"https://api.github.com/repos/absoludity/snapd","forks_url":"https://api.github.com/repos/absoludity/snapd/forks","keys_url":"https://api.github.com/repos/absoludity/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/absoludity/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/absoludity/snapd/teams","hooks_url":"https://api.github.com/repos/absoludity/snapd/hooks","issue_events_url":"https://api.github.com/repos/absoludity/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/absoludity/snapd/events","assignees_url":"https://api.github.com/repos/absoludity/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/absoludity/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/absoludity/snapd/tags","blobs_url":"https://api.github.com/repos/absoludity/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/absoludity/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/absoludity/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/absoludity/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/absoludity/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/absoludity/snapd/languages","stargazers_url":"https://api.github.com/repos/absoludity/snapd/stargazers","contributors_url":"https://api.github.com/repos/absoludity/snapd/contributors","subscribers_url":"https://api.github.com/repos/absoludity/snapd/subscribers","subscription_url":"https://api.github.com/repos/absoludity/snapd/subscription","commits_url":"https://api.github.com/repos/absoludity/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/absoludity/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/absoludity/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/absoludity/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/absoludity/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/absoludity/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/absoludity/snapd/merges","archive_url":"https://api.github.com/repos/absoludity/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/absoludity/snapd/downloads","issues_url":"https://api.github.com/repos/absoludity/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/absoludity/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/absoludity/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/absoludity/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/absoludity/snapd/labels{/name}","releases_url":"https://api.github.com/repos/absoludity/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/absoludity/snapd/deployments","created_at":"2016-07-19T06:45:18Z","updated_at":"2016-07-19T06:45:20Z","pushed_at":"2016-09-19T11:54:11Z","git_url":"git://github.com/absoludity/snapd.git","ssh_url":"git@github.com:absoludity/snapd.git","clone_url":"https://github.com/absoludity/snapd.git","svn_url":"https://github.com/absoludity/snapd","homepage":"","size":35654,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"snapcore:master","ref":"master","sha":"181f66ac30bc3a2bfb8e83c809019c037d34d1f3","user":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snapd","full_name":"snapcore/snapd","owner":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snapcore/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":false,"url":"https://api.github.com/repos/snapcore/snapd","forks_url":"https://api.github.com/repos/snapcore/snapd/forks","keys_url":"https://api.github.com/repos/snapcore/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snapcore/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snapcore/snapd/teams","hooks_url":"https://api.github.com/repos/snapcore/snapd/hooks","issue_events_url":"https://api.github.com/repos/snapcore/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/snapcore/snapd/events","assignees_url":"https://api.github.com/repos/snapcore/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/snapcore/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/snapcore/snapd/tags","blobs_url":"https://api.github.com/repos/snapcore/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snapcore/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snapcore/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/snapcore/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/snapcore/snapd/languages","stargazers_url":"https://api.github.com/repos/snapcore/snapd/stargazers","contributors_url":"https://api.github.com/repos/snapcore/snapd/contributors","subscribers_url":"https://api.github.com/repos/snapcore/snapd/subscribers","subscription_url":"https://api.github.com/repos/snapcore/snapd/subscription","commits_url":"https://api.github.com/repos/snapcore/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/snapcore/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/snapcore/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/snapcore/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/snapcore/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/snapcore/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snapcore/snapd/merges","archive_url":"https://api.github.com/repos/snapcore/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snapcore/snapd/downloads","issues_url":"https://api.github.com/repos/snapcore/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/snapcore/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/snapcore/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/snapcore/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snapcore/snapd/labels{/name}","releases_url":"https://api.github.com/repos/snapcore/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/snapcore/snapd/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2016-09-19T09:06:28Z","pushed_at":"2016-09-19T19:38:44Z","git_url":"git://github.com/snapcore/snapd.git","ssh_url":"git@github.com:snapcore/snapd.git","clone_url":"https://github.com/snapcore/snapd.git","svn_url":"https://github.com/snapcore/snapd","homepage":"","size":38263,"stargazers_count":394,"watchers_count":394,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":105,"mirror_url":null,"open_issues_count":35,"forks":105,"open_issues":35,"watchers":394,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1942"},"html":{"href":"https://github.com/snapcore/snapd/pull/1942"},"issue":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1942"},"comments":{"href":"https://api.github.com/repos/snapcore/snapd/issues/1942/comments"},"review_comments":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1942/comments"},"review_comment":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/1942/commits"},"statuses":{"href":"https://api.github.com/repos/snapcore/snapd/statuses/6f2f7b37e4ad0bd99ab451b2b5c2a2facc051558"}}}}
{"actor":{"display_login":"absoludity"}}