{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments/51289374","id":51289374,"diff_hunk":"@@ -50,6 +54,8 @@ func (w *writecache) PutMany(bs []*blocks.Block) error {\n \tfor _, b := range bs {\n \t\tif _, ok := w.cache.Get(b.Key()); !ok {\n \t\t\tgood = append(good, b)\n+\t\t\tk := b.Key();\n+\t\t\tdefer log.EventBegin(context.TODO(), \"Added block \", &k).Done()","path":"blocks/blockstore/write_cache.go","position":27,"original_position":27,"commit_id":"c13a0ef5e334a6780b26a1e9e39fd5fb2a25bf81","original_commit_id":"c13a0ef5e334a6780b26a1e9e39fd5fb2a25bf81","user":{"login":"whyrusleeping","id":1243164,"avatar_url":"https://avatars.githubusercontent.com/u/1243164?v=3","gravatar_id":"","url":"https://api.github.com/users/whyrusleeping","html_url":"https://github.com/whyrusleeping","followers_url":"https://api.github.com/users/whyrusleeping/followers","following_url":"https://api.github.com/users/whyrusleeping/following{/other_user}","gists_url":"https://api.github.com/users/whyrusleeping/gists{/gist_id}","starred_url":"https://api.github.com/users/whyrusleeping/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whyrusleeping/subscriptions","organizations_url":"https://api.github.com/users/whyrusleeping/orgs","repos_url":"https://api.github.com/users/whyrusleeping/repos","events_url":"https://api.github.com/users/whyrusleeping/events{/privacy}","received_events_url":"https://api.github.com/users/whyrusleeping/received_events","type":"User","site_admin":false},"body":"while it seems weird, it makes sense to me. We are registering the block to be stored here, but before the defer fires, the actual put will happen: `return w.blockstore.PutMany(good)`. So it should work as expected.","created_at":"2016-01-29T17:32:49Z","updated_at":"2016-01-29T17:32:49Z","html_url":"https://github.com/ipfs/go-ipfs/pull/1892#discussion_r51289374","pull_request_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892","_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments/51289374"},"html":{"href":"https://github.com/ipfs/go-ipfs/pull/1892#discussion_r51289374"},"pull_request":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892"}}},"pull_request":{"url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892","id":48623733,"html_url":"https://github.com/ipfs/go-ipfs/pull/1892","diff_url":"https://github.com/ipfs/go-ipfs/pull/1892.diff","patch_url":"https://github.com/ipfs/go-ipfs/pull/1892.patch","issue_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1892","number":1892,"state":"open","locked":false,"title":"Add log events when blocks are added/removed to/from the blockstore","user":{"login":"MichaelMure","id":294669,"avatar_url":"https://avatars.githubusercontent.com/u/294669?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelMure","html_url":"https://github.com/MichaelMure","followers_url":"https://api.github.com/users/MichaelMure/followers","following_url":"https://api.github.com/users/MichaelMure/following{/other_user}","gists_url":"https://api.github.com/users/MichaelMure/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelMure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelMure/subscriptions","organizations_url":"https://api.github.com/users/MichaelMure/orgs","repos_url":"https://api.github.com/users/MichaelMure/repos","events_url":"https://api.github.com/users/MichaelMure/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelMure/received_events","type":"User","site_admin":false},"body":"This PR add log events when are added/removed to/from the blockstore. I need these events for the Arbore project to track block locality.\r\n\r\nLicense: MIT\r\nSigned-off-by: Michael Muré <mure.michael@gmail.com>","created_at":"2015-10-23T20:03:07Z","updated_at":"2016-01-29T17:32:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf9769aad1030d1ead0b47f7333d8d1f8aa6e68d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892/commits","review_comments_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892/comments","review_comment_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/1892/comments","statuses_url":"https://api.github.com/repos/ipfs/go-ipfs/statuses/c13a0ef5e334a6780b26a1e9e39fd5fb2a25bf81","head":{"label":"MichaelMure:blockstore_log","ref":"blockstore_log","sha":"c13a0ef5e334a6780b26a1e9e39fd5fb2a25bf81","user":{"login":"MichaelMure","id":294669,"avatar_url":"https://avatars.githubusercontent.com/u/294669?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelMure","html_url":"https://github.com/MichaelMure","followers_url":"https://api.github.com/users/MichaelMure/followers","following_url":"https://api.github.com/users/MichaelMure/following{/other_user}","gists_url":"https://api.github.com/users/MichaelMure/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelMure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelMure/subscriptions","organizations_url":"https://api.github.com/users/MichaelMure/orgs","repos_url":"https://api.github.com/users/MichaelMure/repos","events_url":"https://api.github.com/users/MichaelMure/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelMure/received_events","type":"User","site_admin":false},"repo":{"id":32890978,"name":"go-ipfs","full_name":"MichaelMure/go-ipfs","owner":{"login":"MichaelMure","id":294669,"avatar_url":"https://avatars.githubusercontent.com/u/294669?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelMure","html_url":"https://github.com/MichaelMure","followers_url":"https://api.github.com/users/MichaelMure/followers","following_url":"https://api.github.com/users/MichaelMure/following{/other_user}","gists_url":"https://api.github.com/users/MichaelMure/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelMure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelMure/subscriptions","organizations_url":"https://api.github.com/users/MichaelMure/orgs","repos_url":"https://api.github.com/users/MichaelMure/repos","events_url":"https://api.github.com/users/MichaelMure/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelMure/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MichaelMure/go-ipfs","description":"ipfs implementation in go","fork":true,"url":"https://api.github.com/repos/MichaelMure/go-ipfs","forks_url":"https://api.github.com/repos/MichaelMure/go-ipfs/forks","keys_url":"https://api.github.com/repos/MichaelMure/go-ipfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MichaelMure/go-ipfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MichaelMure/go-ipfs/teams","hooks_url":"https://api.github.com/repos/MichaelMure/go-ipfs/hooks","issue_events_url":"https://api.github.com/repos/MichaelMure/go-ipfs/issues/events{/number}","events_url":"https://api.github.com/repos/MichaelMure/go-ipfs/events","assignees_url":"https://api.github.com/repos/MichaelMure/go-ipfs/assignees{/user}","branches_url":"https://api.github.com/repos/MichaelMure/go-ipfs/branches{/branch}","tags_url":"https://api.github.com/repos/MichaelMure/go-ipfs/tags","blobs_url":"https://api.github.com/repos/MichaelMure/go-ipfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MichaelMure/go-ipfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MichaelMure/go-ipfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/MichaelMure/go-ipfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MichaelMure/go-ipfs/statuses/{sha}","languages_url":"https://api.github.com/repos/MichaelMure/go-ipfs/languages","stargazers_url":"https://api.github.com/repos/MichaelMure/go-ipfs/stargazers","contributors_url":"https://api.github.com/repos/MichaelMure/go-ipfs/contributors","subscribers_url":"https://api.github.com/repos/MichaelMure/go-ipfs/subscribers","subscription_url":"https://api.github.com/repos/MichaelMure/go-ipfs/subscription","commits_url":"https://api.github.com/repos/MichaelMure/go-ipfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/MichaelMure/go-ipfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/MichaelMure/go-ipfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/MichaelMure/go-ipfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/MichaelMure/go-ipfs/contents/{+path}","compare_url":"https://api.github.com/repos/MichaelMure/go-ipfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MichaelMure/go-ipfs/merges","archive_url":"https://api.github.com/repos/MichaelMure/go-ipfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MichaelMure/go-ipfs/downloads","issues_url":"https://api.github.com/repos/MichaelMure/go-ipfs/issues{/number}","pulls_url":"https://api.github.com/repos/MichaelMure/go-ipfs/pulls{/number}","milestones_url":"https://api.github.com/repos/MichaelMure/go-ipfs/milestones{/number}","notifications_url":"https://api.github.com/repos/MichaelMure/go-ipfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MichaelMure/go-ipfs/labels{/name}","releases_url":"https://api.github.com/repos/MichaelMure/go-ipfs/releases{/id}","deployments_url":"https://api.github.com/repos/MichaelMure/go-ipfs/deployments","created_at":"2015-03-25T21:09:50Z","updated_at":"2015-03-25T22:42:11Z","pushed_at":"2015-11-22T16:03:06Z","git_url":"git://github.com/MichaelMure/go-ipfs.git","ssh_url":"git@github.com:MichaelMure/go-ipfs.git","clone_url":"https://github.com/MichaelMure/go-ipfs.git","svn_url":"https://github.com/MichaelMure/go-ipfs","homepage":"https://github.com/jbenet/ipfs","size":21257,"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":"ipfs:master","ref":"master","sha":"ca443b35d49ab5ca1da372764b5b2c02abd7c616","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":21233191,"name":"go-ipfs","full_name":"ipfs/go-ipfs","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-ipfs","description":"ipfs implementation in go","fork":false,"url":"https://api.github.com/repos/ipfs/go-ipfs","forks_url":"https://api.github.com/repos/ipfs/go-ipfs/forks","keys_url":"https://api.github.com/repos/ipfs/go-ipfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-ipfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-ipfs/teams","hooks_url":"https://api.github.com/repos/ipfs/go-ipfs/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-ipfs/events","assignees_url":"https://api.github.com/repos/ipfs/go-ipfs/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-ipfs/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-ipfs/tags","blobs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-ipfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-ipfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-ipfs/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-ipfs/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-ipfs/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-ipfs/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-ipfs/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-ipfs/subscription","commits_url":"https://api.github.com/repos/ipfs/go-ipfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-ipfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-ipfs/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-ipfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-ipfs/merges","archive_url":"https://api.github.com/repos/ipfs/go-ipfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-ipfs/downloads","issues_url":"https://api.github.com/repos/ipfs/go-ipfs/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-ipfs/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-ipfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-ipfs/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-ipfs/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-ipfs/deployments","created_at":"2014-06-26T08:14:34Z","updated_at":"2016-01-29T15:29:24Z","pushed_at":"2016-01-29T04:13:14Z","git_url":"git://github.com/ipfs/go-ipfs.git","ssh_url":"git@github.com:ipfs/go-ipfs.git","clone_url":"https://github.com/ipfs/go-ipfs.git","svn_url":"https://github.com/ipfs/go-ipfs","homepage":"https://github.com/ipfs/ipfs","size":27037,"stargazers_count":1523,"watchers_count":1523,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":261,"mirror_url":null,"open_issues_count":432,"forks":261,"open_issues":432,"watchers":1523,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892"},"html":{"href":"https://github.com/ipfs/go-ipfs/pull/1892"},"issue":{"href":"https://api.github.com/repos/ipfs/go-ipfs/issues/1892"},"comments":{"href":"https://api.github.com/repos/ipfs/go-ipfs/issues/1892/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/1892/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/go-ipfs/statuses/c13a0ef5e334a6780b26a1e9e39fd5fb2a25bf81"}}}}