{"action":"created","comment":{"url":"https://api.github.com/repos/m3db/m3db/pulls/comments/70196884","id":70196884,"diff_hunk":"@@ -0,0 +1,145 @@\n+// Copyright (c) 2016 Uber Technologies, Inc.\n+//\n+// Permission is hereby granted, free of charge, to any person obtaining a copy\n+// of this software and associated documentation files (the \"Software\"), to deal\n+// in the Software without restriction, including without limitation the rights\n+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+// copies of the Software, and to permit persons to whom the Software is\n+// furnished to do so, subject to the following conditions:\n+//\n+// The above copyright notice and this permission notice shall be included in\n+// all copies or substantial portions of the Software.\n+//\n+// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+// THE SOFTWARE.\n+\n+package encoding\n+\n+import (\n+\t\"github.com/m3db/m3db/interfaces/m3db\"\n+\txtime \"github.com/m3db/m3db/x/time\"\n+)\n+\n+type activeIterState int\n+\n+const (\n+\tactiveIterStateNone activeIterState = iota\n+\tactiveIterStateSingle\n+\tactiveIterStateMulti\n+)\n+\n+type mixedReadersIterator struct {\n+\tsingleIter m3db.SingleReaderIterator\n+\tmultiIter  m3db.MultiReaderIterator\n+\tslicesIter m3db.ReaderSliceOfSlicesIterator\n+\tstate      activeIterState\n+\terr        error\n+\tclosed     bool\n+\tpool       m3db.MixedReadersIteratorPool\n+}\n+\n+// NewMixedReadersIterator creates a new mixed readers iterator\n+func NewMixedReadersIterator(\n+\tsingleIter m3db.SingleReaderIterator,\n+\tmultiIter m3db.MultiReaderIterator,\n+\tslicesIter m3db.ReaderSliceOfSlicesIterator,\n+\tpool m3db.MixedReadersIteratorPool,\n+) m3db.MixedReadersIterator {\n+\tit := &mixedReadersIterator{\n+\t\tsingleIter: singleIter,\n+\t\tmultiIter:  multiIter,\n+\t\tpool:       pool,\n+\t}\n+\tit.Reset(slicesIter)\n+\treturn it\n+}\n+\n+func (it *mixedReadersIterator) Next() bool {\n+\tif it.err != nil || it.closed {\n+\t\treturn false\n+\t}\n+\tswitch it.state {\n+\tcase activeIterStateNone:\n+\t\tnext := it.slicesIter.Next()\n+\t\tif !next {\n+\t\t\treturn false\n+\t\t}\n+\n+\t\treaders := it.slicesIter.Current()","path":"encoding/mixed_readers_iterator.go","position":73,"original_position":73,"commit_id":"73c7438918e2f1d36a04ee4dd9f96ecb4748523d","original_commit_id":"ee9775b3bde63b1cff05949ed4909cd5e75bb7b1","user":{"login":"xichen2020","id":12239421,"avatar_url":"https://avatars.githubusercontent.com/u/12239421?v=3","gravatar_id":"","url":"https://api.github.com/users/xichen2020","html_url":"https://github.com/xichen2020","followers_url":"https://api.github.com/users/xichen2020/followers","following_url":"https://api.github.com/users/xichen2020/following{/other_user}","gists_url":"https://api.github.com/users/xichen2020/gists{/gist_id}","starred_url":"https://api.github.com/users/xichen2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xichen2020/subscriptions","organizations_url":"https://api.github.com/users/xichen2020/orgs","repos_url":"https://api.github.com/users/xichen2020/repos","events_url":"https://api.github.com/users/xichen2020/events{/privacy}","received_events_url":"https://api.github.com/users/xichen2020/received_events","type":"User","site_admin":false},"body":"Yea I also realized this later on, perhaps we could have a common interface `SegmentReaders` interface with a `Readers(i int)` method and have both types implement that interface: `[]*rpc.Segments` use the existing logic in the `setNextReader` to get the readers, whereas `[][]xio.SegmentReader` simply returns its ith reader slice..Requires a bit of work but seems like could simplify things a bit. Don't feel too strongly about it so up to you.","created_at":"2016-07-11T02:57:33Z","updated_at":"2016-07-11T02:57:33Z","html_url":"https://github.com/m3db/m3db/pull/13#discussion_r70196884","pull_request_url":"https://api.github.com/repos/m3db/m3db/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/m3db/m3db/pulls/comments/70196884"},"html":{"href":"https://github.com/m3db/m3db/pull/13#discussion_r70196884"},"pull_request":{"href":"https://api.github.com/repos/m3db/m3db/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/m3db/m3db/pulls/13","id":75241191,"html_url":"https://github.com/m3db/m3db/pull/13","diff_url":"https://github.com/m3db/m3db/pull/13.diff","patch_url":"https://github.com/m3db/m3db/pull/13.patch","issue_url":"https://api.github.com/repos/m3db/m3db/issues/13","number":13,"state":"open","locked":false,"title":"Add client fetch capability","user":{"login":"robskillington","id":339615,"avatar_url":"https://avatars.githubusercontent.com/u/339615?v=3","gravatar_id":"","url":"https://api.github.com/users/robskillington","html_url":"https://github.com/robskillington","followers_url":"https://api.github.com/users/robskillington/followers","following_url":"https://api.github.com/users/robskillington/following{/other_user}","gists_url":"https://api.github.com/users/robskillington/gists{/gist_id}","starred_url":"https://api.github.com/users/robskillington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robskillington/subscriptions","organizations_url":"https://api.github.com/users/robskillington/orgs","repos_url":"https://api.github.com/users/robskillington/repos","events_url":"https://api.github.com/users/robskillington/events{/privacy}","received_events_url":"https://api.github.com/users/robskillington/received_events","type":"User","site_admin":false},"body":"cc @xichen2020 ","created_at":"2016-06-26T21:27:50Z","updated_at":"2016-07-11T02:57:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4381b6fe670c702ec6066fb9e80d4cd5877237d7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/m3db/m3db/pulls/13/commits","review_comments_url":"https://api.github.com/repos/m3db/m3db/pulls/13/comments","review_comment_url":"https://api.github.com/repos/m3db/m3db/pulls/comments{/number}","comments_url":"https://api.github.com/repos/m3db/m3db/issues/13/comments","statuses_url":"https://api.github.com/repos/m3db/m3db/statuses/73c7438918e2f1d36a04ee4dd9f96ecb4748523d","head":{"label":"m3db:client-fetch","ref":"client-fetch","sha":"73c7438918e2f1d36a04ee4dd9f96ecb4748523d","user":{"login":"m3db","id":19937171,"avatar_url":"https://avatars.githubusercontent.com/u/19937171?v=3","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":61153677,"name":"m3db","full_name":"m3db/m3db","owner":{"login":"m3db","id":19937171,"avatar_url":"https://avatars.githubusercontent.com/u/19937171?v=3","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/m3db","description":"","fork":false,"url":"https://api.github.com/repos/m3db/m3db","forks_url":"https://api.github.com/repos/m3db/m3db/forks","keys_url":"https://api.github.com/repos/m3db/m3db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3db/teams","hooks_url":"https://api.github.com/repos/m3db/m3db/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3db/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3db/events","assignees_url":"https://api.github.com/repos/m3db/m3db/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3db/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3db/tags","blobs_url":"https://api.github.com/repos/m3db/m3db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3db/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3db/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3db/languages","stargazers_url":"https://api.github.com/repos/m3db/m3db/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3db/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3db/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3db/subscription","commits_url":"https://api.github.com/repos/m3db/m3db/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3db/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3db/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3db/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3db/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3db/merges","archive_url":"https://api.github.com/repos/m3db/m3db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3db/downloads","issues_url":"https://api.github.com/repos/m3db/m3db/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3db/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3db/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3db/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3db/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3db/deployments","created_at":"2016-06-14T20:29:45Z","updated_at":"2016-07-06T19:51:50Z","pushed_at":"2016-07-10T16:50:51Z","git_url":"git://github.com/m3db/m3db.git","ssh_url":"git@github.com:m3db/m3db.git","clone_url":"https://github.com/m3db/m3db.git","svn_url":"https://github.com/m3db/m3db","homepage":"http://uber.github.io/","size":2110,"stargazers_count":7,"watchers_count":7,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"m3db:master","ref":"master","sha":"ecbcc9390c529efe0e24b5dff32d618c13659ff3","user":{"login":"m3db","id":19937171,"avatar_url":"https://avatars.githubusercontent.com/u/19937171?v=3","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":61153677,"name":"m3db","full_name":"m3db/m3db","owner":{"login":"m3db","id":19937171,"avatar_url":"https://avatars.githubusercontent.com/u/19937171?v=3","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/m3db","description":"","fork":false,"url":"https://api.github.com/repos/m3db/m3db","forks_url":"https://api.github.com/repos/m3db/m3db/forks","keys_url":"https://api.github.com/repos/m3db/m3db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3db/m3db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3db/m3db/teams","hooks_url":"https://api.github.com/repos/m3db/m3db/hooks","issue_events_url":"https://api.github.com/repos/m3db/m3db/issues/events{/number}","events_url":"https://api.github.com/repos/m3db/m3db/events","assignees_url":"https://api.github.com/repos/m3db/m3db/assignees{/user}","branches_url":"https://api.github.com/repos/m3db/m3db/branches{/branch}","tags_url":"https://api.github.com/repos/m3db/m3db/tags","blobs_url":"https://api.github.com/repos/m3db/m3db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3db/m3db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3db/m3db/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3db/m3db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3db/m3db/statuses/{sha}","languages_url":"https://api.github.com/repos/m3db/m3db/languages","stargazers_url":"https://api.github.com/repos/m3db/m3db/stargazers","contributors_url":"https://api.github.com/repos/m3db/m3db/contributors","subscribers_url":"https://api.github.com/repos/m3db/m3db/subscribers","subscription_url":"https://api.github.com/repos/m3db/m3db/subscription","commits_url":"https://api.github.com/repos/m3db/m3db/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3db/m3db/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3db/m3db/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3db/m3db/issues/comments{/number}","contents_url":"https://api.github.com/repos/m3db/m3db/contents/{+path}","compare_url":"https://api.github.com/repos/m3db/m3db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3db/m3db/merges","archive_url":"https://api.github.com/repos/m3db/m3db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3db/m3db/downloads","issues_url":"https://api.github.com/repos/m3db/m3db/issues{/number}","pulls_url":"https://api.github.com/repos/m3db/m3db/pulls{/number}","milestones_url":"https://api.github.com/repos/m3db/m3db/milestones{/number}","notifications_url":"https://api.github.com/repos/m3db/m3db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3db/m3db/labels{/name}","releases_url":"https://api.github.com/repos/m3db/m3db/releases{/id}","deployments_url":"https://api.github.com/repos/m3db/m3db/deployments","created_at":"2016-06-14T20:29:45Z","updated_at":"2016-07-06T19:51:50Z","pushed_at":"2016-07-10T16:50:51Z","git_url":"git://github.com/m3db/m3db.git","ssh_url":"git@github.com:m3db/m3db.git","clone_url":"https://github.com/m3db/m3db.git","svn_url":"https://github.com/m3db/m3db","homepage":"http://uber.github.io/","size":2110,"stargazers_count":7,"watchers_count":7,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/m3db/m3db/pulls/13"},"html":{"href":"https://github.com/m3db/m3db/pull/13"},"issue":{"href":"https://api.github.com/repos/m3db/m3db/issues/13"},"comments":{"href":"https://api.github.com/repos/m3db/m3db/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/m3db/m3db/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/m3db/m3db/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/m3db/m3db/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/m3db/m3db/statuses/73c7438918e2f1d36a04ee4dd9f96ecb4748523d"}}}}
{"actor":{"display_login":"xichen2020"}}