{"action":"created","comment":{"url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/comments/51910481","id":51910481,"diff_hunk":"@@ -0,0 +1,161 @@\n+// Class header\n+#include \"Id.hpp\"\n+\n+// System headers\n+#include <cstdint>\n+#include <iomanip>\n+#include <iostream>\n+#include <random>\n+#include <sstream>\n+#include <tuple>\n+\n+using namespace std;\n+\n+namespace lsst {\n+namespace qserv {\n+namespace qdht {\n+\n+\n+Id::Id()\n+:   msb{0}, xsb{0}, lsb{0}\n+{\n+}\n+\n+\n+void Id::genRandom()\n+{\n+    static random_device e;\n+    static uniform_int_distribution<uint64_t> dq(0, UINT64_MAX);\n+    static uniform_int_distribution<uint32_t> dl(0, UINT32_MAX);\n+    msb = dq(e);\n+    xsb = dq(e);\n+    lsb = dl(e);\n+}\n+\n+\n+bool Id::parse(string const& str)\n+{\n+    return (str.size() == 40)\n+        && (sscanf(&str[0], \"%16lx\", &msb) == 1)\n+        && (sscanf(&str[16], \"%16lx\", &xsb) == 1)\n+        && (sscanf(&str[32], \"%8x\", &lsb) == 1);\n+}\n+\n+\n+Id::operator string() const\n+{\n+    stringstream str;\n+    str << *this;\n+    return str.str();\n+}\n+\n+\n+bool Id::operator==(Id const& rhs) const\n+{\n+    return (msb == rhs.msb) && (xsb == rhs.xsb) && (lsb == rhs.lsb);\n+}\n+\n+\n+bool Id::operator<(Id const& rhs) const\n+{\n+    return (msb == rhs.msb)\n+        ? (xsb == rhs.xsb)\n+            ? (lsb < rhs.lsb)\n+            : (xsb < rhs.xsb)\n+        : (msb < rhs.msb);","path":"qdht/Id.cc","position":65,"original_position":65,"commit_id":"9708fe5579215da6debed39ddbcc2b9dcf10a283","original_commit_id":"9708fe5579215da6debed39ddbcc2b9dcf10a283","user":{"login":"jgates108","id":6558057,"avatar_url":"https://avatars.githubusercontent.com/u/6558057?v=3","gravatar_id":"","url":"https://api.github.com/users/jgates108","html_url":"https://github.com/jgates108","followers_url":"https://api.github.com/users/jgates108/followers","following_url":"https://api.github.com/users/jgates108/following{/other_user}","gists_url":"https://api.github.com/users/jgates108/gists{/gist_id}","starred_url":"https://api.github.com/users/jgates108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgates108/subscriptions","organizations_url":"https://api.github.com/users/jgates108/orgs","repos_url":"https://api.github.com/users/jgates108/repos","events_url":"https://api.github.com/users/jgates108/events{/privacy}","received_events_url":"https://api.github.com/users/jgates108/received_events","type":"User","site_admin":false},"body":"This isn't easy to read.","created_at":"2016-02-04T17:57:30Z","updated_at":"2016-02-04T17:57:30Z","html_url":"https://github.com/lsst-dm/qrepl/pull/3#discussion_r51910481","pull_request_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/comments/51910481"},"html":{"href":"https://github.com/lsst-dm/qrepl/pull/3#discussion_r51910481"},"pull_request":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3","id":57931311,"html_url":"https://github.com/lsst-dm/qrepl/pull/3","diff_url":"https://github.com/lsst-dm/qrepl/pull/3.diff","patch_url":"https://github.com/lsst-dm/qrepl/pull/3.patch","issue_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/3","number":3,"state":"open","locked":false,"title":"Add qdht::Id class","user":{"login":"fritzm","id":1530638,"avatar_url":"https://avatars.githubusercontent.com/u/1530638?v=3","gravatar_id":"","url":"https://api.github.com/users/fritzm","html_url":"https://github.com/fritzm","followers_url":"https://api.github.com/users/fritzm/followers","following_url":"https://api.github.com/users/fritzm/following{/other_user}","gists_url":"https://api.github.com/users/fritzm/gists{/gist_id}","starred_url":"https://api.github.com/users/fritzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fritzm/subscriptions","organizations_url":"https://api.github.com/users/fritzm/orgs","repos_url":"https://api.github.com/users/fritzm/repos","events_url":"https://api.github.com/users/fritzm/events{/privacy}","received_events_url":"https://api.github.com/users/fritzm/received_events","type":"User","site_admin":false},"body":"This PR introduces the basic qdht::Id class (node and message IDs for qdht) and associated unit tests.  A skeleton README.md for qdht was also started here.","created_at":"2016-02-02T02:15:11Z","updated_at":"2016-02-04T17:57:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ccdba5e206319f8fcc416eb005f4fa0c3e59954","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3/commits","review_comments_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3/comments","review_comment_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/3/comments","statuses_url":"https://api.github.com/repos/lsst-dm/qrepl/statuses/9708fe5579215da6debed39ddbcc2b9dcf10a283","head":{"label":"lsst-dm:u/fritzm/qdht-id","ref":"u/fritzm/qdht-id","sha":"9708fe5579215da6debed39ddbcc2b9dcf10a283","user":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"repo":{"id":41469055,"name":"qrepl","full_name":"lsst-dm/qrepl","owner":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst-dm/qrepl","description":"Qserv data replication prototyping","fork":false,"url":"https://api.github.com/repos/lsst-dm/qrepl","forks_url":"https://api.github.com/repos/lsst-dm/qrepl/forks","keys_url":"https://api.github.com/repos/lsst-dm/qrepl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst-dm/qrepl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst-dm/qrepl/teams","hooks_url":"https://api.github.com/repos/lsst-dm/qrepl/hooks","issue_events_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/events{/number}","events_url":"https://api.github.com/repos/lsst-dm/qrepl/events","assignees_url":"https://api.github.com/repos/lsst-dm/qrepl/assignees{/user}","branches_url":"https://api.github.com/repos/lsst-dm/qrepl/branches{/branch}","tags_url":"https://api.github.com/repos/lsst-dm/qrepl/tags","blobs_url":"https://api.github.com/repos/lsst-dm/qrepl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst-dm/qrepl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst-dm/qrepl/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst-dm/qrepl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst-dm/qrepl/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst-dm/qrepl/languages","stargazers_url":"https://api.github.com/repos/lsst-dm/qrepl/stargazers","contributors_url":"https://api.github.com/repos/lsst-dm/qrepl/contributors","subscribers_url":"https://api.github.com/repos/lsst-dm/qrepl/subscribers","subscription_url":"https://api.github.com/repos/lsst-dm/qrepl/subscription","commits_url":"https://api.github.com/repos/lsst-dm/qrepl/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst-dm/qrepl/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst-dm/qrepl/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst-dm/qrepl/contents/{+path}","compare_url":"https://api.github.com/repos/lsst-dm/qrepl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst-dm/qrepl/merges","archive_url":"https://api.github.com/repos/lsst-dm/qrepl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst-dm/qrepl/downloads","issues_url":"https://api.github.com/repos/lsst-dm/qrepl/issues{/number}","pulls_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst-dm/qrepl/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst-dm/qrepl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst-dm/qrepl/labels{/name}","releases_url":"https://api.github.com/repos/lsst-dm/qrepl/releases{/id}","deployments_url":"https://api.github.com/repos/lsst-dm/qrepl/deployments","created_at":"2015-08-27T06:13:27Z","updated_at":"2016-01-28T20:38:29Z","pushed_at":"2016-02-02T02:41:20Z","git_url":"git://github.com/lsst-dm/qrepl.git","ssh_url":"git@github.com:lsst-dm/qrepl.git","clone_url":"https://github.com/lsst-dm/qrepl.git","svn_url":"https://github.com/lsst-dm/qrepl","homepage":null,"size":91,"stargazers_count":0,"watchers_count":0,"language":"CMake","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lsst-dm:u/fritzm/qhttp","ref":"u/fritzm/qhttp","sha":"c39a7afea59f1a9bb77d65a85b604e808c91bc92","user":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"repo":{"id":41469055,"name":"qrepl","full_name":"lsst-dm/qrepl","owner":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst-dm/qrepl","description":"Qserv data replication prototyping","fork":false,"url":"https://api.github.com/repos/lsst-dm/qrepl","forks_url":"https://api.github.com/repos/lsst-dm/qrepl/forks","keys_url":"https://api.github.com/repos/lsst-dm/qrepl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst-dm/qrepl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst-dm/qrepl/teams","hooks_url":"https://api.github.com/repos/lsst-dm/qrepl/hooks","issue_events_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/events{/number}","events_url":"https://api.github.com/repos/lsst-dm/qrepl/events","assignees_url":"https://api.github.com/repos/lsst-dm/qrepl/assignees{/user}","branches_url":"https://api.github.com/repos/lsst-dm/qrepl/branches{/branch}","tags_url":"https://api.github.com/repos/lsst-dm/qrepl/tags","blobs_url":"https://api.github.com/repos/lsst-dm/qrepl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst-dm/qrepl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst-dm/qrepl/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst-dm/qrepl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst-dm/qrepl/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst-dm/qrepl/languages","stargazers_url":"https://api.github.com/repos/lsst-dm/qrepl/stargazers","contributors_url":"https://api.github.com/repos/lsst-dm/qrepl/contributors","subscribers_url":"https://api.github.com/repos/lsst-dm/qrepl/subscribers","subscription_url":"https://api.github.com/repos/lsst-dm/qrepl/subscription","commits_url":"https://api.github.com/repos/lsst-dm/qrepl/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst-dm/qrepl/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst-dm/qrepl/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst-dm/qrepl/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst-dm/qrepl/contents/{+path}","compare_url":"https://api.github.com/repos/lsst-dm/qrepl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst-dm/qrepl/merges","archive_url":"https://api.github.com/repos/lsst-dm/qrepl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst-dm/qrepl/downloads","issues_url":"https://api.github.com/repos/lsst-dm/qrepl/issues{/number}","pulls_url":"https://api.github.com/repos/lsst-dm/qrepl/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst-dm/qrepl/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst-dm/qrepl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst-dm/qrepl/labels{/name}","releases_url":"https://api.github.com/repos/lsst-dm/qrepl/releases{/id}","deployments_url":"https://api.github.com/repos/lsst-dm/qrepl/deployments","created_at":"2015-08-27T06:13:27Z","updated_at":"2016-01-28T20:38:29Z","pushed_at":"2016-02-02T02:41:20Z","git_url":"git://github.com/lsst-dm/qrepl.git","ssh_url":"git@github.com:lsst-dm/qrepl.git","clone_url":"https://github.com/lsst-dm/qrepl.git","svn_url":"https://github.com/lsst-dm/qrepl","homepage":null,"size":91,"stargazers_count":0,"watchers_count":0,"language":"CMake","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3"},"html":{"href":"https://github.com/lsst-dm/qrepl/pull/3"},"issue":{"href":"https://api.github.com/repos/lsst-dm/qrepl/issues/3"},"comments":{"href":"https://api.github.com/repos/lsst-dm/qrepl/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lsst-dm/qrepl/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/lsst-dm/qrepl/statuses/9708fe5579215da6debed39ddbcc2b9dcf10a283"}}}}