{"action":"created","comment":{"url":"https://api.github.com/repos/m3db/m3coordinator/pulls/comments/169392880","pull_request_review_id":97912424,"id":169392880,"diff_hunk":"@@ -0,0 +1,100 @@\n+package remote\n+\n+import (\n+\t\"io\"\n+\t\"net\"\n+\n+\t\"github.com/m3db/m3coordinator/generated/proto/m3coordinator\"\n+\t\"github.com/m3db/m3coordinator/storage\"\n+\t\"github.com/m3db/m3coordinator/util/logging\"\n+\n+\t\"go.uber.org/zap\"\n+\t\"google.golang.org/grpc\"\n+)\n+\n+type grpcServer struct {\n+\tstorage storage.Storage\n+}\n+\n+func newServer(store storage.Storage) *grpcServer {\n+\treturn &grpcServer{\n+\t\tstorage: store,\n+\t}\n+}\n+\n+// CreateNewGrpcServer creates server, given context local storage\n+func CreateNewGrpcServer(store storage.Storage) *grpc.Server {\n+\tserver := grpc.NewServer()\n+\tgrpcServer := newServer(store)\n+\trpc.RegisterQueryServer(server, grpcServer)\n+\n+\treturn server\n+}\n+\n+// StartNewGrpcServer starts server on given address, then notifies channel\n+func StartNewGrpcServer(server *grpc.Server, address string, waitForStart chan<- struct{}) error {\n+\tlis, err := net.Listen(\"tcp\", address)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\twaitForStart <- struct{}{}\n+\treturn server.Serve(lis)\n+}\n+\n+// Fetch reads from local storage\n+func (s *grpcServer) Fetch(message *rpc.FetchMessage, stream rpc.Query_FetchServer) error {\n+\tstoreQuery, id, err := DecodeFetchMessage(message)\n+\tctx := logging.NewContextWithID(stream.Context(), id)\n+\tlogger := logging.WithContext(ctx)\n+\n+\tif err != nil {\n+\t\tlogger.Error(\"unable to decode fetch query\", zap.Any(\"error\", err))\n+\t\treturn err\n+\t}\n+\n+\t// Iterate while there are more results\n+\tfor {\n+\t\tresult, err := s.storage.Fetch(ctx, storeQuery, nil)","path":"tsdb/remote/server.go","position":57,"original_position":57,"commit_id":"cbccf2af7bef6d3572c3f191291c924fe73c51be","original_commit_id":"cbccf2af7bef6d3572c3f191291c924fe73c51be","user":{"login":"benraskin92","id":4688976,"avatar_url":"https://avatars0.githubusercontent.com/u/4688976?v=4","gravatar_id":"","url":"https://api.github.com/users/benraskin92","html_url":"https://github.com/benraskin92","followers_url":"https://api.github.com/users/benraskin92/followers","following_url":"https://api.github.com/users/benraskin92/following{/other_user}","gists_url":"https://api.github.com/users/benraskin92/gists{/gist_id}","starred_url":"https://api.github.com/users/benraskin92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benraskin92/subscriptions","organizations_url":"https://api.github.com/users/benraskin92/orgs","repos_url":"https://api.github.com/users/benraskin92/repos","events_url":"https://api.github.com/users/benraskin92/events{/privacy}","received_events_url":"https://api.github.com/users/benraskin92/received_events","type":"User","site_admin":false},"body":"Not sure if this is necessary, but we could create a worker pool and use that. this way we won't be creating a new `result` object each time? ","created_at":"2018-02-20T17:15:24Z","updated_at":"2018-02-20T17:15:24Z","html_url":"https://github.com/m3db/m3coordinator/pull/19#discussion_r169392880","pull_request_url":"https://api.github.com/repos/m3db/m3coordinator/pulls/19","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/comments/169392880"},"html":{"href":"https://github.com/m3db/m3coordinator/pull/19#discussion_r169392880"},"pull_request":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/m3db/m3coordinator/pulls/19","id":168712812,"html_url":"https://github.com/m3db/m3coordinator/pull/19","diff_url":"https://github.com/m3db/m3coordinator/pull/19.diff","patch_url":"https://github.com/m3db/m3coordinator/pull/19.patch","issue_url":"https://api.github.com/repos/m3db/m3coordinator/issues/19","number":19,"state":"open","locked":false,"title":"Grpc","user":{"login":"arnikola","id":14959893,"avatar_url":"https://avatars0.githubusercontent.com/u/14959893?v=4","gravatar_id":"","url":"https://api.github.com/users/arnikola","html_url":"https://github.com/arnikola","followers_url":"https://api.github.com/users/arnikola/followers","following_url":"https://api.github.com/users/arnikola/following{/other_user}","gists_url":"https://api.github.com/users/arnikola/gists{/gist_id}","starred_url":"https://api.github.com/users/arnikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnikola/subscriptions","organizations_url":"https://api.github.com/users/arnikola/orgs","repos_url":"https://api.github.com/users/arnikola/repos","events_url":"https://api.github.com/users/arnikola/events{/privacy}","received_events_url":"https://api.github.com/users/arnikola/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-12T23:07:15Z","updated_at":"2018-02-20T17:15:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c85238cda971eb4f049eda9160a5a3355b357506","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/m3db/m3coordinator/pulls/19/commits","review_comments_url":"https://api.github.com/repos/m3db/m3coordinator/pulls/19/comments","review_comment_url":"https://api.github.com/repos/m3db/m3coordinator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m3db/m3coordinator/issues/19/comments","statuses_url":"https://api.github.com/repos/m3db/m3coordinator/statuses/cbccf2af7bef6d3572c3f191291c924fe73c51be","head":{"label":"m3db:grpc-2","ref":"grpc-2","sha":"cbccf2af7bef6d3572c3f191291c924fe73c51be","user":{"login":"m3db","id":19937171,"avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":110602995,"name":"m3coordinator","full_name":"m3db/m3coordinator","owner":{"login":"m3db","id":19937171,"avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3coordinator","description":"Service to access M3DB","fork":false,"url":"https://api.github.com/repos/m3db/m3coordinator","forks_url":"https://api.github.com/repos/m3db/m3coordinator/forks","keys_url":"https://api.github.com/repos/m3db/m3coordinator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3coordinator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3coordinator/teams","hooks_url":"https://api.github.com/repos/m3db/m3coordinator/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3coordinator/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3coordinator/events","assignees_url":"https://api.github.com/repos/m3db/m3coordinator/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3coordinator/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3coordinator/tags","blobs_url":"https://api.github.com/repos/m3db/m3coordinator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3coordinator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3coordinator/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3coordinator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3coordinator/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3coordinator/languages","stargazers_url":"https://api.github.com/repos/m3db/m3coordinator/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3coordinator/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3coordinator/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3coordinator/subscription","commits_url":"https://api.github.com/repos/m3db/m3coordinator/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3coordinator/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3coordinator/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3coordinator/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3coordinator/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3coordinator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3coordinator/merges","archive_url":"https://api.github.com/repos/m3db/m3coordinator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3coordinator/downloads","issues_url":"https://api.github.com/repos/m3db/m3coordinator/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3coordinator/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3coordinator/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3coordinator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3coordinator/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3coordinator/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3coordinator/deployments","created_at":"2017-11-13T21:14:11Z","updated_at":"2017-12-14T20:15:07Z","pushed_at":"2018-02-20T17:10:50Z","git_url":"git://github.com/m3db/m3coordinator.git","ssh_url":"git@github.com:m3db/m3coordinator.git","clone_url":"https://github.com/m3db/m3coordinator.git","svn_url":"https://github.com/m3db/m3coordinator","homepage":null,"size":753,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"m3db:master","ref":"master","sha":"a45b5815c704ca2eefedb423b6ee9a644aabb518","user":{"login":"m3db","id":19937171,"avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"repo":{"id":110602995,"name":"m3coordinator","full_name":"m3db/m3coordinator","owner":{"login":"m3db","id":19937171,"avatar_url":"https://avatars0.githubusercontent.com/u/19937171?v=4","gravatar_id":"","url":"https://api.github.com/users/m3db","html_url":"https://github.com/m3db","followers_url":"https://api.github.com/users/m3db/followers","following_url":"https://api.github.com/users/m3db/following{/other_user}","gists_url":"https://api.github.com/users/m3db/gists{/gist_id}","starred_url":"https://api.github.com/users/m3db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3db/subscriptions","organizations_url":"https://api.github.com/users/m3db/orgs","repos_url":"https://api.github.com/users/m3db/repos","events_url":"https://api.github.com/users/m3db/events{/privacy}","received_events_url":"https://api.github.com/users/m3db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/m3db/m3coordinator","description":"Service to access M3DB","fork":false,"url":"https://api.github.com/repos/m3db/m3coordinator","forks_url":"https://api.github.com/repos/m3db/m3coordinator/forks","keys_url":"https://api.github.com/repos/m3db/m3coordinator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3coordinator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3coordinator/teams","hooks_url":"https://api.github.com/repos/m3db/m3coordinator/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3coordinator/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3coordinator/events","assignees_url":"https://api.github.com/repos/m3db/m3coordinator/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3coordinator/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3coordinator/tags","blobs_url":"https://api.github.com/repos/m3db/m3coordinator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3coordinator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3coordinator/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3coordinator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3coordinator/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3coordinator/languages","stargazers_url":"https://api.github.com/repos/m3db/m3coordinator/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3coordinator/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3coordinator/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3coordinator/subscription","commits_url":"https://api.github.com/repos/m3db/m3coordinator/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3coordinator/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3coordinator/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3coordinator/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3coordinator/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3coordinator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3coordinator/merges","archive_url":"https://api.github.com/repos/m3db/m3coordinator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3coordinator/downloads","issues_url":"https://api.github.com/repos/m3db/m3coordinator/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3coordinator/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3coordinator/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3coordinator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3coordinator/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3coordinator/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3coordinator/deployments","created_at":"2017-11-13T21:14:11Z","updated_at":"2017-12-14T20:15:07Z","pushed_at":"2018-02-20T17:10:50Z","git_url":"git://github.com/m3db/m3coordinator.git","ssh_url":"git@github.com:m3db/m3coordinator.git","clone_url":"https://github.com/m3db/m3coordinator.git","svn_url":"https://github.com/m3db/m3coordinator","homepage":null,"size":753,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/19"},"html":{"href":"https://github.com/m3db/m3coordinator/pull/19"},"issue":{"href":"https://api.github.com/repos/m3db/m3coordinator/issues/19"},"comments":{"href":"https://api.github.com/repos/m3db/m3coordinator/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m3db/m3coordinator/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/m3db/m3coordinator/statuses/cbccf2af7bef6d3572c3f191291c924fe73c51be"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"benraskin92"}}