{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/35289404","id":35289404,"diff_hunk":"@@ -1821,16 +1847,204 @@ def lookup_snap(self, snap_name):\n \n     def get_last_version(self):\n         \"\"\"\n-        Return the version of the last object read or written to.\n+            Return the version of the last object read or written to.\n \n-        This exposes the internal version number of the last object read or\n-        written via this io context\n+            This exposes the internal version number of the last object read or\n+            written via this io context\n \n-        :returns: version of the last object used\n+            :returns: version of the last object used\n         \"\"\"\n         self.require_ioctx_open()\n         return run_in_thread(self.librados.rados_get_last_version, (self.io,))\n \n+    def create_write_op(self):\n+        \"\"\"\n+            create write operation object.\n+            need call release_write_op after use\n+        \"\"\"\n+        self.librados.rados_create_write_op.restype = c_void_p\n+        return run_in_thread(self.librados.rados_create_write_op, (None,))\n+\n+    def create_read_op(self):\n+        \"\"\"\n+           create read operation object.\n+           need call release_read_op after use\n+        \"\"\"\n+        self.librados.rados_create_read_op.restype = c_void_p\n+        return run_in_thread(self.librados.rados_create_read_op, (None,))\n+\n+\n+    def release_write_op(self, write_op):\n+        \"\"\"\n+           release memory alloc by create_write_op\n+        \"\"\"\n+        self.librados.rados_release_write_op.argtypes = [c_void_p]\n+        run_in_thread(self.librados.rados_release_write_op, (c_void_p(write_op),))\n+\n+    def release_read_op(self, read_op):\n+        \"\"\"\n+           release memory alloc by create_read_op\n+           :para read_op: read_op object\n+           :type: int\n+        \"\"\"\n+        self.librados.rados_release_read_op.argtypes = [c_void_p]\n+        run_in_thread(self.librados.rados_release_read_op, (c_void_p(read_op),))\n+\n+    @requires(('write_op', int), ('keys', tuple), ('values', tuple))\n+    def set_omap(self, write_op, keys, values):\n+        \"\"\"\n+           set keys values to write_op\n+           :para write_op :write_operation object\n+           :type int\n+           :para keys :a tuple of keys\n+           :type tuple\n+           :para values :a tuple of values\n+           :type tuple\n+           :para value_lens :lens of values\n+           :type tuple\n+           :para count: total counts of key-value pairs\n+        \"\"\"\n+        if len(keys) != len(values):\n+            raise Error(\"Rados(): keys and values must hava the same numbers\")\n+        key_num = len(keys)\n+        key_array_type = c_char_p*key_num\n+        key_array = key_array_type()\n+        key_array[:] = keys\n+\n+        value_array_type = c_char_p*key_num\n+        value_array = value_array_type()\n+        value_array[:] = values\n+\n+        lens_array_type = c_size_t*key_num\n+        lens_array = lens_array_type()\n+        for index, value in enumerate(values):\n+            lens_array[index] = c_size_t(len(value))\n+\n+        run_in_thread(self.librados.rados_write_op_omap_set,\n+                      (c_void_p(write_op), byref(key_array), byref(value_array),\n+                       byref(lens_array), c_int(key_num),))\n+    \n+    @requires(('write_op', int), ('oid', str), ('mtime', opt(int)), ('flags', opt(int)))\n+    def operate_write_op(self, write_op, oid, mtime=0, flags=0):\n+        \"\"\"\n+           excute the real write operation\n+           :para write_op :write operation object\n+           :type int\n+           :para oid : object name\n+           :type str\n+           :para mtime:the time to set the mtime to, 0 for the current time\n+           :type int\n+           :para flags:flags to apply to the entire operation\n+           :type int\n+        \"\"\"\n+        run_in_thread(self.librados.rados_write_op_operate,\n+                      (c_void_p(write_op), self.io, c_char_p(oid),\n+                       c_long(mtime), c_int(flags),))\n+\n+    @requires(('read_op', int), ('oid', str), ('flag', opt(int)))\n+    def operate_read_op(self, read_op, oid, flag=0):\n+        \"\"\"\n+           excute the real read operation\n+           :para read_op :read operation object\n+           :type int\n+           :para oid : object name\n+           :type str\n+           :para flags:flags to apply to the entire operation\n+           :type int\n+        \"\"\"\n+        if not isinstance(oid, str):","path":"src/pybind/rados.py","position":146,"original_position":146,"commit_id":"c2cfa5eaab14bd3fd9db6fd1ae33d89d71ebf9ce","original_commit_id":"c2cfa5eaab14bd3fd9db6fd1ae33d89d71ebf9ce","user":{"login":"tchaikov","id":59071,"avatar_url":"https://avatars.githubusercontent.com/u/59071?v=3","gravatar_id":"","url":"https://api.github.com/users/tchaikov","html_url":"https://github.com/tchaikov","followers_url":"https://api.github.com/users/tchaikov/followers","following_url":"https://api.github.com/users/tchaikov/following{/other_user}","gists_url":"https://api.github.com/users/tchaikov/gists{/gist_id}","starred_url":"https://api.github.com/users/tchaikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchaikov/subscriptions","organizations_url":"https://api.github.com/users/tchaikov/orgs","repos_url":"https://api.github.com/users/tchaikov/repos","events_url":"https://api.github.com/users/tchaikov/events{/privacy}","received_events_url":"https://api.github.com/users/tchaikov/received_events","type":"User","site_admin":false},"body":"could dispense this check now.","created_at":"2015-07-23T04:31:04Z","updated_at":"2015-07-23T04:31:04Z","html_url":"https://github.com/ceph/ceph/pull/5272#discussion_r35289404","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/5272","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/35289404"},"html":{"href":"https://github.com/ceph/ceph/pull/5272#discussion_r35289404"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5272"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/5272","id":40197734,"html_url":"https://github.com/ceph/ceph/pull/5272","diff_url":"https://github.com/ceph/ceph/pull/5272.diff","patch_url":"https://github.com/ceph/ceph/pull/5272.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/5272","number":5272,"state":"open","locked":false,"title":"rados.py: wrap omap operation for librados","user":{"login":"chenji-kael","id":13363408,"avatar_url":"https://avatars.githubusercontent.com/u/13363408?v=3","gravatar_id":"","url":"https://api.github.com/users/chenji-kael","html_url":"https://github.com/chenji-kael","followers_url":"https://api.github.com/users/chenji-kael/followers","following_url":"https://api.github.com/users/chenji-kael/following{/other_user}","gists_url":"https://api.github.com/users/chenji-kael/gists{/gist_id}","starred_url":"https://api.github.com/users/chenji-kael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenji-kael/subscriptions","organizations_url":"https://api.github.com/users/chenji-kael/orgs","repos_url":"https://api.github.com/users/chenji-kael/repos","events_url":"https://api.github.com/users/chenji-kael/events{/privacy}","received_events_url":"https://api.github.com/users/chenji-kael/received_events","type":"User","site_admin":false},"body":"you can operate omap in python now\r\n\r\nSigned-off-by: chenji <insomnia@139.com>","created_at":"2015-07-17T03:30:57Z","updated_at":"2015-07-23T04:31:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59fde4bd254f25f6fa700001ae2c7b062fbfadb2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/5272/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/5272/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/5272/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/c2cfa5eaab14bd3fd9db6fd1ae33d89d71ebf9ce","head":{"label":"chenji-kael:work-branch","ref":"work-branch","sha":"c2cfa5eaab14bd3fd9db6fd1ae33d89d71ebf9ce","user":{"login":"chenji-kael","id":13363408,"avatar_url":"https://avatars.githubusercontent.com/u/13363408?v=3","gravatar_id":"","url":"https://api.github.com/users/chenji-kael","html_url":"https://github.com/chenji-kael","followers_url":"https://api.github.com/users/chenji-kael/followers","following_url":"https://api.github.com/users/chenji-kael/following{/other_user}","gists_url":"https://api.github.com/users/chenji-kael/gists{/gist_id}","starred_url":"https://api.github.com/users/chenji-kael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenji-kael/subscriptions","organizations_url":"https://api.github.com/users/chenji-kael/orgs","repos_url":"https://api.github.com/users/chenji-kael/repos","events_url":"https://api.github.com/users/chenji-kael/events{/privacy}","received_events_url":"https://api.github.com/users/chenji-kael/received_events","type":"User","site_admin":false},"repo":{"id":39188425,"name":"ceph","full_name":"chenji-kael/ceph","owner":{"login":"chenji-kael","id":13363408,"avatar_url":"https://avatars.githubusercontent.com/u/13363408?v=3","gravatar_id":"","url":"https://api.github.com/users/chenji-kael","html_url":"https://github.com/chenji-kael","followers_url":"https://api.github.com/users/chenji-kael/followers","following_url":"https://api.github.com/users/chenji-kael/following{/other_user}","gists_url":"https://api.github.com/users/chenji-kael/gists{/gist_id}","starred_url":"https://api.github.com/users/chenji-kael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chenji-kael/subscriptions","organizations_url":"https://api.github.com/users/chenji-kael/orgs","repos_url":"https://api.github.com/users/chenji-kael/repos","events_url":"https://api.github.com/users/chenji-kael/events{/privacy}","received_events_url":"https://api.github.com/users/chenji-kael/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chenji-kael/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/chenji-kael/ceph","forks_url":"https://api.github.com/repos/chenji-kael/ceph/forks","keys_url":"https://api.github.com/repos/chenji-kael/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chenji-kael/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chenji-kael/ceph/teams","hooks_url":"https://api.github.com/repos/chenji-kael/ceph/hooks","issue_events_url":"https://api.github.com/repos/chenji-kael/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/chenji-kael/ceph/events","assignees_url":"https://api.github.com/repos/chenji-kael/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/chenji-kael/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/chenji-kael/ceph/tags","blobs_url":"https://api.github.com/repos/chenji-kael/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chenji-kael/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chenji-kael/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/chenji-kael/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chenji-kael/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/chenji-kael/ceph/languages","stargazers_url":"https://api.github.com/repos/chenji-kael/ceph/stargazers","contributors_url":"https://api.github.com/repos/chenji-kael/ceph/contributors","subscribers_url":"https://api.github.com/repos/chenji-kael/ceph/subscribers","subscription_url":"https://api.github.com/repos/chenji-kael/ceph/subscription","commits_url":"https://api.github.com/repos/chenji-kael/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/chenji-kael/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/chenji-kael/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/chenji-kael/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/chenji-kael/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/chenji-kael/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chenji-kael/ceph/merges","archive_url":"https://api.github.com/repos/chenji-kael/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chenji-kael/ceph/downloads","issues_url":"https://api.github.com/repos/chenji-kael/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/chenji-kael/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/chenji-kael/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/chenji-kael/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chenji-kael/ceph/labels{/name}","releases_url":"https://api.github.com/repos/chenji-kael/ceph/releases{/id}","created_at":"2015-07-16T09:27:43Z","updated_at":"2015-07-16T09:27:57Z","pushed_at":"2015-07-23T02:37:08Z","git_url":"git://github.com/chenji-kael/ceph.git","ssh_url":"git@github.com:chenji-kael/ceph.git","clone_url":"https://github.com/chenji-kael/ceph.git","svn_url":"https://github.com/chenji-kael/ceph","homepage":"http://ceph.com","size":129299,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"ceph:master","ref":"master","sha":"160053c1e3397c26a36e983641a31c0f838b1ff5","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","created_at":"2011-09-01T21:41:26Z","updated_at":"2015-07-23T02:51:20Z","pushed_at":"2015-07-23T03:35:55Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":455513,"stargazers_count":1449,"watchers_count":1449,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":822,"mirror_url":null,"open_issues_count":210,"forks":822,"open_issues":210,"watchers":1449,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5272"},"html":{"href":"https://github.com/ceph/ceph/pull/5272"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/5272"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/5272/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5272/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5272/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/c2cfa5eaab14bd3fd9db6fd1ae33d89d71ebf9ce"}}}}