{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/comments/172362859","pull_request_review_id":101367057,"id":172362859,"diff_hunk":"@@ -57,13 +57,15 @@ type imageCacheItem struct {\n \tconfigDigest digest.Digest\n }\n \n+type imageCache map[string]imageCacheItem\n+\n type imageService struct {\n \tstore                 storage.Store\n \tdefaultTransport      string\n \tinsecureRegistryCIDRs []*net.IPNet\n \tindexConfigs          map[string]*indexInfo\n \tregistries            []string\n-\timageCache            map[string]imageCacheItem\n+\timageCache            imageCache","path":"pkg/storage/image.go","position":13,"original_position":13,"commit_id":"4cddd75130be0a3b21397a170c4022c14c000f0b","original_commit_id":"4cddd75130be0a3b21397a170c4022c14c000f0b","user":{"login":"nalind","id":1200159,"avatar_url":"https://avatars0.githubusercontent.com/u/1200159?v=4","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":"We're trying to save the effort of JSON umarshalling that `NewImage()` does, so we cache the things about the image that don't (can't) change and that aren't directly in the `storage.Image` that we're already looking up, which we would have to parse the image's manifest and/or config blob to figure out.  On a node with a large number of images, that's a lot of parsing data that doesn't change over the lifetime of the image, to obtain the same results every time.","created_at":"2018-03-05T23:20:06Z","updated_at":"2018-03-05T23:20:06Z","html_url":"https://github.com/kubernetes-incubator/cri-o/pull/1415#discussion_r172362859","pull_request_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/comments/172362859"},"html":{"href":"https://github.com/kubernetes-incubator/cri-o/pull/1415#discussion_r172362859"},"pull_request":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415"}},"in_reply_to_id":172055806},"pull_request":{"url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415","id":172696600,"html_url":"https://github.com/kubernetes-incubator/cri-o/pull/1415","diff_url":"https://github.com/kubernetes-incubator/cri-o/pull/1415.diff","patch_url":"https://github.com/kubernetes-incubator/cri-o/pull/1415.patch","issue_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/1415","number":1415,"state":"open","locked":false,"title":"Image cache lock","user":{"login":"redbaron","id":16624,"avatar_url":"https://avatars3.githubusercontent.com/u/16624?v=4","gravatar_id":"","url":"https://api.github.com/users/redbaron","html_url":"https://github.com/redbaron","followers_url":"https://api.github.com/users/redbaron/followers","following_url":"https://api.github.com/users/redbaron/following{/other_user}","gists_url":"https://api.github.com/users/redbaron/gists{/gist_id}","starred_url":"https://api.github.com/users/redbaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbaron/subscriptions","organizations_url":"https://api.github.com/users/redbaron/orgs","repos_url":"https://api.github.com/users/redbaron/repos","events_url":"https://api.github.com/users/redbaron/events{/privacy}","received_events_url":"https://api.github.com/users/redbaron/received_events","type":"User","site_admin":false},"body":"Refactor some code around imageCache handling. Primarily fixes missing locking, but also simplifies logic a little","created_at":"2018-03-04T01:14:54Z","updated_at":"2018-03-05T23:20:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25f0ec3cfb38c5e2727cd55ddf7638b40154b8dd","assignee":null,"assignees":[],"requested_reviewers":[{"login":"runcom","id":849915,"avatar_url":"https://avatars2.githubusercontent.com/u/849915?v=4","gravatar_id":"","url":"https://api.github.com/users/runcom","html_url":"https://github.com/runcom","followers_url":"https://api.github.com/users/runcom/followers","following_url":"https://api.github.com/users/runcom/following{/other_user}","gists_url":"https://api.github.com/users/runcom/gists{/gist_id}","starred_url":"https://api.github.com/users/runcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/runcom/subscriptions","organizations_url":"https://api.github.com/users/runcom/orgs","repos_url":"https://api.github.com/users/runcom/repos","events_url":"https://api.github.com/users/runcom/events{/privacy}","received_events_url":"https://api.github.com/users/runcom/received_events","type":"User","site_admin":false},{"login":"nalind","id":1200159,"avatar_url":"https://avatars0.githubusercontent.com/u/1200159?v=4","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},{"login":"rhatdan","id":2000835,"avatar_url":"https://avatars3.githubusercontent.com/u/2000835?v=4","gravatar_id":"","url":"https://api.github.com/users/rhatdan","html_url":"https://github.com/rhatdan","followers_url":"https://api.github.com/users/rhatdan/followers","following_url":"https://api.github.com/users/rhatdan/following{/other_user}","gists_url":"https://api.github.com/users/rhatdan/gists{/gist_id}","starred_url":"https://api.github.com/users/rhatdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhatdan/subscriptions","organizations_url":"https://api.github.com/users/rhatdan/orgs","repos_url":"https://api.github.com/users/rhatdan/repos","events_url":"https://api.github.com/users/rhatdan/events{/privacy}","received_events_url":"https://api.github.com/users/rhatdan/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":484626496,"url":"https://api.github.com/repos/kubernetes-incubator/cri-o/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"ededed","default":false},{"id":676478956,"url":"https://api.github.com/repos/kubernetes-incubator/cri-o/labels/size/L","name":"size/L","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415/commits","review_comments_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415/comments","review_comment_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/1415/comments","statuses_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/statuses/4cddd75130be0a3b21397a170c4022c14c000f0b","head":{"label":"redbaron:image-cache-lock","ref":"image-cache-lock","sha":"4cddd75130be0a3b21397a170c4022c14c000f0b","user":{"login":"redbaron","id":16624,"avatar_url":"https://avatars3.githubusercontent.com/u/16624?v=4","gravatar_id":"","url":"https://api.github.com/users/redbaron","html_url":"https://github.com/redbaron","followers_url":"https://api.github.com/users/redbaron/followers","following_url":"https://api.github.com/users/redbaron/following{/other_user}","gists_url":"https://api.github.com/users/redbaron/gists{/gist_id}","starred_url":"https://api.github.com/users/redbaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbaron/subscriptions","organizations_url":"https://api.github.com/users/redbaron/orgs","repos_url":"https://api.github.com/users/redbaron/repos","events_url":"https://api.github.com/users/redbaron/events{/privacy}","received_events_url":"https://api.github.com/users/redbaron/received_events","type":"User","site_admin":false},"repo":{"id":123725174,"name":"cri-o","full_name":"redbaron/cri-o","owner":{"login":"redbaron","id":16624,"avatar_url":"https://avatars3.githubusercontent.com/u/16624?v=4","gravatar_id":"","url":"https://api.github.com/users/redbaron","html_url":"https://github.com/redbaron","followers_url":"https://api.github.com/users/redbaron/followers","following_url":"https://api.github.com/users/redbaron/following{/other_user}","gists_url":"https://api.github.com/users/redbaron/gists{/gist_id}","starred_url":"https://api.github.com/users/redbaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbaron/subscriptions","organizations_url":"https://api.github.com/users/redbaron/orgs","repos_url":"https://api.github.com/users/redbaron/repos","events_url":"https://api.github.com/users/redbaron/events{/privacy}","received_events_url":"https://api.github.com/users/redbaron/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/redbaron/cri-o","description":"Open Container Initiative-based implementation of Kubernetes Container Runtime Interface","fork":true,"url":"https://api.github.com/repos/redbaron/cri-o","forks_url":"https://api.github.com/repos/redbaron/cri-o/forks","keys_url":"https://api.github.com/repos/redbaron/cri-o/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redbaron/cri-o/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redbaron/cri-o/teams","hooks_url":"https://api.github.com/repos/redbaron/cri-o/hooks","issue_events_url":"https://api.github.com/repos/redbaron/cri-o/issues/events{/number}","events_url":"https://api.github.com/repos/redbaron/cri-o/events","assignees_url":"https://api.github.com/repos/redbaron/cri-o/assignees{/user}","branches_url":"https://api.github.com/repos/redbaron/cri-o/branches{/branch}","tags_url":"https://api.github.com/repos/redbaron/cri-o/tags","blobs_url":"https://api.github.com/repos/redbaron/cri-o/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redbaron/cri-o/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redbaron/cri-o/git/refs{/sha}","trees_url":"https://api.github.com/repos/redbaron/cri-o/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redbaron/cri-o/statuses/{sha}","languages_url":"https://api.github.com/repos/redbaron/cri-o/languages","stargazers_url":"https://api.github.com/repos/redbaron/cri-o/stargazers","contributors_url":"https://api.github.com/repos/redbaron/cri-o/contributors","subscribers_url":"https://api.github.com/repos/redbaron/cri-o/subscribers","subscription_url":"https://api.github.com/repos/redbaron/cri-o/subscription","commits_url":"https://api.github.com/repos/redbaron/cri-o/commits{/sha}","git_commits_url":"https://api.github.com/repos/redbaron/cri-o/git/commits{/sha}","comments_url":"https://api.github.com/repos/redbaron/cri-o/comments{/number}","issue_comment_url":"https://api.github.com/repos/redbaron/cri-o/issues/comments{/number}","contents_url":"https://api.github.com/repos/redbaron/cri-o/contents/{+path}","compare_url":"https://api.github.com/repos/redbaron/cri-o/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redbaron/cri-o/merges","archive_url":"https://api.github.com/repos/redbaron/cri-o/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redbaron/cri-o/downloads","issues_url":"https://api.github.com/repos/redbaron/cri-o/issues{/number}","pulls_url":"https://api.github.com/repos/redbaron/cri-o/pulls{/number}","milestones_url":"https://api.github.com/repos/redbaron/cri-o/milestones{/number}","notifications_url":"https://api.github.com/repos/redbaron/cri-o/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redbaron/cri-o/labels{/name}","releases_url":"https://api.github.com/repos/redbaron/cri-o/releases{/id}","deployments_url":"https://api.github.com/repos/redbaron/cri-o/deployments","created_at":"2018-03-03T19:39:52Z","updated_at":"2018-03-03T19:39:55Z","pushed_at":"2018-03-04T11:22:48Z","git_url":"git://github.com/redbaron/cri-o.git","ssh_url":"git@github.com:redbaron/cri-o.git","clone_url":"https://github.com/redbaron/cri-o.git","svn_url":"https://github.com/redbaron/cri-o","homepage":"","size":41526,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes-incubator:master","ref":"master","sha":"779e3501f3cb36f9ccbc31755bd59766ce524860","user":{"login":"kubernetes-incubator","id":20862812,"avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":67828134,"name":"cri-o","full_name":"kubernetes-incubator/cri-o","owner":{"login":"kubernetes-incubator","id":20862812,"avatar_url":"https://avatars2.githubusercontent.com/u/20862812?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes-incubator","html_url":"https://github.com/kubernetes-incubator","followers_url":"https://api.github.com/users/kubernetes-incubator/followers","following_url":"https://api.github.com/users/kubernetes-incubator/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes-incubator/subscriptions","organizations_url":"https://api.github.com/users/kubernetes-incubator/orgs","repos_url":"https://api.github.com/users/kubernetes-incubator/repos","events_url":"https://api.github.com/users/kubernetes-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes-incubator/cri-o","description":"Open Container Initiative-based implementation of Kubernetes Container Runtime Interface","fork":false,"url":"https://api.github.com/repos/kubernetes-incubator/cri-o","forks_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/forks","keys_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/teams","hooks_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/hooks","issue_events_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/events","assignees_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/tags","blobs_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/languages","stargazers_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/stargazers","contributors_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/contributors","subscribers_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/subscribers","subscription_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/subscription","commits_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/merges","archive_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/downloads","issues_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes-incubator/cri-o/deployments","created_at":"2016-09-09T19:56:31Z","updated_at":"2018-03-04T21:02:20Z","pushed_at":"2018-03-05T23:10:23Z","git_url":"git://github.com/kubernetes-incubator/cri-o.git","ssh_url":"git@github.com:kubernetes-incubator/cri-o.git","clone_url":"https://github.com/kubernetes-incubator/cri-o.git","svn_url":"https://github.com/kubernetes-incubator/cri-o","homepage":"","size":41527,"stargazers_count":943,"watchers_count":943,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":190,"mirror_url":null,"archived":false,"open_issues_count":99,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":190,"open_issues":99,"watchers":943,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415"},"html":{"href":"https://github.com/kubernetes-incubator/cri-o/pull/1415"},"issue":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/1415"},"comments":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/issues/1415/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/pulls/1415/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes-incubator/cri-o/statuses/4cddd75130be0a3b21397a170c4022c14c000f0b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nalind"}}