{"action":"created","comment":{"url":"https://api.github.com/repos/xichen2020/eventdb/pulls/comments/239246913","pull_request_review_id":181985375,"id":239246913,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTI0NjkxMw==","diff_hunk":"@@ -146,3 +152,114 @@ func (s *service) Write(w http.ResponseWriter, r *http.Request) {\n \n \twriteSuccessResponse(w)\n }\n+\n+func (s *service) WriteBulk(w http.ResponseWriter, r *http.Request) {\n+\tdefer r.Body.Close()\n+\n+\tw.Header().Set(\"Content-Type\", \"application/json\")\n+\tif httpMethod := strings.ToUpper(r.Method); httpMethod != http.MethodPost {\n+\t\twriteErrorResponse(w, errRequestMustBePost)\n+\t\treturn\n+\t}\n+\n+\tdata, err := ioutil.ReadAll(r.Body)\n+\tif err != nil {\n+\t\terr = fmt.Errorf(\"cannot read body: %v\", err)\n+\t\twriteErrorResponse(w, err)\n+\t\treturn\n+\t}\n+\n+\tp := s.parserPool.Get()\n+\t// TODO(xichen): Check this is correct wrt the parser lifetime.\n+\tdefer s.parserPool.Put(p)\n+\n+\t// []byte is not a valid map key type so using string instead.\n+\teventMapping := make(map[string][]event.Event)\n+\tvar (\n+\t\tstart int\n+\t\tstop  int\n+\t)\n+\tfor stop < len(data) {\n+\t\tstop = bytes.Index(data[start:], writeBulkDelimiter)\n+\t\tif stop == -1 {\n+\t\t\tstop = len(data)\n+\t\t}\n+\n+\t\tv, err := p.ParseBytes(data[start:stop])","path":"server/http/handlers/service.go","position":105,"original_position":62,"commit_id":"d952f081aab49267bf70460f8c40af3df7e48ad2","original_commit_id":"ce88b3b648d98e0d669cdde1499187856f4a798f","user":{"login":"notbdu","id":8580333,"node_id":"MDQ6VXNlcjg1ODAzMzM=","avatar_url":"https://avatars1.githubusercontent.com/u/8580333?v=4","gravatar_id":"","url":"https://api.github.com/users/notbdu","html_url":"https://github.com/notbdu","followers_url":"https://api.github.com/users/notbdu/followers","following_url":"https://api.github.com/users/notbdu/following{/other_user}","gists_url":"https://api.github.com/users/notbdu/gists{/gist_id}","starred_url":"https://api.github.com/users/notbdu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbdu/subscriptions","organizations_url":"https://api.github.com/users/notbdu/orgs","repos_url":"https://api.github.com/users/notbdu/repos","events_url":"https://api.github.com/users/notbdu/events{/privacy}","received_events_url":"https://api.github.com/users/notbdu/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2018-12-05T21:37:15Z","updated_at":"2018-12-05T21:37:15Z","html_url":"https://github.com/xichen2020/eventdb/pull/31#discussion_r239246913","pull_request_url":"https://api.github.com/repos/xichen2020/eventdb/pulls/31","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/comments/239246913"},"html":{"href":"https://github.com/xichen2020/eventdb/pull/31#discussion_r239246913"},"pull_request":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/31"}},"in_reply_to_id":239120972},"pull_request":{"url":"https://api.github.com/repos/xichen2020/eventdb/pulls/31","id":235999593,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1OTk5NTkz","html_url":"https://github.com/xichen2020/eventdb/pull/31","diff_url":"https://github.com/xichen2020/eventdb/pull/31.diff","patch_url":"https://github.com/xichen2020/eventdb/pull/31.patch","issue_url":"https://api.github.com/repos/xichen2020/eventdb/issues/31","number":31,"state":"open","locked":false,"title":"Add bulk write endpoint.","user":{"login":"notbdu","id":8580333,"node_id":"MDQ6VXNlcjg1ODAzMzM=","avatar_url":"https://avatars1.githubusercontent.com/u/8580333?v=4","gravatar_id":"","url":"https://api.github.com/users/notbdu","html_url":"https://github.com/notbdu","followers_url":"https://api.github.com/users/notbdu/followers","following_url":"https://api.github.com/users/notbdu/following{/other_user}","gists_url":"https://api.github.com/users/notbdu/gists{/gist_id}","starred_url":"https://api.github.com/users/notbdu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notbdu/subscriptions","organizations_url":"https://api.github.com/users/notbdu/orgs","repos_url":"https://api.github.com/users/notbdu/repos","events_url":"https://api.github.com/users/notbdu/events{/privacy}","received_events_url":"https://api.github.com/users/notbdu/received_events","type":"User","site_admin":false},"body":"- Adds a bulk write endpoint.","created_at":"2018-12-04T23:48:59Z","updated_at":"2018-12-05T21:37:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9708e029ce04953779dd931d9b292c65f89fcedc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/xichen2020/eventdb/pulls/31/commits","review_comments_url":"https://api.github.com/repos/xichen2020/eventdb/pulls/31/comments","review_comment_url":"https://api.github.com/repos/xichen2020/eventdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xichen2020/eventdb/issues/31/comments","statuses_url":"https://api.github.com/repos/xichen2020/eventdb/statuses/d952f081aab49267bf70460f8c40af3df7e48ad2","head":{"label":"xichen2020:bdu/bulkwrite","ref":"bdu/bulkwrite","sha":"d952f081aab49267bf70460f8c40af3df7e48ad2","user":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","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},"repo":{"id":157281610,"node_id":"MDEwOlJlcG9zaXRvcnkxNTcyODE2MTA=","name":"eventdb","full_name":"xichen2020/eventdb","private":false,"owner":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","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},"html_url":"https://github.com/xichen2020/eventdb","description":"Storage for discrete events such as log events or tracing events ","fork":false,"url":"https://api.github.com/repos/xichen2020/eventdb","forks_url":"https://api.github.com/repos/xichen2020/eventdb/forks","keys_url":"https://api.github.com/repos/xichen2020/eventdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xichen2020/eventdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xichen2020/eventdb/teams","hooks_url":"https://api.github.com/repos/xichen2020/eventdb/hooks","issue_events_url":"https://api.github.com/repos/xichen2020/eventdb/issues/events{/number}","events_url":"https://api.github.com/repos/xichen2020/eventdb/events","assignees_url":"https://api.github.com/repos/xichen2020/eventdb/assignees{/user}","branches_url":"https://api.github.com/repos/xichen2020/eventdb/branches{/branch}","tags_url":"https://api.github.com/repos/xichen2020/eventdb/tags","blobs_url":"https://api.github.com/repos/xichen2020/eventdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xichen2020/eventdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xichen2020/eventdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/xichen2020/eventdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xichen2020/eventdb/statuses/{sha}","languages_url":"https://api.github.com/repos/xichen2020/eventdb/languages","stargazers_url":"https://api.github.com/repos/xichen2020/eventdb/stargazers","contributors_url":"https://api.github.com/repos/xichen2020/eventdb/contributors","subscribers_url":"https://api.github.com/repos/xichen2020/eventdb/subscribers","subscription_url":"https://api.github.com/repos/xichen2020/eventdb/subscription","commits_url":"https://api.github.com/repos/xichen2020/eventdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/xichen2020/eventdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/xichen2020/eventdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/xichen2020/eventdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/xichen2020/eventdb/contents/{+path}","compare_url":"https://api.github.com/repos/xichen2020/eventdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xichen2020/eventdb/merges","archive_url":"https://api.github.com/repos/xichen2020/eventdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xichen2020/eventdb/downloads","issues_url":"https://api.github.com/repos/xichen2020/eventdb/issues{/number}","pulls_url":"https://api.github.com/repos/xichen2020/eventdb/pulls{/number}","milestones_url":"https://api.github.com/repos/xichen2020/eventdb/milestones{/number}","notifications_url":"https://api.github.com/repos/xichen2020/eventdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xichen2020/eventdb/labels{/name}","releases_url":"https://api.github.com/repos/xichen2020/eventdb/releases{/id}","deployments_url":"https://api.github.com/repos/xichen2020/eventdb/deployments","created_at":"2018-11-12T21:48:05Z","updated_at":"2018-12-04T18:13:38Z","pushed_at":"2018-12-05T21:37:13Z","git_url":"git://github.com/xichen2020/eventdb.git","ssh_url":"git@github.com:xichen2020/eventdb.git","clone_url":"https://github.com/xichen2020/eventdb.git","svn_url":"https://github.com/xichen2020/eventdb","homepage":null,"size":880,"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":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"xichen2020:master","ref":"master","sha":"5035d913608b770122b4ce41c667f61d1571344f","user":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","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},"repo":{"id":157281610,"node_id":"MDEwOlJlcG9zaXRvcnkxNTcyODE2MTA=","name":"eventdb","full_name":"xichen2020/eventdb","private":false,"owner":{"login":"xichen2020","id":12239421,"node_id":"MDQ6VXNlcjEyMjM5NDIx","avatar_url":"https://avatars1.githubusercontent.com/u/12239421?v=4","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},"html_url":"https://github.com/xichen2020/eventdb","description":"Storage for discrete events such as log events or tracing events ","fork":false,"url":"https://api.github.com/repos/xichen2020/eventdb","forks_url":"https://api.github.com/repos/xichen2020/eventdb/forks","keys_url":"https://api.github.com/repos/xichen2020/eventdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xichen2020/eventdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xichen2020/eventdb/teams","hooks_url":"https://api.github.com/repos/xichen2020/eventdb/hooks","issue_events_url":"https://api.github.com/repos/xichen2020/eventdb/issues/events{/number}","events_url":"https://api.github.com/repos/xichen2020/eventdb/events","assignees_url":"https://api.github.com/repos/xichen2020/eventdb/assignees{/user}","branches_url":"https://api.github.com/repos/xichen2020/eventdb/branches{/branch}","tags_url":"https://api.github.com/repos/xichen2020/eventdb/tags","blobs_url":"https://api.github.com/repos/xichen2020/eventdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xichen2020/eventdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xichen2020/eventdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/xichen2020/eventdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xichen2020/eventdb/statuses/{sha}","languages_url":"https://api.github.com/repos/xichen2020/eventdb/languages","stargazers_url":"https://api.github.com/repos/xichen2020/eventdb/stargazers","contributors_url":"https://api.github.com/repos/xichen2020/eventdb/contributors","subscribers_url":"https://api.github.com/repos/xichen2020/eventdb/subscribers","subscription_url":"https://api.github.com/repos/xichen2020/eventdb/subscription","commits_url":"https://api.github.com/repos/xichen2020/eventdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/xichen2020/eventdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/xichen2020/eventdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/xichen2020/eventdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/xichen2020/eventdb/contents/{+path}","compare_url":"https://api.github.com/repos/xichen2020/eventdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xichen2020/eventdb/merges","archive_url":"https://api.github.com/repos/xichen2020/eventdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xichen2020/eventdb/downloads","issues_url":"https://api.github.com/repos/xichen2020/eventdb/issues{/number}","pulls_url":"https://api.github.com/repos/xichen2020/eventdb/pulls{/number}","milestones_url":"https://api.github.com/repos/xichen2020/eventdb/milestones{/number}","notifications_url":"https://api.github.com/repos/xichen2020/eventdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xichen2020/eventdb/labels{/name}","releases_url":"https://api.github.com/repos/xichen2020/eventdb/releases{/id}","deployments_url":"https://api.github.com/repos/xichen2020/eventdb/deployments","created_at":"2018-11-12T21:48:05Z","updated_at":"2018-12-04T18:13:38Z","pushed_at":"2018-12-05T21:37:13Z","git_url":"git://github.com/xichen2020/eventdb.git","ssh_url":"git@github.com:xichen2020/eventdb.git","clone_url":"https://github.com/xichen2020/eventdb.git","svn_url":"https://github.com/xichen2020/eventdb","homepage":null,"size":880,"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":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/31"},"html":{"href":"https://github.com/xichen2020/eventdb/pull/31"},"issue":{"href":"https://api.github.com/repos/xichen2020/eventdb/issues/31"},"comments":{"href":"https://api.github.com/repos/xichen2020/eventdb/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xichen2020/eventdb/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/xichen2020/eventdb/statuses/d952f081aab49267bf70460f8c40af3df7e48ad2"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"notbdu"}}