{"action":"created","comment":{"url":"https://api.github.com/repos/containers/image/pulls/comments/91789609","pull_request_review_id":12302208,"id":91789609,"diff_hunk":"@@ -301,10 +295,43 @@ type diffIDResult struct {\n \terr    error\n }\n \n+// layerCopier allows copyLayer to cache mappings between srcInfo.Digest values and returned diffIDs, so that it can return diffIDs even when it's taking the ReapplyBlob shortcut.\n+type layerCopier struct {\n+\tcachedDiffIDs map[digest.Digest]digest.Digest\n+}\n+\n // copyLayer copies a layer with srcInfo (with known Digest and possibly known Size) in src to dest, perhaps compressing it if canCompress,\n // and returns a complete blobInfo of the copied layer, and a value for LayerDiffIDs if diffIDIsNeeded\n-func copyLayer(dest types.ImageDestination, src types.ImageSource, srcInfo types.BlobInfo,\n+func (lc *layerCopier) copyLayer(dest types.ImageDestination, src types.ImageSource, srcInfo types.BlobInfo,\n \tdiffIDIsNeeded bool, canCompress bool, reportWriter io.Writer) (types.BlobInfo, digest.Digest, error) {\n+\tif lc.cachedDiffIDs == nil {\n+\t\tlc.cachedDiffIDs = make(map[digest.Digest]digest.Digest)\n+\t}\n+\t// Check if we already have a blob with this digest\n+\thaveBlob, extantBlobSize, err := dest.HasBlob(srcInfo)\n+\tif err != nil {\n+\t\treturn types.BlobInfo{}, \"\", fmt.Errorf(\"Error checking for blob %s at destination: %v\", srcInfo.Digest, err)\n+\t}\n+\t// If we already have a cached diffID for this blob, we don't need to compute it\n+\tdiffIDIsNeeded = diffIDIsNeeded && (lc.cachedDiffIDs[srcInfo.Digest] == \"\")\n+\t// If we already have the blob, and we don't need to recompute the diffID, then we might be able to avoid reading it again\n+\tif haveBlob && !diffIDIsNeeded {\n+\t\t// Check the blob sizes match, if we were given a size this time\n+\t\tif srcInfo.Size != -1 && srcInfo.Size != extantBlobSize {\n+\t\t\treturn types.BlobInfo{}, \"\", fmt.Errorf(\"Error checking blob size for %s: %v\", srcInfo.Digest, err)","path":"copy/copy.go","position":86,"original_position":86,"commit_id":"7d14a9f0b452fa7779c740b619dc7468beca143c","original_commit_id":"ac39c8b4b29a490ff8148fb4691321be32b8acb2","user":{"login":"nalind","id":1200159,"avatar_url":"https://avatars.githubusercontent.com/u/1200159?v=3","gravatar_id":"","url":"https://api.github.com/users/nalind","html_url":"https://github.com/nalind","followers_url":"https://api.github.com/users/nalind/followers","following_url":"https://api.github.com/users/nalind/following{/other_user}","gists_url":"https://api.github.com/users/nalind/gists{/gist_id}","starred_url":"https://api.github.com/users/nalind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalind/subscriptions","organizations_url":"https://api.github.com/users/nalind/orgs","repos_url":"https://api.github.com/users/nalind/repos","events_url":"https://api.github.com/users/nalind/events{/privacy}","received_events_url":"https://api.github.com/users/nalind/received_events","type":"User","site_admin":false},"body":"Good idea.  Changing.","created_at":"2016-12-09T20:28:13Z","updated_at":"2016-12-09T20:28:13Z","html_url":"https://github.com/containers/image/pull/63#discussion_r91789609","pull_request_url":"https://api.github.com/repos/containers/image/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/containers/image/pulls/comments/91789609"},"html":{"href":"https://github.com/containers/image/pull/63#discussion_r91789609"},"pull_request":{"href":"https://api.github.com/repos/containers/image/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/containers/image/pulls/63","id":83463408,"html_url":"https://github.com/containers/image/pull/63","diff_url":"https://github.com/containers/image/pull/63.diff","patch_url":"https://github.com/containers/image/pull/63.patch","issue_url":"https://api.github.com/repos/containers/image/issues/63","number":63,"state":"open","locked":false,"title":"Add support for containers/storage","user":{"login":"nalind","id":1200159,"avatar_url":"https://avatars.githubusercontent.com/u/1200159?v=3","gravatar_id":"","url":"https://api.github.com/users/nalind","html_url":"https://github.com/nalind","followers_url":"https://api.github.com/users/nalind/followers","following_url":"https://api.github.com/users/nalind/following{/other_user}","gists_url":"https://api.github.com/users/nalind/gists{/gist_id}","starred_url":"https://api.github.com/users/nalind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalind/subscriptions","organizations_url":"https://api.github.com/users/nalind/orgs","repos_url":"https://api.github.com/users/nalind/repos","events_url":"https://api.github.com/users/nalind/events{/privacy}","received_events_url":"https://api.github.com/users/nalind/received_events","type":"User","site_admin":false},"body":"This patch adds containers/storage as a backend type called 'oci-storage', using a storage.Mall initialized with the library's default settings, or using an externally-initialized storage.Mall.\n\nAn image's blobs are stored either as oci-storage layers (if they look like filesystem layers) or (alongside the manifest and signatures) as named big data items associated with the image.\n\nRecord-keeping (so that we can remember which blobs were layers and which weren't) are encoded as a JSON object which is stored as the oci-storage image's metadata.\n\nThe type of compression which we detected around a layer blob when it was imported is encoded as a field in a JSON object which is stored as the oci-storage layer object's metadata, and is reapplied if we need to export the layer later.\n\nIf we find ourselves importing an image with the same ID as an image that we already have, we return an error.  If we find ourselves importing an image which contains layers which we already have, we flag\nan error if its contents differ from the one we already have, otherwise we accept it.\n\nIf we find ourselves importing an image that wants to be tagged with a name that is already in use, the name is assigned to the new image and the old image remains otherwise unmodified.\n","created_at":"2016-08-31T14:27:56Z","updated_at":"2016-12-09T20:28:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b84ed087b9d91d3705d6aad031e675f0d92b41f9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/containers/image/pulls/63/commits","review_comments_url":"https://api.github.com/repos/containers/image/pulls/63/comments","review_comment_url":"https://api.github.com/repos/containers/image/pulls/comments{/number}","comments_url":"https://api.github.com/repos/containers/image/issues/63/comments","statuses_url":"https://api.github.com/repos/containers/image/statuses/7d14a9f0b452fa7779c740b619dc7468beca143c","head":{"label":"nalind:add-storage-transport","ref":"add-storage-transport","sha":"7d14a9f0b452fa7779c740b619dc7468beca143c","user":{"login":"nalind","id":1200159,"avatar_url":"https://avatars.githubusercontent.com/u/1200159?v=3","gravatar_id":"","url":"https://api.github.com/users/nalind","html_url":"https://github.com/nalind","followers_url":"https://api.github.com/users/nalind/followers","following_url":"https://api.github.com/users/nalind/following{/other_user}","gists_url":"https://api.github.com/users/nalind/gists{/gist_id}","starred_url":"https://api.github.com/users/nalind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalind/subscriptions","organizations_url":"https://api.github.com/users/nalind/orgs","repos_url":"https://api.github.com/users/nalind/repos","events_url":"https://api.github.com/users/nalind/events{/privacy}","received_events_url":"https://api.github.com/users/nalind/received_events","type":"User","site_admin":false},"repo":{"id":65415381,"name":"image","full_name":"nalind/image","owner":{"login":"nalind","id":1200159,"avatar_url":"https://avatars.githubusercontent.com/u/1200159?v=3","gravatar_id":"","url":"https://api.github.com/users/nalind","html_url":"https://github.com/nalind","followers_url":"https://api.github.com/users/nalind/followers","following_url":"https://api.github.com/users/nalind/following{/other_user}","gists_url":"https://api.github.com/users/nalind/gists{/gist_id}","starred_url":"https://api.github.com/users/nalind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalind/subscriptions","organizations_url":"https://api.github.com/users/nalind/orgs","repos_url":"https://api.github.com/users/nalind/repos","events_url":"https://api.github.com/users/nalind/events{/privacy}","received_events_url":"https://api.github.com/users/nalind/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nalind/image","description":"Work with containers' images","fork":true,"url":"https://api.github.com/repos/nalind/image","forks_url":"https://api.github.com/repos/nalind/image/forks","keys_url":"https://api.github.com/repos/nalind/image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nalind/image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nalind/image/teams","hooks_url":"https://api.github.com/repos/nalind/image/hooks","issue_events_url":"https://api.github.com/repos/nalind/image/issues/events{/number}","events_url":"https://api.github.com/repos/nalind/image/events","assignees_url":"https://api.github.com/repos/nalind/image/assignees{/user}","branches_url":"https://api.github.com/repos/nalind/image/branches{/branch}","tags_url":"https://api.github.com/repos/nalind/image/tags","blobs_url":"https://api.github.com/repos/nalind/image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nalind/image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nalind/image/git/refs{/sha}","trees_url":"https://api.github.com/repos/nalind/image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nalind/image/statuses/{sha}","languages_url":"https://api.github.com/repos/nalind/image/languages","stargazers_url":"https://api.github.com/repos/nalind/image/stargazers","contributors_url":"https://api.github.com/repos/nalind/image/contributors","subscribers_url":"https://api.github.com/repos/nalind/image/subscribers","subscription_url":"https://api.github.com/repos/nalind/image/subscription","commits_url":"https://api.github.com/repos/nalind/image/commits{/sha}","git_commits_url":"https://api.github.com/repos/nalind/image/git/commits{/sha}","comments_url":"https://api.github.com/repos/nalind/image/comments{/number}","issue_comment_url":"https://api.github.com/repos/nalind/image/issues/comments{/number}","contents_url":"https://api.github.com/repos/nalind/image/contents/{+path}","compare_url":"https://api.github.com/repos/nalind/image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nalind/image/merges","archive_url":"https://api.github.com/repos/nalind/image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nalind/image/downloads","issues_url":"https://api.github.com/repos/nalind/image/issues{/number}","pulls_url":"https://api.github.com/repos/nalind/image/pulls{/number}","milestones_url":"https://api.github.com/repos/nalind/image/milestones{/number}","notifications_url":"https://api.github.com/repos/nalind/image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nalind/image/labels{/name}","releases_url":"https://api.github.com/repos/nalind/image/releases{/id}","deployments_url":"https://api.github.com/repos/nalind/image/deployments","created_at":"2016-08-10T20:46:37Z","updated_at":"2016-08-10T20:46:38Z","pushed_at":"2016-12-08T17:48:03Z","git_url":"git://github.com/nalind/image.git","ssh_url":"git@github.com:nalind/image.git","clone_url":"https://github.com/nalind/image.git","svn_url":"https://github.com/nalind/image","homepage":"","size":2786,"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":"containers:master","ref":"master","sha":"bad049ae43b296d84e83b204d27f7df8751b460d","user":{"login":"containers","id":5874934,"avatar_url":"https://avatars.githubusercontent.com/u/5874934?v=3","gravatar_id":"","url":"https://api.github.com/users/containers","html_url":"https://github.com/containers","followers_url":"https://api.github.com/users/containers/followers","following_url":"https://api.github.com/users/containers/following{/other_user}","gists_url":"https://api.github.com/users/containers/gists{/gist_id}","starred_url":"https://api.github.com/users/containers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containers/subscriptions","organizations_url":"https://api.github.com/users/containers/orgs","repos_url":"https://api.github.com/users/containers/repos","events_url":"https://api.github.com/users/containers/events{/privacy}","received_events_url":"https://api.github.com/users/containers/received_events","type":"Organization","site_admin":false},"repo":{"id":61739430,"name":"image","full_name":"containers/image","owner":{"login":"containers","id":5874934,"avatar_url":"https://avatars.githubusercontent.com/u/5874934?v=3","gravatar_id":"","url":"https://api.github.com/users/containers","html_url":"https://github.com/containers","followers_url":"https://api.github.com/users/containers/followers","following_url":"https://api.github.com/users/containers/following{/other_user}","gists_url":"https://api.github.com/users/containers/gists{/gist_id}","starred_url":"https://api.github.com/users/containers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containers/subscriptions","organizations_url":"https://api.github.com/users/containers/orgs","repos_url":"https://api.github.com/users/containers/repos","events_url":"https://api.github.com/users/containers/events{/privacy}","received_events_url":"https://api.github.com/users/containers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/containers/image","description":"Work with containers' images","fork":false,"url":"https://api.github.com/repos/containers/image","forks_url":"https://api.github.com/repos/containers/image/forks","keys_url":"https://api.github.com/repos/containers/image/keys{/key_id}","collaborators_url":"https://api.github.com/repos/containers/image/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/containers/image/teams","hooks_url":"https://api.github.com/repos/containers/image/hooks","issue_events_url":"https://api.github.com/repos/containers/image/issues/events{/number}","events_url":"https://api.github.com/repos/containers/image/events","assignees_url":"https://api.github.com/repos/containers/image/assignees{/user}","branches_url":"https://api.github.com/repos/containers/image/branches{/branch}","tags_url":"https://api.github.com/repos/containers/image/tags","blobs_url":"https://api.github.com/repos/containers/image/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/containers/image/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/containers/image/git/refs{/sha}","trees_url":"https://api.github.com/repos/containers/image/git/trees{/sha}","statuses_url":"https://api.github.com/repos/containers/image/statuses/{sha}","languages_url":"https://api.github.com/repos/containers/image/languages","stargazers_url":"https://api.github.com/repos/containers/image/stargazers","contributors_url":"https://api.github.com/repos/containers/image/contributors","subscribers_url":"https://api.github.com/repos/containers/image/subscribers","subscription_url":"https://api.github.com/repos/containers/image/subscription","commits_url":"https://api.github.com/repos/containers/image/commits{/sha}","git_commits_url":"https://api.github.com/repos/containers/image/git/commits{/sha}","comments_url":"https://api.github.com/repos/containers/image/comments{/number}","issue_comment_url":"https://api.github.com/repos/containers/image/issues/comments{/number}","contents_url":"https://api.github.com/repos/containers/image/contents/{+path}","compare_url":"https://api.github.com/repos/containers/image/compare/{base}...{head}","merges_url":"https://api.github.com/repos/containers/image/merges","archive_url":"https://api.github.com/repos/containers/image/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/containers/image/downloads","issues_url":"https://api.github.com/repos/containers/image/issues{/number}","pulls_url":"https://api.github.com/repos/containers/image/pulls{/number}","milestones_url":"https://api.github.com/repos/containers/image/milestones{/number}","notifications_url":"https://api.github.com/repos/containers/image/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/containers/image/labels{/name}","releases_url":"https://api.github.com/repos/containers/image/releases{/id}","deployments_url":"https://api.github.com/repos/containers/image/deployments","created_at":"2016-06-22T17:46:41Z","updated_at":"2016-11-12T00:57:15Z","pushed_at":"2016-12-09T16:35:03Z","git_url":"git://github.com/containers/image.git","ssh_url":"git@github.com:containers/image.git","clone_url":"https://github.com/containers/image.git","svn_url":"https://github.com/containers/image","homepage":"","size":2857,"stargazers_count":59,"watchers_count":59,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":36,"forks":25,"open_issues":36,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/containers/image/pulls/63"},"html":{"href":"https://github.com/containers/image/pull/63"},"issue":{"href":"https://api.github.com/repos/containers/image/issues/63"},"comments":{"href":"https://api.github.com/repos/containers/image/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/containers/image/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/containers/image/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/containers/image/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/containers/image/statuses/7d14a9f0b452fa7779c740b619dc7468beca143c"}}}}
{"actor":{"display_login":"nalind"}}