{"action":"created","comment":{"url":"https://api.github.com/repos/profefe/profefe/pulls/comments/242348078","pull_request_review_id":185837512,"id":242348078,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjM0ODA3OA==","diff_hunk":"@@ -1,157 +1,116 @@\n package inmemory\n \n import (\n-\t\"bytes\"\n \t\"context\"\n \t\"crypto/sha1\"\n \t\"encoding/hex\"\n-\t\"fmt\"\n \t\"io\"\n-\t\"io/ioutil\"\n \t\"sync\"\n \n \t\"github.com/profefe/profefe/pkg/profile\"\n )\n \n+type storageKey struct {\n+\tbuildID string\n+\ttoken   profile.Token\n+}\n+\n type storageItem struct {\n-\tprofile   *profile.Profile\n-\tlabelsIdx map[profile.Label]struct{}\n-\tdata      []byte\n+\tprofiles  []*profile.Profile\n+\tlabelsSet map[profile.Label]struct{}\n }\n \n type Storage struct {\n \tmu      sync.RWMutex\n-\tstorage map[profile.Digest]storageItem\n+\tstorage map[storageKey]storageItem\n }\n \n var _ profile.Storage = (*Storage)(nil)\n \n func New() *Storage {\n \treturn &Storage{\n-\t\tstorage: make(map[profile.Digest]storageItem),\n+\t\tstorage: make(map[storageKey]storageItem),\n \t}\n }\n \n-func (s *Storage) Create(ctx context.Context, p *profile.Profile, r io.Reader) error {\n-\tdata, err := ioutil.ReadAll(r)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\tdgst, err := s.getDigestFor(data)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tdataCopy := make([]byte, len(data))\n-\tcopy(dataCopy, data)\n-\n-\ts.mu.Lock()\n-\tdefer s.mu.Unlock()\n-\n-\tp.Digest = dgst\n-\tp.Size = int64(len(data))\n-\n-\tif _, ok := s.storage[p.Digest]; ok {\n-\t\treturn fmt.Errorf(\"duplicate profile: %v\", p)\n-\t}\n-\n-\tlabelsIdx := make(map[profile.Label]struct{})\n-\tfor _, label := range p.Labels {\n-\t\tlabelsIdx[label] = struct{}{}\n-\t}\n-\n-\ts.storage[p.Digest] = storageItem{p, labelsIdx, dataCopy}\n-\n+func (st *Storage) Create(ctx context.Context, prof *profile.Profile) error {\n \treturn nil\n }\n \n-func (s *Storage) Open(ctx context.Context, dgst profile.Digest) (io.ReadCloser, error) {\n-\ts.mu.Lock()\n-\tdefer s.mu.Unlock()\n-\n-\tp, err := s.byDigest(ctx, dgst)\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n-\n-\treturn ioutil.NopCloser(bytes.NewReader(p.data)), nil\n+func (st *Storage) Update(ctx context.Context, prof *profile.Profile, r io.Reader) error {\n+\treturn nil\n }\n \n-func (s *Storage) Get(ctx context.Context, dgst profile.Digest) (*profile.Profile, error) {\n-\ts.mu.RLock()\n-\tdefer s.mu.RUnlock()\n-\n-\tp, err := s.byDigest(ctx, dgst)\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n+func (st *Storage) Open(ctx context.Context, dgst profile.Digest) (io.ReadCloser, error) {\n+\treturn nil, nil\n+}\n \n-\treturn p.profile, nil\n+func (st *Storage) Get(ctx context.Context, dgst profile.Digest) (*profile.Profile, error) {","path":"pkg/storage/inmemory/inmemory.go","position":105,"original_position":105,"commit_id":"b391e1c19a0803241df7497a2df5b814a21eda3b","original_commit_id":"b391e1c19a0803241df7497a2df5b814a21eda3b","user":{"login":"fixmie[bot]","id":44270338,"node_id":"MDM6Qm90NDQyNzAzMzg=","avatar_url":"https://avatars0.githubusercontent.com/in/19360?v=4","gravatar_id":"","url":"https://api.github.com/users/fixmie%5Bbot%5D","html_url":"https://github.com/apps/fixmie","followers_url":"https://api.github.com/users/fixmie%5Bbot%5D/followers","following_url":"https://api.github.com/users/fixmie%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/fixmie%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/fixmie%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fixmie%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/fixmie%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/fixmie%5Bbot%5D/repos","events_url":"https://api.github.com/users/fixmie%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/fixmie%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"exported identifier \"Get\" should have comment\n```suggestion\n// Get ...\nfunc (st *Storage) Get(ctx context.Context, dgst profile.Digest) (*profile.Profile, error) {\n```","created_at":"2018-12-17T22:53:17Z","updated_at":"2018-12-17T22:53:18Z","html_url":"https://github.com/profefe/profefe/pull/1#discussion_r242348078","pull_request_url":"https://api.github.com/repos/profefe/profefe/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/profefe/profefe/pulls/comments/242348078"},"html":{"href":"https://github.com/profefe/profefe/pull/1#discussion_r242348078"},"pull_request":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/profefe/profefe/pulls/1","id":239216099,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5MjE2MDk5","html_url":"https://github.com/profefe/profefe/pull/1","diff_url":"https://github.com/profefe/profefe/pull/1.diff","patch_url":"https://github.com/profefe/profefe/pull/1.patch","issue_url":"https://api.github.com/repos/profefe/profefe/issues/1","number":1,"state":"open","locked":false,"title":"Split profile creation request into create and update","user":{"login":"narqo","id":88045,"node_id":"MDQ6VXNlcjg4MDQ1","avatar_url":"https://avatars1.githubusercontent.com/u/88045?v=4","gravatar_id":"","url":"https://api.github.com/users/narqo","html_url":"https://github.com/narqo","followers_url":"https://api.github.com/users/narqo/followers","following_url":"https://api.github.com/users/narqo/following{/other_user}","gists_url":"https://api.github.com/users/narqo/gists{/gist_id}","starred_url":"https://api.github.com/users/narqo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narqo/subscriptions","organizations_url":"https://api.github.com/users/narqo/orgs","repos_url":"https://api.github.com/users/narqo/repos","events_url":"https://api.github.com/users/narqo/events{/privacy}","received_events_url":"https://api.github.com/users/narqo/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-17T16:58:10Z","updated_at":"2018-12-17T22:53:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8014da1059eee17c9a663350c73aec9b8b95a781","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/profefe/profefe/pulls/1/commits","review_comments_url":"https://api.github.com/repos/profefe/profefe/pulls/1/comments","review_comment_url":"https://api.github.com/repos/profefe/profefe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/profefe/profefe/issues/1/comments","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/b391e1c19a0803241df7497a2df5b814a21eda3b","head":{"label":"profefe:collector-create-meta","ref":"collector-create-meta","sha":"b391e1c19a0803241df7497a2df5b814a21eda3b","user":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"repo":{"id":133731466,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MzE0NjY=","name":"profefe","full_name":"profefe/profefe","private":false,"owner":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/profefe/profefe","description":"wip! Collect profiling data for long-term analysis","fork":false,"url":"https://api.github.com/repos/profefe/profefe","forks_url":"https://api.github.com/repos/profefe/profefe/forks","keys_url":"https://api.github.com/repos/profefe/profefe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/profefe/profefe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/profefe/profefe/teams","hooks_url":"https://api.github.com/repos/profefe/profefe/hooks","issue_events_url":"https://api.github.com/repos/profefe/profefe/issues/events{/number}","events_url":"https://api.github.com/repos/profefe/profefe/events","assignees_url":"https://api.github.com/repos/profefe/profefe/assignees{/user}","branches_url":"https://api.github.com/repos/profefe/profefe/branches{/branch}","tags_url":"https://api.github.com/repos/profefe/profefe/tags","blobs_url":"https://api.github.com/repos/profefe/profefe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/profefe/profefe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/profefe/profefe/git/refs{/sha}","trees_url":"https://api.github.com/repos/profefe/profefe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/{sha}","languages_url":"https://api.github.com/repos/profefe/profefe/languages","stargazers_url":"https://api.github.com/repos/profefe/profefe/stargazers","contributors_url":"https://api.github.com/repos/profefe/profefe/contributors","subscribers_url":"https://api.github.com/repos/profefe/profefe/subscribers","subscription_url":"https://api.github.com/repos/profefe/profefe/subscription","commits_url":"https://api.github.com/repos/profefe/profefe/commits{/sha}","git_commits_url":"https://api.github.com/repos/profefe/profefe/git/commits{/sha}","comments_url":"https://api.github.com/repos/profefe/profefe/comments{/number}","issue_comment_url":"https://api.github.com/repos/profefe/profefe/issues/comments{/number}","contents_url":"https://api.github.com/repos/profefe/profefe/contents/{+path}","compare_url":"https://api.github.com/repos/profefe/profefe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/profefe/profefe/merges","archive_url":"https://api.github.com/repos/profefe/profefe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/profefe/profefe/downloads","issues_url":"https://api.github.com/repos/profefe/profefe/issues{/number}","pulls_url":"https://api.github.com/repos/profefe/profefe/pulls{/number}","milestones_url":"https://api.github.com/repos/profefe/profefe/milestones{/number}","notifications_url":"https://api.github.com/repos/profefe/profefe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/profefe/profefe/labels{/name}","releases_url":"https://api.github.com/repos/profefe/profefe/releases{/id}","deployments_url":"https://api.github.com/repos/profefe/profefe/deployments","created_at":"2018-05-16T22:58:24Z","updated_at":"2018-12-11T00:22:50Z","pushed_at":"2018-12-17T22:53:03Z","git_url":"git://github.com/profefe/profefe.git","ssh_url":"git@github.com:profefe/profefe.git","clone_url":"https://github.com/profefe/profefe.git","svn_url":"https://github.com/profefe/profefe","homepage":"","size":1337,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"profefe:master","ref":"master","sha":"3efb002cca41ca453bfd1384ae6ec82e79c62044","user":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"repo":{"id":133731466,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MzE0NjY=","name":"profefe","full_name":"profefe/profefe","private":false,"owner":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/profefe/profefe","description":"wip! Collect profiling data for long-term analysis","fork":false,"url":"https://api.github.com/repos/profefe/profefe","forks_url":"https://api.github.com/repos/profefe/profefe/forks","keys_url":"https://api.github.com/repos/profefe/profefe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/profefe/profefe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/profefe/profefe/teams","hooks_url":"https://api.github.com/repos/profefe/profefe/hooks","issue_events_url":"https://api.github.com/repos/profefe/profefe/issues/events{/number}","events_url":"https://api.github.com/repos/profefe/profefe/events","assignees_url":"https://api.github.com/repos/profefe/profefe/assignees{/user}","branches_url":"https://api.github.com/repos/profefe/profefe/branches{/branch}","tags_url":"https://api.github.com/repos/profefe/profefe/tags","blobs_url":"https://api.github.com/repos/profefe/profefe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/profefe/profefe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/profefe/profefe/git/refs{/sha}","trees_url":"https://api.github.com/repos/profefe/profefe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/{sha}","languages_url":"https://api.github.com/repos/profefe/profefe/languages","stargazers_url":"https://api.github.com/repos/profefe/profefe/stargazers","contributors_url":"https://api.github.com/repos/profefe/profefe/contributors","subscribers_url":"https://api.github.com/repos/profefe/profefe/subscribers","subscription_url":"https://api.github.com/repos/profefe/profefe/subscription","commits_url":"https://api.github.com/repos/profefe/profefe/commits{/sha}","git_commits_url":"https://api.github.com/repos/profefe/profefe/git/commits{/sha}","comments_url":"https://api.github.com/repos/profefe/profefe/comments{/number}","issue_comment_url":"https://api.github.com/repos/profefe/profefe/issues/comments{/number}","contents_url":"https://api.github.com/repos/profefe/profefe/contents/{+path}","compare_url":"https://api.github.com/repos/profefe/profefe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/profefe/profefe/merges","archive_url":"https://api.github.com/repos/profefe/profefe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/profefe/profefe/downloads","issues_url":"https://api.github.com/repos/profefe/profefe/issues{/number}","pulls_url":"https://api.github.com/repos/profefe/profefe/pulls{/number}","milestones_url":"https://api.github.com/repos/profefe/profefe/milestones{/number}","notifications_url":"https://api.github.com/repos/profefe/profefe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/profefe/profefe/labels{/name}","releases_url":"https://api.github.com/repos/profefe/profefe/releases{/id}","deployments_url":"https://api.github.com/repos/profefe/profefe/deployments","created_at":"2018-05-16T22:58:24Z","updated_at":"2018-12-11T00:22:50Z","pushed_at":"2018-12-17T22:53:03Z","git_url":"git://github.com/profefe/profefe.git","ssh_url":"git@github.com:profefe/profefe.git","clone_url":"https://github.com/profefe/profefe.git","svn_url":"https://github.com/profefe/profefe","homepage":"","size":1337,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1"},"html":{"href":"https://github.com/profefe/profefe/pull/1"},"issue":{"href":"https://api.github.com/repos/profefe/profefe/issues/1"},"comments":{"href":"https://api.github.com/repos/profefe/profefe/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/profefe/profefe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/profefe/profefe/statuses/b391e1c19a0803241df7497a2df5b814a21eda3b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"fixmie"}}