{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/comments/98701702","pull_request_review_id":19350790,"id":98701702,"diff_hunk":"@@ -20,87 +20,95 @@\n namespace Google.Cloud.Diagnostics.Common\n {\n     /// <summary>\n-    /// Base class for the <see cref=\"IFlushableConsumer{T}\"/> that exposes a <see cref=\"SemaphoreSlim\"/> to\n-    /// protect the buffer.\n+    /// Base class for the <see cref=\"IFlushableConsumer{T}\"/> that uses a <see cref=\"SemaphoreSlim\"/> to\n+    /// protect the flush and receive calls.\n     /// </summary>\n     internal abstract class FlushableConsumerBase<T> : IFlushableConsumer<T>\n     {\n         /// <summary>A semaphore to protect the buffer.</summary>\n-        protected readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);\n+        private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1);\n \n-        /// <summary>The consumer to flush to.</summary>\n-        protected readonly IConsumer<T> Consumer;\n-\n-        /// <summary>The buffered items.</summary>\n-        protected List<T> Items = new List<T>();\n+        /// <summary>\n+        /// Accepts an enumerable of items while the semaphore is held.\n+        /// </summary>\n+        /// <param name=\"items\">The items to receive. Cannot be null.</param>\n+        protected abstract void ReceiveWithSemaphoreHeld(IEnumerable<T> items);\n \n-        public FlushableConsumerBase(IConsumer<T> consumer)\n-        {\n-            Consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer));\n-        }\n+        /// <summary>\n+        /// Accepts an enumerable of items asynchronously while the semaphore is held.\n+        /// </summary>\n+        /// <param name=\"items\">The items to receive. Cannot be null.</param>\n+        /// <param name=\"cancellationToken\">The token to monitor for cancellation requests.</param>\n+        /// <returns>A task representing the asynchronous operation.</returns>\n+        protected abstract Task ReceiveAsyncWithSemaphoreHeld(","path":"apis/Google.Cloud.Diagnostics.Common/Google.Cloud.Diagnostics.Common/FlushableConsumerBase.cs","position":null,"original_position":36,"commit_id":"42791cd2a2fd02f7317682db76ee377ad85a6a92","original_commit_id":"6cc9a0d8f2f141104d85a687c8386121e2fa7f39","user":{"login":"iantalarico","id":5264734,"avatar_url":"https://avatars.githubusercontent.com/u/5264734?v=3","gravatar_id":"","url":"https://api.github.com/users/iantalarico","html_url":"https://github.com/iantalarico","followers_url":"https://api.github.com/users/iantalarico/followers","following_url":"https://api.github.com/users/iantalarico/following{/other_user}","gists_url":"https://api.github.com/users/iantalarico/gists{/gist_id}","starred_url":"https://api.github.com/users/iantalarico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iantalarico/subscriptions","organizations_url":"https://api.github.com/users/iantalarico/orgs","repos_url":"https://api.github.com/users/iantalarico/repos","events_url":"https://api.github.com/users/iantalarico/events{/privacy}","received_events_url":"https://api.github.com/users/iantalarico/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2017-01-31T16:03:13Z","updated_at":"2017-01-31T16:08:43Z","html_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719#discussion_r98701702","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/comments/98701702"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719#discussion_r98701702"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719","id":103209708,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719","diff_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719.diff","patch_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/719","number":719,"state":"open","locked":false,"title":"Add async functions to the IConsumers.","user":{"login":"iantalarico","id":5264734,"avatar_url":"https://avatars.githubusercontent.com/u/5264734?v=3","gravatar_id":"","url":"https://api.github.com/users/iantalarico","html_url":"https://github.com/iantalarico","followers_url":"https://api.github.com/users/iantalarico/followers","following_url":"https://api.github.com/users/iantalarico/following{/other_user}","gists_url":"https://api.github.com/users/iantalarico/gists{/gist_id}","starred_url":"https://api.github.com/users/iantalarico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iantalarico/subscriptions","organizations_url":"https://api.github.com/users/iantalarico/orgs","repos_url":"https://api.github.com/users/iantalarico/repos","events_url":"https://api.github.com/users/iantalarico/events{/privacy}","received_events_url":"https://api.github.com/users/iantalarico/received_events","type":"User","site_admin":false},"body":"This is a larger effort to allow for better options in consumers.\r\n\r\nI would appreciate feedback around the general approach and if you have ideas of how to reduce redundancy.","created_at":"2017-01-25T21:40:03Z","updated_at":"2017-01-31T16:08:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea4b76227c87c9f1a6c149625f0cb5f8fded1b3c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/719/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/statuses/42791cd2a2fd02f7317682db76ee377ad85a6a92","head":{"label":"iantalarico:comsumer-async","ref":"comsumer-async","sha":"42791cd2a2fd02f7317682db76ee377ad85a6a92","user":{"login":"iantalarico","id":5264734,"avatar_url":"https://avatars.githubusercontent.com/u/5264734?v=3","gravatar_id":"","url":"https://api.github.com/users/iantalarico","html_url":"https://github.com/iantalarico","followers_url":"https://api.github.com/users/iantalarico/followers","following_url":"https://api.github.com/users/iantalarico/following{/other_user}","gists_url":"https://api.github.com/users/iantalarico/gists{/gist_id}","starred_url":"https://api.github.com/users/iantalarico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iantalarico/subscriptions","organizations_url":"https://api.github.com/users/iantalarico/orgs","repos_url":"https://api.github.com/users/iantalarico/repos","events_url":"https://api.github.com/users/iantalarico/events{/privacy}","received_events_url":"https://api.github.com/users/iantalarico/received_events","type":"User","site_admin":false},"repo":{"id":70508946,"name":"google-cloud-dotnet","full_name":"iantalarico/google-cloud-dotnet","owner":{"login":"iantalarico","id":5264734,"avatar_url":"https://avatars.githubusercontent.com/u/5264734?v=3","gravatar_id":"","url":"https://api.github.com/users/iantalarico","html_url":"https://github.com/iantalarico","followers_url":"https://api.github.com/users/iantalarico/followers","following_url":"https://api.github.com/users/iantalarico/following{/other_user}","gists_url":"https://api.github.com/users/iantalarico/gists{/gist_id}","starred_url":"https://api.github.com/users/iantalarico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iantalarico/subscriptions","organizations_url":"https://api.github.com/users/iantalarico/orgs","repos_url":"https://api.github.com/users/iantalarico/repos","events_url":"https://api.github.com/users/iantalarico/events{/privacy}","received_events_url":"https://api.github.com/users/iantalarico/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iantalarico/google-cloud-dotnet","description":"Google Cloud Client Library for .NET","fork":true,"url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet","forks_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/forks","keys_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/teams","hooks_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/hooks","issue_events_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/events","assignees_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/tags","blobs_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/languages","stargazers_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/stargazers","contributors_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/contributors","subscribers_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/subscribers","subscription_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/subscription","commits_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/merges","archive_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/downloads","issues_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/iantalarico/google-cloud-dotnet/deployments","created_at":"2016-10-10T16:52:40Z","updated_at":"2016-10-10T16:52:42Z","pushed_at":"2017-01-31T16:08:27Z","git_url":"git://github.com/iantalarico/google-cloud-dotnet.git","ssh_url":"git@github.com:iantalarico/google-cloud-dotnet.git","clone_url":"https://github.com/iantalarico/google-cloud-dotnet.git","svn_url":"https://github.com/iantalarico/google-cloud-dotnet","homepage":"https://googlecloudplatform.github.io/google-cloud-dotnet/","size":10278,"stargazers_count":0,"watchers_count":0,"language":"C#","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":"GoogleCloudPlatform:master","ref":"master","sha":"3895df98e6de88e9666c2084869df90ce878773c","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":35877412,"name":"google-cloud-dotnet","full_name":"GoogleCloudPlatform/google-cloud-dotnet","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet","description":"Google Cloud Client Library for .NET","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/deployments","created_at":"2015-05-19T11:14:02Z","updated_at":"2017-01-26T14:35:58Z","pushed_at":"2017-01-31T16:08:28Z","git_url":"git://github.com/GoogleCloudPlatform/google-cloud-dotnet.git","ssh_url":"git@github.com:GoogleCloudPlatform/google-cloud-dotnet.git","clone_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet.git","svn_url":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet","homepage":"https://googlecloudplatform.github.io/google-cloud-dotnet/","size":15033,"stargazers_count":75,"watchers_count":75,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":35,"mirror_url":null,"open_issues_count":30,"forks":35,"open_issues":30,"watchers":75,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719"},"html":{"href":"https://github.com/GoogleCloudPlatform/google-cloud-dotnet/pull/719"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/719"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/issues/719/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/pulls/719/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/google-cloud-dotnet/statuses/42791cd2a2fd02f7317682db76ee377ad85a6a92"}}}}
{"actor":{"display_login":"iantalarico"}}