{"action":"created","comment":{"url":"https://api.github.com/repos/onitu/onitu/pulls/comments/23461558","id":23461558,"diff_hunk":"@@ -0,0 +1,66 @@\n+import threading\n+\n+import zmq\n+\n+from onitu.plug import Plug, DriverError, ServiceError\n+from onitu.utils import b, pack_obj, unpack_msg\n+from .remote import Remote\n+from .serializers import serializers\n+\n+plug = Plug()\n+\n+remote_socket, handlers_socket = None, None\n+exceptions_status = {1: DriverError, 2: ServiceError}\n+handlers_lock = threading.Lock()\n+\n+\n+def cmd_handler(name, *args_serializers):\n+    @plug.handler(name)\n+    def handler(*args):\n+        with handlers_lock:\n+            msg = [name] + [(ser, serializers.get(ser, lambda x: x)(arg))\n+                            for (ser, arg) in zip(args_serializers, args)]\n+            handlers_socket.send_multipart((b(plug.options['remote_id']),\n+                                            pack_obj(msg)))\n+            plug.logger.debug('===={}====', msg)\n+            _, resp = handlers_socket.recv_multipart()\n+            status, resp = unpack_msg(resp)\n+            if status:\n+                E = exceptions_status.get(status, DriverError)\n+                raise E(*resp)\n+            plug.logger.debug('RESP {}', resp)\n+            return resp\n+    return handler\n+\n+\n+start_upload = cmd_handler('start_upload', 'metadata')\n+upload_chunk = cmd_handler('upload_chunk', 'metadata', None, None)\n+end_upload = cmd_handler('end_upload', 'metadata')\n+abort_upload = cmd_handler('abort_upload', 'metadata')\n+get_chunk = cmd_handler('get_chunk', 'metadata', None, None)\n+delete_file = cmd_handler('delete_file', 'metadata')\n+move_file = cmd_handler('move_file', 'metadata', 'metadata')\n+\n+\n+def start():\n+    global remote_socket, handlers_socket\n+\n+    print(\"Launching driver\")\n+    print(plug.options)","path":"drivers/remote_driver/onitu_remote_driver/remote_driver.py","position":49,"original_position":49,"commit_id":"7256fc1f0033d9a6b8110c38245d0aa5f080310c","original_commit_id":"7256fc1f0033d9a6b8110c38245d0aa5f080310c","user":{"login":"k4nar","id":2692721,"avatar_url":"https://avatars.githubusercontent.com/u/2692721?v=3","gravatar_id":"","url":"https://api.github.com/users/k4nar","html_url":"https://github.com/k4nar","followers_url":"https://api.github.com/users/k4nar/followers","following_url":"https://api.github.com/users/k4nar/following{/other_user}","gists_url":"https://api.github.com/users/k4nar/gists{/gist_id}","starred_url":"https://api.github.com/users/k4nar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k4nar/subscriptions","organizations_url":"https://api.github.com/users/k4nar/orgs","repos_url":"https://api.github.com/users/k4nar/repos","events_url":"https://api.github.com/users/k4nar/events{/privacy}","received_events_url":"https://api.github.com/users/k4nar/received_events","type":"User","site_admin":false},"body":"please remove prints","created_at":"2015-01-23T16:35:42Z","updated_at":"2015-01-23T16:35:42Z","html_url":"https://github.com/onitu/onitu/pull/138#discussion_r23461558","pull_request_url":"https://api.github.com/repos/onitu/onitu/pulls/138","_links":{"self":{"href":"https://api.github.com/repos/onitu/onitu/pulls/comments/23461558"},"html":{"href":"https://github.com/onitu/onitu/pull/138#discussion_r23461558"},"pull_request":{"href":"https://api.github.com/repos/onitu/onitu/pulls/138"}}},"pull_request":{"url":"https://api.github.com/repos/onitu/onitu/pulls/138","id":27933346,"html_url":"https://github.com/onitu/onitu/pull/138","diff_url":"https://github.com/onitu/onitu/pull/138.diff","patch_url":"https://github.com/onitu/onitu/pull/138.patch","issue_url":"https://api.github.com/repos/onitu/onitu/issues/138","number":138,"state":"open","locked":false,"title":"Onitu Client","user":{"login":"entwanne","id":2658945,"avatar_url":"https://avatars.githubusercontent.com/u/2658945?v=3","gravatar_id":"","url":"https://api.github.com/users/entwanne","html_url":"https://github.com/entwanne","followers_url":"https://api.github.com/users/entwanne/followers","following_url":"https://api.github.com/users/entwanne/following{/other_user}","gists_url":"https://api.github.com/users/entwanne/gists{/gist_id}","starred_url":"https://api.github.com/users/entwanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/entwanne/subscriptions","organizations_url":"https://api.github.com/users/entwanne/orgs","repos_url":"https://api.github.com/users/entwanne/repos","events_url":"https://api.github.com/users/entwanne/events{/privacy}","received_events_url":"https://api.github.com/users/entwanne/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-23T15:54:39Z","updated_at":"2015-01-23T16:35:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f04724898e9fc9e91d9ff552403825ffcc9da628","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/onitu/onitu/pulls/138/commits","review_comments_url":"https://api.github.com/repos/onitu/onitu/pulls/138/comments","review_comment_url":"https://api.github.com/repos/onitu/onitu/pulls/comments/{number}","comments_url":"https://api.github.com/repos/onitu/onitu/issues/138/comments","statuses_url":"https://api.github.com/repos/onitu/onitu/statuses/7256fc1f0033d9a6b8110c38245d0aa5f080310c","head":{"label":"onitu:client","ref":"client","sha":"7256fc1f0033d9a6b8110c38245d0aa5f080310c","user":{"login":"onitu","id":3719455,"avatar_url":"https://avatars.githubusercontent.com/u/3719455?v=3","gravatar_id":"","url":"https://api.github.com/users/onitu","html_url":"https://github.com/onitu","followers_url":"https://api.github.com/users/onitu/followers","following_url":"https://api.github.com/users/onitu/following{/other_user}","gists_url":"https://api.github.com/users/onitu/gists{/gist_id}","starred_url":"https://api.github.com/users/onitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitu/subscriptions","organizations_url":"https://api.github.com/users/onitu/orgs","repos_url":"https://api.github.com/users/onitu/repos","events_url":"https://api.github.com/users/onitu/events{/privacy}","received_events_url":"https://api.github.com/users/onitu/received_events","type":"Organization","site_admin":false},"repo":{"id":10568880,"name":"onitu","full_name":"onitu/onitu","owner":{"login":"onitu","id":3719455,"avatar_url":"https://avatars.githubusercontent.com/u/3719455?v=3","gravatar_id":"","url":"https://api.github.com/users/onitu","html_url":"https://github.com/onitu","followers_url":"https://api.github.com/users/onitu/followers","following_url":"https://api.github.com/users/onitu/following{/other_user}","gists_url":"https://api.github.com/users/onitu/gists{/gist_id}","starred_url":"https://api.github.com/users/onitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitu/subscriptions","organizations_url":"https://api.github.com/users/onitu/orgs","repos_url":"https://api.github.com/users/onitu/repos","events_url":"https://api.github.com/users/onitu/events{/privacy}","received_events_url":"https://api.github.com/users/onitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onitu/onitu","description":"Onitu - Sync and share your files from various services and backends","fork":false,"url":"https://api.github.com/repos/onitu/onitu","forks_url":"https://api.github.com/repos/onitu/onitu/forks","keys_url":"https://api.github.com/repos/onitu/onitu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onitu/onitu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onitu/onitu/teams","hooks_url":"https://api.github.com/repos/onitu/onitu/hooks","issue_events_url":"https://api.github.com/repos/onitu/onitu/issues/events{/number}","events_url":"https://api.github.com/repos/onitu/onitu/events","assignees_url":"https://api.github.com/repos/onitu/onitu/assignees{/user}","branches_url":"https://api.github.com/repos/onitu/onitu/branches{/branch}","tags_url":"https://api.github.com/repos/onitu/onitu/tags","blobs_url":"https://api.github.com/repos/onitu/onitu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onitu/onitu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onitu/onitu/git/refs{/sha}","trees_url":"https://api.github.com/repos/onitu/onitu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onitu/onitu/statuses/{sha}","languages_url":"https://api.github.com/repos/onitu/onitu/languages","stargazers_url":"https://api.github.com/repos/onitu/onitu/stargazers","contributors_url":"https://api.github.com/repos/onitu/onitu/contributors","subscribers_url":"https://api.github.com/repos/onitu/onitu/subscribers","subscription_url":"https://api.github.com/repos/onitu/onitu/subscription","commits_url":"https://api.github.com/repos/onitu/onitu/commits{/sha}","git_commits_url":"https://api.github.com/repos/onitu/onitu/git/commits{/sha}","comments_url":"https://api.github.com/repos/onitu/onitu/comments{/number}","issue_comment_url":"https://api.github.com/repos/onitu/onitu/issues/comments/{number}","contents_url":"https://api.github.com/repos/onitu/onitu/contents/{+path}","compare_url":"https://api.github.com/repos/onitu/onitu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onitu/onitu/merges","archive_url":"https://api.github.com/repos/onitu/onitu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onitu/onitu/downloads","issues_url":"https://api.github.com/repos/onitu/onitu/issues{/number}","pulls_url":"https://api.github.com/repos/onitu/onitu/pulls{/number}","milestones_url":"https://api.github.com/repos/onitu/onitu/milestones{/number}","notifications_url":"https://api.github.com/repos/onitu/onitu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onitu/onitu/labels{/name}","releases_url":"https://api.github.com/repos/onitu/onitu/releases{/id}","created_at":"2013-06-08T13:28:15Z","updated_at":"2015-01-22T20:59:21Z","pushed_at":"2015-01-23T16:02:55Z","git_url":"git://github.com/onitu/onitu.git","ssh_url":"git@github.com:onitu/onitu.git","clone_url":"https://github.com/onitu/onitu.git","svn_url":"https://github.com/onitu/onitu","homepage":"http://onitu.github.io","size":6001,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":29,"forks":1,"open_issues":29,"watchers":10,"default_branch":"develop"}},"base":{"label":"onitu:develop","ref":"develop","sha":"836d92333927b6e4ce11c79b5bbcc5aab987df68","user":{"login":"onitu","id":3719455,"avatar_url":"https://avatars.githubusercontent.com/u/3719455?v=3","gravatar_id":"","url":"https://api.github.com/users/onitu","html_url":"https://github.com/onitu","followers_url":"https://api.github.com/users/onitu/followers","following_url":"https://api.github.com/users/onitu/following{/other_user}","gists_url":"https://api.github.com/users/onitu/gists{/gist_id}","starred_url":"https://api.github.com/users/onitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitu/subscriptions","organizations_url":"https://api.github.com/users/onitu/orgs","repos_url":"https://api.github.com/users/onitu/repos","events_url":"https://api.github.com/users/onitu/events{/privacy}","received_events_url":"https://api.github.com/users/onitu/received_events","type":"Organization","site_admin":false},"repo":{"id":10568880,"name":"onitu","full_name":"onitu/onitu","owner":{"login":"onitu","id":3719455,"avatar_url":"https://avatars.githubusercontent.com/u/3719455?v=3","gravatar_id":"","url":"https://api.github.com/users/onitu","html_url":"https://github.com/onitu","followers_url":"https://api.github.com/users/onitu/followers","following_url":"https://api.github.com/users/onitu/following{/other_user}","gists_url":"https://api.github.com/users/onitu/gists{/gist_id}","starred_url":"https://api.github.com/users/onitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onitu/subscriptions","organizations_url":"https://api.github.com/users/onitu/orgs","repos_url":"https://api.github.com/users/onitu/repos","events_url":"https://api.github.com/users/onitu/events{/privacy}","received_events_url":"https://api.github.com/users/onitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onitu/onitu","description":"Onitu - Sync and share your files from various services and backends","fork":false,"url":"https://api.github.com/repos/onitu/onitu","forks_url":"https://api.github.com/repos/onitu/onitu/forks","keys_url":"https://api.github.com/repos/onitu/onitu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onitu/onitu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onitu/onitu/teams","hooks_url":"https://api.github.com/repos/onitu/onitu/hooks","issue_events_url":"https://api.github.com/repos/onitu/onitu/issues/events{/number}","events_url":"https://api.github.com/repos/onitu/onitu/events","assignees_url":"https://api.github.com/repos/onitu/onitu/assignees{/user}","branches_url":"https://api.github.com/repos/onitu/onitu/branches{/branch}","tags_url":"https://api.github.com/repos/onitu/onitu/tags","blobs_url":"https://api.github.com/repos/onitu/onitu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onitu/onitu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onitu/onitu/git/refs{/sha}","trees_url":"https://api.github.com/repos/onitu/onitu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onitu/onitu/statuses/{sha}","languages_url":"https://api.github.com/repos/onitu/onitu/languages","stargazers_url":"https://api.github.com/repos/onitu/onitu/stargazers","contributors_url":"https://api.github.com/repos/onitu/onitu/contributors","subscribers_url":"https://api.github.com/repos/onitu/onitu/subscribers","subscription_url":"https://api.github.com/repos/onitu/onitu/subscription","commits_url":"https://api.github.com/repos/onitu/onitu/commits{/sha}","git_commits_url":"https://api.github.com/repos/onitu/onitu/git/commits{/sha}","comments_url":"https://api.github.com/repos/onitu/onitu/comments{/number}","issue_comment_url":"https://api.github.com/repos/onitu/onitu/issues/comments/{number}","contents_url":"https://api.github.com/repos/onitu/onitu/contents/{+path}","compare_url":"https://api.github.com/repos/onitu/onitu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onitu/onitu/merges","archive_url":"https://api.github.com/repos/onitu/onitu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onitu/onitu/downloads","issues_url":"https://api.github.com/repos/onitu/onitu/issues{/number}","pulls_url":"https://api.github.com/repos/onitu/onitu/pulls{/number}","milestones_url":"https://api.github.com/repos/onitu/onitu/milestones{/number}","notifications_url":"https://api.github.com/repos/onitu/onitu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onitu/onitu/labels{/name}","releases_url":"https://api.github.com/repos/onitu/onitu/releases{/id}","created_at":"2013-06-08T13:28:15Z","updated_at":"2015-01-22T20:59:21Z","pushed_at":"2015-01-23T16:02:55Z","git_url":"git://github.com/onitu/onitu.git","ssh_url":"git@github.com:onitu/onitu.git","clone_url":"https://github.com/onitu/onitu.git","svn_url":"https://github.com/onitu/onitu","homepage":"http://onitu.github.io","size":6001,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":29,"forks":1,"open_issues":29,"watchers":10,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/onitu/onitu/pulls/138"},"html":{"href":"https://github.com/onitu/onitu/pull/138"},"issue":{"href":"https://api.github.com/repos/onitu/onitu/issues/138"},"comments":{"href":"https://api.github.com/repos/onitu/onitu/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/onitu/onitu/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/onitu/onitu/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/onitu/onitu/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/onitu/onitu/statuses/7256fc1f0033d9a6b8110c38245d0aa5f080310c"}}}}