GitHub PullRequestReviewCommentEvent at 2014-10-01 21:01:55
Repository: mongo-c-driver
Actor: samantharitter
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/comments/18307738","id":18307738,"diff_hunk":"@@ -0,0 +1,92 @@\n+/*\n+ * Copyright 2014 MongoDB, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#include \"mongoc-cluster-private.h\"\n+\n+/*\n+ *--------------------------------------------------------------------------\n+ *\n+ * mongoc_client_observer_t --\n+ *\n+ *      The mongoc_client_observer_t keeps a directory of callback functions\n+ *      to be triggered on certain key events.\n+ *\n+ *--------------------------------------------------------------------------\n+ */\n+typedef struct _mongoc_client_observer {\n+    void (*on_command) (const bson_t *command, char ns[]);\n+    void (*on_socket_bind) (mongoc_socket_t *sock,\n+                            const struct sockaddr *addr);\n+} mongoc_client_observer_t;\n+\n+/*\n+ *--------------------------------------------------------------------------\n+ *\n+ * set_custom_observer_t --\n+ *\n+ *      Set the client observer table to point to custom callback functions.\n+ *\n+ *      All functions outlined in the mongoc_client_observer_t must be\n+ *      present in @custom_table for this call to succeed. To 'skip' a\n+ *      callback for some event 'e', pass observer_default_e_callback(),\n+ *      which will be a no-op, as a placeholder.\n+ *\n+ *      If no custom table is set, then all callbacks will be no-ops.\n+ *\n+ * Returns:\n+ *\n+ *      1 on success, 0 on failure.\n+ *\n+ * Side effects:\n+ *\n+ *      Custom callback functions will be called when trigger points are\n+ *      hit in the client.\n+ *\n+ *      If 'custom_table' is not a valid mongoc_client_observer_t, this\n+ *      function will not change the clientObserverTable.\n+ *\n+ *--------------------------------------------------------------------------\n+ */\n+\n+int set_custom_observer_t (const mongoc_client_observer_t *custom_table);","path":"src/mongoc/mongoc-client-observer.h","position":64,"original_position":64,"commit_id":"92ea7a9eb8a0ee8017276408a0ff23092b9bb57d","original_commit_id":"92ea7a9eb8a0ee8017276408a0ff23092b9bb57d","user":{"login":"samantharitter","id":1824529,"avatar_url":"https://avatars.githubusercontent.com/u/1824529?v=2","gravatar_id":"","url":"https://api.github.com/users/samantharitter","html_url":"https://github.com/samantharitter","followers_url":"https://api.github.com/users/samantharitter/followers","following_url":"https://api.github.com/users/samantharitter/following{/other_user}","gists_url":"https://api.github.com/users/samantharitter/gists{/gist_id}","starred_url":"https://api.github.com/users/samantharitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samantharitter/subscriptions","organizations_url":"https://api.github.com/users/samantharitter/orgs","repos_url":"https://api.github.com/users/samantharitter/repos","events_url":"https://api.github.com/users/samantharitter/events{/privacy}","received_events_url":"https://api.github.com/users/samantharitter/received_events","type":"User","site_admin":false},"body":"I'm sure I've missed something obvious, but can you explain why a user_data parameter is useful?  The triggers will be called internally from the client, so these calls wouldn't be able to pass any user data into the callback.","created_at":"2014-10-01T21:01:55Z","updated_at":"2014-10-01T21:01:55Z","html_url":"https://github.com/mongodb/mongo-c-driver/pull/80#discussion_r18307738","pull_request_url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/comments/18307738"},"html":{"href":"https://github.com/mongodb/mongo-c-driver/pull/80#discussion_r18307738"},"pull_request":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80","id":21680266,"html_url":"https://github.com/mongodb/mongo-c-driver/pull/80","diff_url":"https://github.com/mongodb/mongo-c-driver/pull/80.diff","patch_url":"https://github.com/mongodb/mongo-c-driver/pull/80.patch","issue_url":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/80","number":80,"state":"open","locked":false,"title":"(WIP) CDRIVER-400 Add a customizable client callback table","user":{"login":"samantharitter","id":1824529,"avatar_url":"https://avatars.githubusercontent.com/u/1824529?v=2","gravatar_id":"","url":"https://api.github.com/users/samantharitter","html_url":"https://github.com/samantharitter","followers_url":"https://api.github.com/users/samantharitter/followers","following_url":"https://api.github.com/users/samantharitter/following{/other_user}","gists_url":"https://api.github.com/users/samantharitter/gists{/gist_id}","starred_url":"https://api.github.com/users/samantharitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samantharitter/subscriptions","organizations_url":"https://api.github.com/users/samantharitter/orgs","repos_url":"https://api.github.com/users/samantharitter/repos","events_url":"https://api.github.com/users/samantharitter/events{/privacy}","received_events_url":"https://api.github.com/users/samantharitter/received_events","type":"User","site_admin":false},"body":"Basic skeleton for a customizable callback table, primarily for use by the PHP driver.  Some things:\r\n\r\n-need to figure out what callbacks we need\r\n-need to figure out best places/multiple places to include triggers\r\n-I'm sure I've massacred the style on this","created_at":"2014-09-23T22:17:03Z","updated_at":"2014-10-01T21:01:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e01d8901886ddba1a5a4c74682e74d115a7083c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80/commits","review_comments_url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80/comments","review_comment_url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/80/comments","statuses_url":"https://api.github.com/repos/mongodb/mongo-c-driver/statuses/92ea7a9eb8a0ee8017276408a0ff23092b9bb57d","head":{"label":"samantharitter:CDRIVER-400","ref":"CDRIVER-400","sha":"92ea7a9eb8a0ee8017276408a0ff23092b9bb57d","user":{"login":"samantharitter","id":1824529,"avatar_url":"https://avatars.githubusercontent.com/u/1824529?v=2","gravatar_id":"","url":"https://api.github.com/users/samantharitter","html_url":"https://github.com/samantharitter","followers_url":"https://api.github.com/users/samantharitter/followers","following_url":"https://api.github.com/users/samantharitter/following{/other_user}","gists_url":"https://api.github.com/users/samantharitter/gists{/gist_id}","starred_url":"https://api.github.com/users/samantharitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samantharitter/subscriptions","organizations_url":"https://api.github.com/users/samantharitter/orgs","repos_url":"https://api.github.com/users/samantharitter/repos","events_url":"https://api.github.com/users/samantharitter/events{/privacy}","received_events_url":"https://api.github.com/users/samantharitter/received_events","type":"User","site_admin":false},"repo":{"id":22432488,"name":"mongo-c-driver","full_name":"samantharitter/mongo-c-driver","owner":{"login":"samantharitter","id":1824529,"avatar_url":"https://avatars.githubusercontent.com/u/1824529?v=2","gravatar_id":"","url":"https://api.github.com/users/samantharitter","html_url":"https://github.com/samantharitter","followers_url":"https://api.github.com/users/samantharitter/followers","following_url":"https://api.github.com/users/samantharitter/following{/other_user}","gists_url":"https://api.github.com/users/samantharitter/gists{/gist_id}","starred_url":"https://api.github.com/users/samantharitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samantharitter/subscriptions","organizations_url":"https://api.github.com/users/samantharitter/orgs","repos_url":"https://api.github.com/users/samantharitter/repos","events_url":"https://api.github.com/users/samantharitter/events{/privacy}","received_events_url":"https://api.github.com/users/samantharitter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samantharitter/mongo-c-driver","description":"A high-performance MongoDB driver for C","fork":true,"url":"https://api.github.com/repos/samantharitter/mongo-c-driver","forks_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/forks","keys_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/teams","hooks_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/hooks","issue_events_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/issues/events{/number}","events_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/events","assignees_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/assignees{/user}","branches_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/branches{/branch}","tags_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/tags","blobs_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/languages","stargazers_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/stargazers","contributors_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/contributors","subscribers_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/subscribers","subscription_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/subscription","commits_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/issues/comments/{number}","contents_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/contents/{+path}","compare_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/merges","archive_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/downloads","issues_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/issues{/number}","pulls_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/labels{/name}","releases_url":"https://api.github.com/repos/samantharitter/mongo-c-driver/releases{/id}","created_at":"2014-07-30T15:02:25Z","updated_at":"2014-07-21T07:50:09Z","pushed_at":"2014-09-23T22:15:28Z","git_url":"git://github.com/samantharitter/mongo-c-driver.git","ssh_url":"git@github.com:samantharitter/mongo-c-driver.git","clone_url":"https://github.com/samantharitter/mongo-c-driver.git","svn_url":"https://github.com/samantharitter/mongo-c-driver","homepage":"","size":9560,"stargazers_count":0,"watchers_count":0,"language":null,"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":"mongodb:master","ref":"master","sha":"720694ea7706a22fb2f67a9b6596c827f5b212bd","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=2","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":9735077,"name":"mongo-c-driver","full_name":"mongodb/mongo-c-driver","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=2","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/mongo-c-driver","description":"A high-performance MongoDB driver for C","fork":false,"url":"https://api.github.com/repos/mongodb/mongo-c-driver","forks_url":"https://api.github.com/repos/mongodb/mongo-c-driver/forks","keys_url":"https://api.github.com/repos/mongodb/mongo-c-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/mongo-c-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/mongo-c-driver/teams","hooks_url":"https://api.github.com/repos/mongodb/mongo-c-driver/hooks","issue_events_url":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/mongo-c-driver/events","assignees_url":"https://api.github.com/repos/mongodb/mongo-c-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/mongo-c-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/mongo-c-driver/tags","blobs_url":"https://api.github.com/repos/mongodb/mongo-c-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/mongo-c-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/mongo-c-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/mongo-c-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/mongo-c-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/mongo-c-driver/languages","stargazers_url":"https://api.github.com/repos/mongodb/mongo-c-driver/stargazers","contributors_url":"https://api.github.com/repos/mongodb/mongo-c-driver/contributors","subscribers_url":"https://api.github.com/repos/mongodb/mongo-c-driver/subscribers","subscription_url":"https://api.github.com/repos/mongodb/mongo-c-driver/subscription","commits_url":"https://api.github.com/repos/mongodb/mongo-c-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/mongo-c-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/mongo-c-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/comments/{number}","contents_url":"https://api.github.com/repos/mongodb/mongo-c-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/mongo-c-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/mongo-c-driver/merges","archive_url":"https://api.github.com/repos/mongodb/mongo-c-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/mongo-c-driver/downloads","issues_url":"https://api.github.com/repos/mongodb/mongo-c-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/mongo-c-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/mongo-c-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/mongo-c-driver/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/mongo-c-driver/releases{/id}","created_at":"2013-04-28T19:34:36Z","updated_at":"2014-09-28T13:30:53Z","pushed_at":"2014-09-29T22:28:44Z","git_url":"git://github.com/mongodb/mongo-c-driver.git","ssh_url":"git@github.com:mongodb/mongo-c-driver.git","clone_url":"https://github.com/mongodb/mongo-c-driver.git","svn_url":"https://github.com/mongodb/mongo-c-driver","homepage":"","size":14992,"stargazers_count":74,"watchers_count":74,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":14,"forks":52,"open_issues":14,"watchers":74,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80"},"html":{"href":"https://github.com/mongodb/mongo-c-driver/pull/80"},"issue":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/80"},"comments":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/mongo-c-driver/statuses/92ea7a9eb8a0ee8017276408a0ff23092b9bb57d"}}}}