{"action":"created","comment":{"url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/comments/25934309","id":25934309,"diff_hunk":"@@ -0,0 +1,230 @@\n+/*\n+* 2015+ Copyright (c) Anton Matveenko <antmat@yandex-team.ru>\n+* All rights reserved.\n+*\n+* This program is free software; you can redistribute it and/or modify\n+* it under the terms of the GNU General Public License as published by\n+* the Free Software Foundation; either version 2 of the License, or\n+* (at your option) any later version.\n+*\n+* This program is distributed in the hope that it will be useful,\n+* but WITHOUT ANY WARRANTY; without even the implied warranty of\n+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+* GNU General Public License for more details.\n+*/\n+#ifndef ZOOKEEPER_HANDLER_HPP\n+#define ZOOKEEPER_HANDLER_HPP\n+\n+#include \"cocaine/zookeeper/zookeeper.hpp\"\n+#include \"cocaine/zookeeper/exception.hpp\"\n+\n+#include <cocaine/locked_ptr.hpp>\n+\n+#include <functional>\n+#include <string>\n+#include <memory>\n+#include <vector>\n+\n+#include <unordered_map>\n+#include <cassert>\n+\n+namespace zookeeper {\n+\n+typedef Stat node_stat;\n+\n+//Used to prevent direct creation of managed handlers derived classes.\n+class handler_tag {\n+private:\n+    handler_tag() {}\n+    friend class handler_scope_t;\n+};\n+\n+class managed_handler_base_t {\n+public:\n+    // Tagged constructor.\n+    // Used to disable implicit instantiation.\n+    // All instantiations are made through scope object.\n+    managed_handler_base_t(const handler_tag&) {}","path":"unicorn/include/cocaine/zookeeper/handler.hpp","position":47,"original_position":47,"commit_id":"3a4a02c8d3a72cfe6f9f5269443cddbb6c655b1e","original_commit_id":"3a4a02c8d3a72cfe6f9f5269443cddbb6c655b1e","user":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"body":"Ditto.","created_at":"2015-03-06T09:41:11Z","updated_at":"2015-03-06T09:41:11Z","html_url":"https://github.com/cocaine/cocaine-plugins/pull/52#discussion_r25934309","pull_request_url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/comments/25934309"},"html":{"href":"https://github.com/cocaine/cocaine-plugins/pull/52#discussion_r25934309"},"pull_request":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52","id":30368369,"html_url":"https://github.com/cocaine/cocaine-plugins/pull/52","diff_url":"https://github.com/cocaine/cocaine-plugins/pull/52.diff","patch_url":"https://github.com/cocaine/cocaine-plugins/pull/52.patch","issue_url":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/52","number":52,"state":"open","locked":false,"title":"Unicorn plugin","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"body":"Plugin for unified configuration service. It's using zookeeper as main engine and provides such capabilities:\r\n  * Create node with value (create)\r\n  * CAS node value\r\n  * Increment node value\r\n  * Delete node (only terminal).\r\n  * Subscribe for value changes\r\n  * Subscribe for a list of values of parent node.\r\n  * Distributed lock abstraction ( lock(path) -> unlock() ) which offers automated lock release on client disconnection.\r\nMore information can be found in idl file.\r\n\r\nThere are some differeneces in behaviour of this plugin and zookeeper:\r\n  * zookeper allows storing value in non-terminating nodes, this plugin does not\r\n  * Instead of zookeeper single use watch mechanism plugin provides stream of updates of node on subscription.\r\n  * All values are initially msgpacked and only after that stored in zookeeper.\r\n\r\nNote: this plugin is compatible with zookeeper 3.4.x, however it involves some non obvious and non ideal in terms of performance workaround for deleting watches that have a chance not to be ever triggered, resulting in a memory leak. Zookeeper 3.5 offers unregister_watch functionality, but currently it is marked as alpha.","created_at":"2015-03-03T12:14:15Z","updated_at":"2015-03-06T09:41:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9bb01ddef193b0b084b6805ee474bf71855a7feb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52/commits","review_comments_url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52/comments","review_comment_url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/52/comments","statuses_url":"https://api.github.com/repos/cocaine/cocaine-plugins/statuses/3a4a02c8d3a72cfe6f9f5269443cddbb6c655b1e","head":{"label":"antmat:zk_with_manager","ref":"zk_with_manager","sha":"3a4a02c8d3a72cfe6f9f5269443cddbb6c655b1e","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"repo":{"id":29957406,"name":"cocaine-plugins","full_name":"antmat/cocaine-plugins","owner":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/antmat/cocaine-plugins","description":"Cocaine Plugins","fork":true,"url":"https://api.github.com/repos/antmat/cocaine-plugins","forks_url":"https://api.github.com/repos/antmat/cocaine-plugins/forks","keys_url":"https://api.github.com/repos/antmat/cocaine-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antmat/cocaine-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antmat/cocaine-plugins/teams","hooks_url":"https://api.github.com/repos/antmat/cocaine-plugins/hooks","issue_events_url":"https://api.github.com/repos/antmat/cocaine-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/antmat/cocaine-plugins/events","assignees_url":"https://api.github.com/repos/antmat/cocaine-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/antmat/cocaine-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/antmat/cocaine-plugins/tags","blobs_url":"https://api.github.com/repos/antmat/cocaine-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antmat/cocaine-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antmat/cocaine-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/antmat/cocaine-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antmat/cocaine-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/antmat/cocaine-plugins/languages","stargazers_url":"https://api.github.com/repos/antmat/cocaine-plugins/stargazers","contributors_url":"https://api.github.com/repos/antmat/cocaine-plugins/contributors","subscribers_url":"https://api.github.com/repos/antmat/cocaine-plugins/subscribers","subscription_url":"https://api.github.com/repos/antmat/cocaine-plugins/subscription","commits_url":"https://api.github.com/repos/antmat/cocaine-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/antmat/cocaine-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/antmat/cocaine-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/antmat/cocaine-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/antmat/cocaine-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/antmat/cocaine-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antmat/cocaine-plugins/merges","archive_url":"https://api.github.com/repos/antmat/cocaine-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antmat/cocaine-plugins/downloads","issues_url":"https://api.github.com/repos/antmat/cocaine-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/antmat/cocaine-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/antmat/cocaine-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/antmat/cocaine-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antmat/cocaine-plugins/labels{/name}","releases_url":"https://api.github.com/repos/antmat/cocaine-plugins/releases{/id}","created_at":"2015-01-28T08:17:18Z","updated_at":"2015-02-11T15:16:58Z","pushed_at":"2015-03-05T17:36:28Z","git_url":"git://github.com/antmat/cocaine-plugins.git","ssh_url":"git@github.com:antmat/cocaine-plugins.git","clone_url":"https://github.com/antmat/cocaine-plugins.git","svn_url":"https://github.com/antmat/cocaine-plugins","homepage":null,"size":1219,"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":"cocaine:master","ref":"master","sha":"e633562c128e3a1bfee42eba4701380289bc9805","user":{"login":"cocaine","id":1553730,"avatar_url":"https://avatars.githubusercontent.com/u/1553730?v=3","gravatar_id":"","url":"https://api.github.com/users/cocaine","html_url":"https://github.com/cocaine","followers_url":"https://api.github.com/users/cocaine/followers","following_url":"https://api.github.com/users/cocaine/following{/other_user}","gists_url":"https://api.github.com/users/cocaine/gists{/gist_id}","starred_url":"https://api.github.com/users/cocaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocaine/subscriptions","organizations_url":"https://api.github.com/users/cocaine/orgs","repos_url":"https://api.github.com/users/cocaine/repos","events_url":"https://api.github.com/users/cocaine/events{/privacy}","received_events_url":"https://api.github.com/users/cocaine/received_events","type":"Organization","site_admin":false},"repo":{"id":4738266,"name":"cocaine-plugins","full_name":"cocaine/cocaine-plugins","owner":{"login":"cocaine","id":1553730,"avatar_url":"https://avatars.githubusercontent.com/u/1553730?v=3","gravatar_id":"","url":"https://api.github.com/users/cocaine","html_url":"https://github.com/cocaine","followers_url":"https://api.github.com/users/cocaine/followers","following_url":"https://api.github.com/users/cocaine/following{/other_user}","gists_url":"https://api.github.com/users/cocaine/gists{/gist_id}","starred_url":"https://api.github.com/users/cocaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocaine/subscriptions","organizations_url":"https://api.github.com/users/cocaine/orgs","repos_url":"https://api.github.com/users/cocaine/repos","events_url":"https://api.github.com/users/cocaine/events{/privacy}","received_events_url":"https://api.github.com/users/cocaine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocaine/cocaine-plugins","description":"Cocaine Plugins","fork":false,"url":"https://api.github.com/repos/cocaine/cocaine-plugins","forks_url":"https://api.github.com/repos/cocaine/cocaine-plugins/forks","keys_url":"https://api.github.com/repos/cocaine/cocaine-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocaine/cocaine-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocaine/cocaine-plugins/teams","hooks_url":"https://api.github.com/repos/cocaine/cocaine-plugins/hooks","issue_events_url":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/cocaine/cocaine-plugins/events","assignees_url":"https://api.github.com/repos/cocaine/cocaine-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/cocaine/cocaine-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/cocaine/cocaine-plugins/tags","blobs_url":"https://api.github.com/repos/cocaine/cocaine-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocaine/cocaine-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocaine/cocaine-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocaine/cocaine-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocaine/cocaine-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/cocaine/cocaine-plugins/languages","stargazers_url":"https://api.github.com/repos/cocaine/cocaine-plugins/stargazers","contributors_url":"https://api.github.com/repos/cocaine/cocaine-plugins/contributors","subscribers_url":"https://api.github.com/repos/cocaine/cocaine-plugins/subscribers","subscription_url":"https://api.github.com/repos/cocaine/cocaine-plugins/subscription","commits_url":"https://api.github.com/repos/cocaine/cocaine-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocaine/cocaine-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocaine/cocaine-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/cocaine/cocaine-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/cocaine/cocaine-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocaine/cocaine-plugins/merges","archive_url":"https://api.github.com/repos/cocaine/cocaine-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocaine/cocaine-plugins/downloads","issues_url":"https://api.github.com/repos/cocaine/cocaine-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/cocaine/cocaine-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/cocaine/cocaine-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocaine/cocaine-plugins/labels{/name}","releases_url":"https://api.github.com/repos/cocaine/cocaine-plugins/releases{/id}","created_at":"2012-06-21T11:24:30Z","updated_at":"2015-02-26T20:46:25Z","pushed_at":"2015-02-26T20:46:25Z","git_url":"git://github.com/cocaine/cocaine-plugins.git","ssh_url":"git@github.com:cocaine/cocaine-plugins.git","clone_url":"https://github.com/cocaine/cocaine-plugins.git","svn_url":"https://github.com/cocaine/cocaine-plugins","homepage":null,"size":2917,"stargazers_count":19,"watchers_count":19,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":5,"forks":18,"open_issues":5,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52"},"html":{"href":"https://github.com/cocaine/cocaine-plugins/pull/52"},"issue":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/52"},"comments":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/cocaine/cocaine-plugins/statuses/3a4a02c8d3a72cfe6f9f5269443cddbb6c655b1e"}}}}