{"action":"created","comment":{"url":"https://api.github.com/repos/storj/storj/pulls/comments/242832383","pull_request_review_id":186429136,"id":242832383,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjgzMjM4Mw==","diff_hunk":"@@ -0,0 +1,80 @@\n+// Copyright (C) 2018 Storj Labs, Inc.\n+// See LICENSE for copying information.\n+\n+package satellitedb\n+\n+import (\n+\t\"context\"\n+\n+\t\"github.com/golang/protobuf/proto\"\n+\t\"storj.io/storj/pkg/pb\"\n+\t\"storj.io/storj/pkg/utils\"\n+\tdbx \"storj.io/storj/satellite/satellitedb/dbx\"\n+)\n+\n+type repairQueueDB struct {\n+\tdb *dbx.DB\n+}\n+\n+func (r *repairQueueDB) Enqueue(ctx context.Context, seg *pb.InjuredSegment) error {\n+\tval, err := proto.Marshal(seg)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t_, err = r.db.Create_Injuredsegment(\n+\t\tctx,\n+\t\tdbx.Injuredsegment_Info(val),\n+\t)\n+\treturn err\n+}\n+\n+func (r *repairQueueDB) Dequeue(ctx context.Context) (pb.InjuredSegment, error) {\n+\ttx, err := r.db.Open(ctx)\n+\tif err != nil {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(err)\n+\t}\n+\n+\tres, err := tx.First_Injuredsegment(ctx)\n+\tif err != nil {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(err, tx.Rollback()))\n+\t}\n+\tif res == nil {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(Error.New(\"Empty queue\"), tx.Rollback()))\n+\t}\n+\n+\tdeleted, err := tx.Delete_Injuredsegment_By_Info(\n+\t\tctx,\n+\t\tdbx.Injuredsegment_Info(res.Info),\n+\t)\n+\tif err != nil {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(err, tx.Rollback()))\n+\t}\n+\tif !deleted {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(Error.New(\"Injured segment not deleted\"), tx.Rollback()))\n+\t}\n+\n+\tseg := &pb.InjuredSegment{}\n+\terr = proto.Unmarshal(res.Info, seg)\n+\tif err != nil {\n+\t\treturn pb.InjuredSegment{}, Error.Wrap(utils.CombineErrors(err, tx.Rollback()))\n+\t}\n+\treturn *seg, Error.Wrap(tx.Commit())\n+}\n+\n+func (r *repairQueueDB) Peekqueue(ctx context.Context, limit int) ([]pb.InjuredSegment, error) {\n+\trows, err := r.db.Limited_Injuredsegment(ctx, limit, 0)","path":"satellite/satellitedb/repairqueue.go","position":66,"original_position":66,"commit_id":"f95a09d9365d6563cb91a3e3a2b4b8dd096a2e98","original_commit_id":"f95a09d9365d6563cb91a3e3a2b4b8dd096a2e98","user":{"login":"mniewrzal","id":7313031,"node_id":"MDQ6VXNlcjczMTMwMzE=","avatar_url":"https://avatars1.githubusercontent.com/u/7313031?v=4","gravatar_id":"","url":"https://api.github.com/users/mniewrzal","html_url":"https://github.com/mniewrzal","followers_url":"https://api.github.com/users/mniewrzal/followers","following_url":"https://api.github.com/users/mniewrzal/following{/other_user}","gists_url":"https://api.github.com/users/mniewrzal/gists{/gist_id}","starred_url":"https://api.github.com/users/mniewrzal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mniewrzal/subscriptions","organizations_url":"https://api.github.com/users/mniewrzal/orgs","repos_url":"https://api.github.com/users/mniewrzal/repos","events_url":"https://api.github.com/users/mniewrzal/events{/privacy}","received_events_url":"https://api.github.com/users/mniewrzal/received_events","type":"User","site_admin":false},"body":"Limit should be normalized with something like this:\r\n\tif limit <= 0 || limit > storage.LookupLimit {\r\n\t\tlimit = storage.LookupLimit\r\n\t}","created_at":"2018-12-19T08:50:19Z","updated_at":"2018-12-19T08:51:59Z","html_url":"https://github.com/storj/storj/pull/865#discussion_r242832383","pull_request_url":"https://api.github.com/repos/storj/storj/pulls/865","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/storj/storj/pulls/comments/242832383"},"html":{"href":"https://github.com/storj/storj/pull/865#discussion_r242832383"},"pull_request":{"href":"https://api.github.com/repos/storj/storj/pulls/865"}}},"pull_request":{"url":"https://api.github.com/repos/storj/storj/pulls/865","id":238744742,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM4NzQ0NzQy","html_url":"https://github.com/storj/storj/pull/865","diff_url":"https://github.com/storj/storj/pull/865.diff","patch_url":"https://github.com/storj/storj/pull/865.patch","issue_url":"https://api.github.com/repos/storj/storj/issues/865","number":865,"state":"open","locked":false,"title":"repair queue masterDB support","user":{"login":"cam-a","id":26389661,"node_id":"MDQ6VXNlcjI2Mzg5NjYx","avatar_url":"https://avatars3.githubusercontent.com/u/26389661?v=4","gravatar_id":"","url":"https://api.github.com/users/cam-a","html_url":"https://github.com/cam-a","followers_url":"https://api.github.com/users/cam-a/followers","following_url":"https://api.github.com/users/cam-a/following{/other_user}","gists_url":"https://api.github.com/users/cam-a/gists{/gist_id}","starred_url":"https://api.github.com/users/cam-a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cam-a/subscriptions","organizations_url":"https://api.github.com/users/cam-a/orgs","repos_url":"https://api.github.com/users/cam-a/repos","events_url":"https://api.github.com/users/cam-a/events{/privacy}","received_events_url":"https://api.github.com/users/cam-a/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-14T14:50:08Z","updated_at":"2018-12-19T08:51:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff68d23bd466f0cc64798cd7b90fa200b1ff66e0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":982933521,"node_id":"MDU6TGFiZWw5ODI5MzM1MjE=","url":"https://api.github.com/repos/storj/storj/labels/cla-signed","name":"cla-signed","color":"ededed","default":false},{"id":927863284,"node_id":"MDU6TGFiZWw5Mjc4NjMyODQ=","url":"https://api.github.com/repos/storj/storj/labels/wip","name":"wip","color":"dd66dd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/storj/storj/pulls/865/commits","review_comments_url":"https://api.github.com/repos/storj/storj/pulls/865/comments","review_comment_url":"https://api.github.com/repos/storj/storj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/storj/storj/issues/865/comments","statuses_url":"https://api.github.com/repos/storj/storj/statuses/f95a09d9365d6563cb91a3e3a2b4b8dd096a2e98","head":{"label":"storj:queue-dbx","ref":"queue-dbx","sha":"f95a09d9365d6563cb91a3e3a2b4b8dd096a2e98","user":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"repo":{"id":128089774,"node_id":"MDEwOlJlcG9zaXRvcnkxMjgwODk3NzQ=","name":"storj","full_name":"storj/storj","private":false,"owner":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/storj/storj","description":"Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.","fork":false,"url":"https://api.github.com/repos/storj/storj","forks_url":"https://api.github.com/repos/storj/storj/forks","keys_url":"https://api.github.com/repos/storj/storj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storj/storj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storj/storj/teams","hooks_url":"https://api.github.com/repos/storj/storj/hooks","issue_events_url":"https://api.github.com/repos/storj/storj/issues/events{/number}","events_url":"https://api.github.com/repos/storj/storj/events","assignees_url":"https://api.github.com/repos/storj/storj/assignees{/user}","branches_url":"https://api.github.com/repos/storj/storj/branches{/branch}","tags_url":"https://api.github.com/repos/storj/storj/tags","blobs_url":"https://api.github.com/repos/storj/storj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storj/storj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storj/storj/git/refs{/sha}","trees_url":"https://api.github.com/repos/storj/storj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storj/storj/statuses/{sha}","languages_url":"https://api.github.com/repos/storj/storj/languages","stargazers_url":"https://api.github.com/repos/storj/storj/stargazers","contributors_url":"https://api.github.com/repos/storj/storj/contributors","subscribers_url":"https://api.github.com/repos/storj/storj/subscribers","subscription_url":"https://api.github.com/repos/storj/storj/subscription","commits_url":"https://api.github.com/repos/storj/storj/commits{/sha}","git_commits_url":"https://api.github.com/repos/storj/storj/git/commits{/sha}","comments_url":"https://api.github.com/repos/storj/storj/comments{/number}","issue_comment_url":"https://api.github.com/repos/storj/storj/issues/comments{/number}","contents_url":"https://api.github.com/repos/storj/storj/contents/{+path}","compare_url":"https://api.github.com/repos/storj/storj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storj/storj/merges","archive_url":"https://api.github.com/repos/storj/storj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storj/storj/downloads","issues_url":"https://api.github.com/repos/storj/storj/issues{/number}","pulls_url":"https://api.github.com/repos/storj/storj/pulls{/number}","milestones_url":"https://api.github.com/repos/storj/storj/milestones{/number}","notifications_url":"https://api.github.com/repos/storj/storj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storj/storj/labels{/name}","releases_url":"https://api.github.com/repos/storj/storj/releases{/id}","deployments_url":"https://api.github.com/repos/storj/storj/deployments","created_at":"2018-04-04T16:27:18Z","updated_at":"2018-12-18T22:15:17Z","pushed_at":"2018-12-19T00:01:07Z","git_url":"git://github.com/storj/storj.git","ssh_url":"git@github.com:storj/storj.git","clone_url":"https://github.com/storj/storj.git","svn_url":"https://github.com/storj/storj","homepage":"https://storj.io","size":64644,"stargazers_count":374,"watchers_count":374,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":86,"mirror_url":null,"archived":false,"open_issues_count":33,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":86,"open_issues":33,"watchers":374,"default_branch":"master"}},"base":{"label":"storj:master","ref":"master","sha":"3c7f62be734cf28f4256ae115a7e4a079c528ad8","user":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"repo":{"id":128089774,"node_id":"MDEwOlJlcG9zaXRvcnkxMjgwODk3NzQ=","name":"storj","full_name":"storj/storj","private":false,"owner":{"login":"storj","id":6308081,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzMDgwODE=","avatar_url":"https://avatars3.githubusercontent.com/u/6308081?v=4","gravatar_id":"","url":"https://api.github.com/users/storj","html_url":"https://github.com/storj","followers_url":"https://api.github.com/users/storj/followers","following_url":"https://api.github.com/users/storj/following{/other_user}","gists_url":"https://api.github.com/users/storj/gists{/gist_id}","starred_url":"https://api.github.com/users/storj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storj/subscriptions","organizations_url":"https://api.github.com/users/storj/orgs","repos_url":"https://api.github.com/users/storj/repos","events_url":"https://api.github.com/users/storj/events{/privacy}","received_events_url":"https://api.github.com/users/storj/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/storj/storj","description":"Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.","fork":false,"url":"https://api.github.com/repos/storj/storj","forks_url":"https://api.github.com/repos/storj/storj/forks","keys_url":"https://api.github.com/repos/storj/storj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storj/storj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storj/storj/teams","hooks_url":"https://api.github.com/repos/storj/storj/hooks","issue_events_url":"https://api.github.com/repos/storj/storj/issues/events{/number}","events_url":"https://api.github.com/repos/storj/storj/events","assignees_url":"https://api.github.com/repos/storj/storj/assignees{/user}","branches_url":"https://api.github.com/repos/storj/storj/branches{/branch}","tags_url":"https://api.github.com/repos/storj/storj/tags","blobs_url":"https://api.github.com/repos/storj/storj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storj/storj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storj/storj/git/refs{/sha}","trees_url":"https://api.github.com/repos/storj/storj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storj/storj/statuses/{sha}","languages_url":"https://api.github.com/repos/storj/storj/languages","stargazers_url":"https://api.github.com/repos/storj/storj/stargazers","contributors_url":"https://api.github.com/repos/storj/storj/contributors","subscribers_url":"https://api.github.com/repos/storj/storj/subscribers","subscription_url":"https://api.github.com/repos/storj/storj/subscription","commits_url":"https://api.github.com/repos/storj/storj/commits{/sha}","git_commits_url":"https://api.github.com/repos/storj/storj/git/commits{/sha}","comments_url":"https://api.github.com/repos/storj/storj/comments{/number}","issue_comment_url":"https://api.github.com/repos/storj/storj/issues/comments{/number}","contents_url":"https://api.github.com/repos/storj/storj/contents/{+path}","compare_url":"https://api.github.com/repos/storj/storj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storj/storj/merges","archive_url":"https://api.github.com/repos/storj/storj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storj/storj/downloads","issues_url":"https://api.github.com/repos/storj/storj/issues{/number}","pulls_url":"https://api.github.com/repos/storj/storj/pulls{/number}","milestones_url":"https://api.github.com/repos/storj/storj/milestones{/number}","notifications_url":"https://api.github.com/repos/storj/storj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storj/storj/labels{/name}","releases_url":"https://api.github.com/repos/storj/storj/releases{/id}","deployments_url":"https://api.github.com/repos/storj/storj/deployments","created_at":"2018-04-04T16:27:18Z","updated_at":"2018-12-18T22:15:17Z","pushed_at":"2018-12-19T00:01:07Z","git_url":"git://github.com/storj/storj.git","ssh_url":"git@github.com:storj/storj.git","clone_url":"https://github.com/storj/storj.git","svn_url":"https://github.com/storj/storj","homepage":"https://storj.io","size":64644,"stargazers_count":374,"watchers_count":374,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":86,"mirror_url":null,"archived":false,"open_issues_count":33,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":86,"open_issues":33,"watchers":374,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/storj/storj/pulls/865"},"html":{"href":"https://github.com/storj/storj/pull/865"},"issue":{"href":"https://api.github.com/repos/storj/storj/issues/865"},"comments":{"href":"https://api.github.com/repos/storj/storj/issues/865/comments"},"review_comments":{"href":"https://api.github.com/repos/storj/storj/pulls/865/comments"},"review_comment":{"href":"https://api.github.com/repos/storj/storj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/storj/storj/pulls/865/commits"},"statuses":{"href":"https://api.github.com/repos/storj/storj/statuses/f95a09d9365d6563cb91a3e3a2b4b8dd096a2e98"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mniewrzal"}}