{"action":"created","comment":{"url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/comments/223977703","pull_request_review_id":163230438,"id":223977703,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzk3NzcwMw==","diff_hunk":"@@ -0,0 +1,725 @@\n+local strutil   = require(\"acid.strutil\")\n+local struct    = require(\"acid.struct\")\n+local bit       = require(\"bit\")\n+\n+local _M = { _VERSION = '1.0' }\n+local mt = { __index  = _M }\n+\n+local char = string.char\n+local bor = bit.bor\n+local band = bit.band\n+local to_str = strutil.to_str\n+local default_4char = string.rep(char(0), 4)\n+local default_8char = string.rep(char(0), 8)\n+local default_16char = string.rep(char(0), 16)\n+\n+local zk_err = {\n+    [-1]   = \"SystemZookeeperError\",\n+    [-2]   = \"RuntimeInconsistency\",\n+    [-3]   = \"DataInconsistency\",\n+    [-4]   = \"ConnectionLoss\",\n+    [-5]   = \"MarshallingError\",\n+    [-6]   = \"UnimplementedError\",\n+    [-7]   = \"OperationTimeoutError\",\n+    [-8]   = \"BadArgumentsError\",\n+    [-13]  = \"NewConfigNoQuorumError\",\n+    [-14]  = \"ReconfigInProcessError\",\n+    [-100] = \"APIError\",\n+    [-101] = \"NoNodeError\",\n+    [-102] = \"NoAuthError\",\n+    [-103] = \"BadVersionError\",\n+    [-108] = \"NoChildrenForEphemeralsError\",\n+    [-110] = \"NodeExistsError\",\n+    [-111] = \"NotEmptyError\",\n+    [-112] = \"SessionExpiredError\",\n+    [-113] = \"InvalidCallbackError\",\n+    [-114] = \"InvalidACLError\",\n+    [-115] = \"AuthFailedError\",\n+    [-118] = \"SessionMovedError\",\n+    [-119] = \"NotReadOnlyCallError\",\n+}\n+\n+local WATCH_XID = -1\n+local AUTH_XID  = -4\n+local PING_XID  = -2\n+\n+\n+local function perm_to_num(perm)\n+    local num = 0\n+    for i=1, #perm do\n+        local b = perm:sub(i, i)\n+        if b == 'c' then num = bor(num, 4)  end     -- create\n+        if b == 'd' then num = bor(num, 8)  end     -- delete\n+        if b == 'r' then num = bor(num, 1)  end     -- read\n+        if b == 'w' then num = bor(num, 2)  end     -- write\n+        if b == 'a' then num = bor(num, 16) end     -- admin\n+    end\n+\n+    return num\n+end\n+\n+\n+local function num_to_perm(num)\n+    local perm = ''\n+    if band(num, 4) == 4   then perm = perm .. 'c' end\n+    if band(num, 8) == 8   then perm = perm .. 'd' end\n+    if band(num, 1) == 1   then perm = perm .. 'r' end\n+    if band(num, 2) == 2   then perm = perm .. 'w' end\n+    if band(num, 16) == 16 then perm = perm .. 'a' end\n+\n+    return perm\n+end\n+\n+\n+local function pack_acls(acls)\n+    local rst = {}\n+    local cnt, err, errmsg = struct.pack_int32(#acls)\n+    if err ~= nil then\n+        return nil, err, errmsg\n+    end\n+    table.insert(rst, cnt)\n+    for _, a in ipairs(acls) do","path":"lib/acid/zkcli.lua","position":81,"original_position":81,"commit_id":"7218f46ddcefc0c9a4da31397c9864f61ff917c1","original_commit_id":"7218f46ddcefc0c9a4da31397c9864f61ff917c1","user":{"login":"drmingdrmer","id":44069,"node_id":"MDQ6VXNlcjQ0MDY5","avatar_url":"https://avatars0.githubusercontent.com/u/44069?v=4","gravatar_id":"","url":"https://api.github.com/users/drmingdrmer","html_url":"https://github.com/drmingdrmer","followers_url":"https://api.github.com/users/drmingdrmer/followers","following_url":"https://api.github.com/users/drmingdrmer/following{/other_user}","gists_url":"https://api.github.com/users/drmingdrmer/gists{/gist_id}","starred_url":"https://api.github.com/users/drmingdrmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmingdrmer/subscriptions","organizations_url":"https://api.github.com/users/drmingdrmer/orgs","repos_url":"https://api.github.com/users/drmingdrmer/repos","events_url":"https://api.github.com/users/drmingdrmer/events{/privacy}","received_events_url":"https://api.github.com/users/drmingdrmer/received_events","type":"User","site_admin":false},"body":"这个函数啥意思? 尝试处理2种格式?","created_at":"2018-10-10T08:18:41Z","updated_at":"2018-10-10T08:44:51Z","html_url":"https://github.com/bsc-s2/lua-acid/pull/107#discussion_r223977703","pull_request_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/comments/223977703"},"html":{"href":"https://github.com/bsc-s2/lua-acid/pull/107#discussion_r223977703"},"pull_request":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107","id":218903720,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4OTAzNzIw","html_url":"https://github.com/bsc-s2/lua-acid/pull/107","diff_url":"https://github.com/bsc-s2/lua-acid/pull/107.diff","patch_url":"https://github.com/bsc-s2/lua-acid/pull/107.patch","issue_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/107","number":107,"state":"open","locked":false,"title":"add zkcli module","user":{"login":"liubaohai","id":26271283,"node_id":"MDQ6VXNlcjI2MjcxMjgz","avatar_url":"https://avatars2.githubusercontent.com/u/26271283?v=4","gravatar_id":"","url":"https://api.github.com/users/liubaohai","html_url":"https://github.com/liubaohai","followers_url":"https://api.github.com/users/liubaohai/followers","following_url":"https://api.github.com/users/liubaohai/following{/other_user}","gists_url":"https://api.github.com/users/liubaohai/gists{/gist_id}","starred_url":"https://api.github.com/users/liubaohai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liubaohai/subscriptions","organizations_url":"https://api.github.com/users/liubaohai/orgs","repos_url":"https://api.github.com/users/liubaohai/repos","events_url":"https://api.github.com/users/liubaohai/events{/privacy}","received_events_url":"https://api.github.com/users/liubaohai/received_events","type":"User","site_admin":false},"body":"实现lua版本的zk client。\r\n大部分的接口都已经实现。","created_at":"2018-09-28T09:18:03Z","updated_at":"2018-10-10T08:44:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c13898d5e61a5c22e64bb05f1850a757a275b9c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107/commits","review_comments_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107/comments","review_comment_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/107/comments","statuses_url":"https://api.github.com/repos/bsc-s2/lua-acid/statuses/7218f46ddcefc0c9a4da31397c9864f61ff917c1","head":{"label":"bsc-s2:lbh.zk","ref":"lbh.zk","sha":"7218f46ddcefc0c9a4da31397c9864f61ff917c1","user":{"login":"bsc-s2","id":36946445,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTQ2NDQ1","avatar_url":"https://avatars3.githubusercontent.com/u/36946445?v=4","gravatar_id":"","url":"https://api.github.com/users/bsc-s2","html_url":"https://github.com/bsc-s2","followers_url":"https://api.github.com/users/bsc-s2/followers","following_url":"https://api.github.com/users/bsc-s2/following{/other_user}","gists_url":"https://api.github.com/users/bsc-s2/gists{/gist_id}","starred_url":"https://api.github.com/users/bsc-s2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsc-s2/subscriptions","organizations_url":"https://api.github.com/users/bsc-s2/orgs","repos_url":"https://api.github.com/users/bsc-s2/repos","events_url":"https://api.github.com/users/bsc-s2/events{/privacy}","received_events_url":"https://api.github.com/users/bsc-s2/received_events","type":"Organization","site_admin":false},"repo":{"id":83309707,"node_id":"MDEwOlJlcG9zaXRvcnk4MzMwOTcwNw==","name":"lua-acid","full_name":"bsc-s2/lua-acid","private":false,"owner":{"login":"bsc-s2","id":36946445,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTQ2NDQ1","avatar_url":"https://avatars3.githubusercontent.com/u/36946445?v=4","gravatar_id":"","url":"https://api.github.com/users/bsc-s2","html_url":"https://github.com/bsc-s2","followers_url":"https://api.github.com/users/bsc-s2/followers","following_url":"https://api.github.com/users/bsc-s2/following{/other_user}","gists_url":"https://api.github.com/users/bsc-s2/gists{/gist_id}","starred_url":"https://api.github.com/users/bsc-s2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsc-s2/subscriptions","organizations_url":"https://api.github.com/users/bsc-s2/orgs","repos_url":"https://api.github.com/users/bsc-s2/repos","events_url":"https://api.github.com/users/bsc-s2/events{/privacy}","received_events_url":"https://api.github.com/users/bsc-s2/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bsc-s2/lua-acid","description":"A collection of lua util functions","fork":false,"url":"https://api.github.com/repos/bsc-s2/lua-acid","forks_url":"https://api.github.com/repos/bsc-s2/lua-acid/forks","keys_url":"https://api.github.com/repos/bsc-s2/lua-acid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsc-s2/lua-acid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsc-s2/lua-acid/teams","hooks_url":"https://api.github.com/repos/bsc-s2/lua-acid/hooks","issue_events_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/events{/number}","events_url":"https://api.github.com/repos/bsc-s2/lua-acid/events","assignees_url":"https://api.github.com/repos/bsc-s2/lua-acid/assignees{/user}","branches_url":"https://api.github.com/repos/bsc-s2/lua-acid/branches{/branch}","tags_url":"https://api.github.com/repos/bsc-s2/lua-acid/tags","blobs_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsc-s2/lua-acid/statuses/{sha}","languages_url":"https://api.github.com/repos/bsc-s2/lua-acid/languages","stargazers_url":"https://api.github.com/repos/bsc-s2/lua-acid/stargazers","contributors_url":"https://api.github.com/repos/bsc-s2/lua-acid/contributors","subscribers_url":"https://api.github.com/repos/bsc-s2/lua-acid/subscribers","subscription_url":"https://api.github.com/repos/bsc-s2/lua-acid/subscription","commits_url":"https://api.github.com/repos/bsc-s2/lua-acid/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsc-s2/lua-acid/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsc-s2/lua-acid/contents/{+path}","compare_url":"https://api.github.com/repos/bsc-s2/lua-acid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsc-s2/lua-acid/merges","archive_url":"https://api.github.com/repos/bsc-s2/lua-acid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsc-s2/lua-acid/downloads","issues_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues{/number}","pulls_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls{/number}","milestones_url":"https://api.github.com/repos/bsc-s2/lua-acid/milestones{/number}","notifications_url":"https://api.github.com/repos/bsc-s2/lua-acid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsc-s2/lua-acid/labels{/name}","releases_url":"https://api.github.com/repos/bsc-s2/lua-acid/releases{/id}","deployments_url":"https://api.github.com/repos/bsc-s2/lua-acid/deployments","created_at":"2017-02-27T12:49:27Z","updated_at":"2018-10-10T06:45:03Z","pushed_at":"2018-10-10T07:02:22Z","git_url":"git://github.com/bsc-s2/lua-acid.git","ssh_url":"git@github.com:bsc-s2/lua-acid.git","clone_url":"https://github.com/bsc-s2/lua-acid.git","svn_url":"https://github.com/bsc-s2/lua-acid","homepage":null,"size":459,"stargazers_count":8,"watchers_count":8,"language":"Lua","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":10,"watchers":8,"default_branch":"master"}},"base":{"label":"bsc-s2:master","ref":"master","sha":"18b1f12dec2c58d6e326f236d2d7e3b21c127fd2","user":{"login":"bsc-s2","id":36946445,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTQ2NDQ1","avatar_url":"https://avatars3.githubusercontent.com/u/36946445?v=4","gravatar_id":"","url":"https://api.github.com/users/bsc-s2","html_url":"https://github.com/bsc-s2","followers_url":"https://api.github.com/users/bsc-s2/followers","following_url":"https://api.github.com/users/bsc-s2/following{/other_user}","gists_url":"https://api.github.com/users/bsc-s2/gists{/gist_id}","starred_url":"https://api.github.com/users/bsc-s2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsc-s2/subscriptions","organizations_url":"https://api.github.com/users/bsc-s2/orgs","repos_url":"https://api.github.com/users/bsc-s2/repos","events_url":"https://api.github.com/users/bsc-s2/events{/privacy}","received_events_url":"https://api.github.com/users/bsc-s2/received_events","type":"Organization","site_admin":false},"repo":{"id":83309707,"node_id":"MDEwOlJlcG9zaXRvcnk4MzMwOTcwNw==","name":"lua-acid","full_name":"bsc-s2/lua-acid","private":false,"owner":{"login":"bsc-s2","id":36946445,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2OTQ2NDQ1","avatar_url":"https://avatars3.githubusercontent.com/u/36946445?v=4","gravatar_id":"","url":"https://api.github.com/users/bsc-s2","html_url":"https://github.com/bsc-s2","followers_url":"https://api.github.com/users/bsc-s2/followers","following_url":"https://api.github.com/users/bsc-s2/following{/other_user}","gists_url":"https://api.github.com/users/bsc-s2/gists{/gist_id}","starred_url":"https://api.github.com/users/bsc-s2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsc-s2/subscriptions","organizations_url":"https://api.github.com/users/bsc-s2/orgs","repos_url":"https://api.github.com/users/bsc-s2/repos","events_url":"https://api.github.com/users/bsc-s2/events{/privacy}","received_events_url":"https://api.github.com/users/bsc-s2/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bsc-s2/lua-acid","description":"A collection of lua util functions","fork":false,"url":"https://api.github.com/repos/bsc-s2/lua-acid","forks_url":"https://api.github.com/repos/bsc-s2/lua-acid/forks","keys_url":"https://api.github.com/repos/bsc-s2/lua-acid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bsc-s2/lua-acid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bsc-s2/lua-acid/teams","hooks_url":"https://api.github.com/repos/bsc-s2/lua-acid/hooks","issue_events_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/events{/number}","events_url":"https://api.github.com/repos/bsc-s2/lua-acid/events","assignees_url":"https://api.github.com/repos/bsc-s2/lua-acid/assignees{/user}","branches_url":"https://api.github.com/repos/bsc-s2/lua-acid/branches{/branch}","tags_url":"https://api.github.com/repos/bsc-s2/lua-acid/tags","blobs_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/refs{/sha}","trees_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bsc-s2/lua-acid/statuses/{sha}","languages_url":"https://api.github.com/repos/bsc-s2/lua-acid/languages","stargazers_url":"https://api.github.com/repos/bsc-s2/lua-acid/stargazers","contributors_url":"https://api.github.com/repos/bsc-s2/lua-acid/contributors","subscribers_url":"https://api.github.com/repos/bsc-s2/lua-acid/subscribers","subscription_url":"https://api.github.com/repos/bsc-s2/lua-acid/subscription","commits_url":"https://api.github.com/repos/bsc-s2/lua-acid/commits{/sha}","git_commits_url":"https://api.github.com/repos/bsc-s2/lua-acid/git/commits{/sha}","comments_url":"https://api.github.com/repos/bsc-s2/lua-acid/comments{/number}","issue_comment_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues/comments{/number}","contents_url":"https://api.github.com/repos/bsc-s2/lua-acid/contents/{+path}","compare_url":"https://api.github.com/repos/bsc-s2/lua-acid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bsc-s2/lua-acid/merges","archive_url":"https://api.github.com/repos/bsc-s2/lua-acid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bsc-s2/lua-acid/downloads","issues_url":"https://api.github.com/repos/bsc-s2/lua-acid/issues{/number}","pulls_url":"https://api.github.com/repos/bsc-s2/lua-acid/pulls{/number}","milestones_url":"https://api.github.com/repos/bsc-s2/lua-acid/milestones{/number}","notifications_url":"https://api.github.com/repos/bsc-s2/lua-acid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bsc-s2/lua-acid/labels{/name}","releases_url":"https://api.github.com/repos/bsc-s2/lua-acid/releases{/id}","deployments_url":"https://api.github.com/repos/bsc-s2/lua-acid/deployments","created_at":"2017-02-27T12:49:27Z","updated_at":"2018-10-10T06:45:03Z","pushed_at":"2018-10-10T07:02:22Z","git_url":"git://github.com/bsc-s2/lua-acid.git","ssh_url":"git@github.com:bsc-s2/lua-acid.git","clone_url":"https://github.com/bsc-s2/lua-acid.git","svn_url":"https://github.com/bsc-s2/lua-acid","homepage":null,"size":459,"stargazers_count":8,"watchers_count":8,"language":"Lua","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3,"open_issues":10,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107"},"html":{"href":"https://github.com/bsc-s2/lua-acid/pull/107"},"issue":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/issues/107"},"comments":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/bsc-s2/lua-acid/statuses/7218f46ddcefc0c9a4da31397c9864f61ff917c1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"drmingdrmer"}}