{"action":"created","comment":{"url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments/57750878","id":57750878,"diff_hunk":"@@ -0,0 +1,99 @@\n+/**\n+ *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,\n+ *     University of Wisconsin—Madison.\n+ *\n+ *   Licensed under the Apache License, Version 2.0 (the \"License\");\n+ *   you may not use this file except in compliance with the License.\n+ *   You may obtain a copy of the License at\n+ *\n+ *       http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ *   Unless required by applicable law or agreed to in writing, software\n+ *   distributed under the License is distributed on an \"AS IS\" BASIS,\n+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ *   See the License for the specific language governing permissions and\n+ *   limitations under the License.\n+ **/\n+\n+#include \"transaction/ResourceId.hpp\"\n+\n+#include <cstddef>\n+#include <string>\n+#include <utility>\n+\n+namespace quickstep {\n+\n+namespace transaction {\n+\n+bool ResourceId::operator==(const ResourceId &other) const {\n+  return (db_id_ == other.db_id_) &&\n+    (rel_id_ == other.rel_id_) &&\n+    (block_id_ == other.block_id_) &&\n+    (tuple_id_ == other.tuple_id_);\n+}\n+\n+bool ResourceId::hasParent() const {\n+  return !isDatabaseAccess();\n+}\n+\n+ResourceId ResourceId::getParentResourceId() const {\n+  if (isRelationAccess()) {\n+    return ResourceId(db_id_);\n+  } else if (isBlockAccess()) {\n+    return ResourceId(db_id_, rel_id_);\n+  } else if (isTupleAccess()) {\n+    return ResourceId(db_id_, rel_id_, block_id_);\n+  } else {\n+    FATAL_ERROR(\"Trying to call getParentResourceId on database\");\n+  }\n+}\n+\n+bool ResourceId::isDatabaseAccess() const {\n+  return (db_id_ != kDbIdPlaceholder) &&\n+    (rel_id_ == kRelIdPlaceholder) &&\n+    (block_id_ == kBlockIdPlaceholder) &&\n+    (tuple_id_ == kTupleIdPlaceholder);","path":"transaction/ResourceId.cpp","position":55,"original_position":55,"commit_id":"6ced90a3052fd031f2504712310f1deb93ab0592","original_commit_id":"6ced90a3052fd031f2504712310f1deb93ab0592","user":{"login":"hakanmemisoglu","id":2506341,"avatar_url":"https://avatars.githubusercontent.com/u/2506341?v=3","gravatar_id":"","url":"https://api.github.com/users/hakanmemisoglu","html_url":"https://github.com/hakanmemisoglu","followers_url":"https://api.github.com/users/hakanmemisoglu/followers","following_url":"https://api.github.com/users/hakanmemisoglu/following{/other_user}","gists_url":"https://api.github.com/users/hakanmemisoglu/gists{/gist_id}","starred_url":"https://api.github.com/users/hakanmemisoglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakanmemisoglu/subscriptions","organizations_url":"https://api.github.com/users/hakanmemisoglu/orgs","repos_url":"https://api.github.com/users/hakanmemisoglu/repos","events_url":"https://api.github.com/users/hakanmemisoglu/events{/privacy}","received_events_url":"https://api.github.com/users/hakanmemisoglu/received_events","type":"User","site_admin":false},"body":"I will implement the private methods.","created_at":"2016-03-29T16:08:51Z","updated_at":"2016-03-29T16:08:51Z","html_url":"https://github.com/pivotalsoftware/quickstep/pull/100#discussion_r57750878","pull_request_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100","_links":{"self":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments/57750878"},"html":{"href":"https://github.com/pivotalsoftware/quickstep/pull/100#discussion_r57750878"},"pull_request":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100"}}},"pull_request":{"url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100","id":64328083,"html_url":"https://github.com/pivotalsoftware/quickstep/pull/100","diff_url":"https://github.com/pivotalsoftware/quickstep/pull/100.diff","patch_url":"https://github.com/pivotalsoftware/quickstep/pull/100.patch","issue_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/100","number":100,"state":"open","locked":false,"title":"Transaction part2","user":{"login":"hakanmemisoglu","id":2506341,"avatar_url":"https://avatars.githubusercontent.com/u/2506341?v=3","gravatar_id":"","url":"https://api.github.com/users/hakanmemisoglu","html_url":"https://github.com/hakanmemisoglu","followers_url":"https://api.github.com/users/hakanmemisoglu/followers","following_url":"https://api.github.com/users/hakanmemisoglu/following{/other_user}","gists_url":"https://api.github.com/users/hakanmemisoglu/gists{/gist_id}","starred_url":"https://api.github.com/users/hakanmemisoglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakanmemisoglu/subscriptions","organizations_url":"https://api.github.com/users/hakanmemisoglu/orgs","repos_url":"https://api.github.com/users/hakanmemisoglu/repos","events_url":"https://api.github.com/users/hakanmemisoglu/events{/privacy}","received_events_url":"https://api.github.com/users/hakanmemisoglu/received_events","type":"User","site_admin":false},"body":"This PR introduces new classes for transaction support.\r\n\r\n- AccessMode: Represents access level of the lock such as S, X, IS, IX. Based on [[Gray et al.]](http://research.microsoft.com/en-us/um/people/gray/papers/Granularity%20of%20Locks%20and%20Degrees%20of%20Consistency%20RJ%201654.pdf)\r\n\r\n- ResourceId: Each logical and physical section (database, relation, block) of DBMS has a unique resource id associated with it.\r\n\r\n- Lock: Since the concurrency control will be based on Strict 2PL, we will need locks. In a simple manner, it is a tuple of AccessMode and ResourceId.\r\n","created_at":"2016-03-28T14:40:34Z","updated_at":"2016-03-29T16:08:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c88412df553d1f84109a2018f807cdbeaf7c092","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100/commits","review_comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100/comments","review_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/100/comments","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/6ced90a3052fd031f2504712310f1deb93ab0592","head":{"label":"pivotalsoftware:transaction-part2","ref":"transaction-part2","sha":"6ced90a3052fd031f2504712310f1deb93ab0592","user":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":45578105,"name":"quickstep","full_name":"pivotalsoftware/quickstep","owner":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pivotalsoftware/quickstep","description":"Quickstep Project","fork":false,"url":"https://api.github.com/repos/pivotalsoftware/quickstep","forks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/forks","keys_url":"https://api.github.com/repos/pivotalsoftware/quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pivotalsoftware/quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pivotalsoftware/quickstep/teams","hooks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/hooks","issue_events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/events","assignees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/pivotalsoftware/quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/tags","blobs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/pivotalsoftware/quickstep/languages","stargazers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/stargazers","contributors_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contributors","subscribers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscribers","subscription_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscription","commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/pivotalsoftware/quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pivotalsoftware/quickstep/merges","archive_url":"https://api.github.com/repos/pivotalsoftware/quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pivotalsoftware/quickstep/downloads","issues_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/pivotalsoftware/quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/pivotalsoftware/quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pivotalsoftware/quickstep/labels{/name}","releases_url":"https://api.github.com/repos/pivotalsoftware/quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/deployments","created_at":"2015-11-05T01:06:50Z","updated_at":"2016-03-26T15:05:34Z","pushed_at":"2016-03-29T03:20:50Z","git_url":"git://github.com/pivotalsoftware/quickstep.git","ssh_url":"git@github.com:pivotalsoftware/quickstep.git","clone_url":"https://github.com/pivotalsoftware/quickstep.git","svn_url":"https://github.com/pivotalsoftware/quickstep","homepage":null,"size":7604,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":13,"forks":8,"open_issues":13,"watchers":13,"default_branch":"master"}},"base":{"label":"pivotalsoftware:master","ref":"master","sha":"e732622379a270e68f9d782f310ecfbaaffe7d02","user":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":45578105,"name":"quickstep","full_name":"pivotalsoftware/quickstep","owner":{"login":"pivotalsoftware","id":4247270,"avatar_url":"https://avatars.githubusercontent.com/u/4247270?v=3","gravatar_id":"","url":"https://api.github.com/users/pivotalsoftware","html_url":"https://github.com/pivotalsoftware","followers_url":"https://api.github.com/users/pivotalsoftware/followers","following_url":"https://api.github.com/users/pivotalsoftware/following{/other_user}","gists_url":"https://api.github.com/users/pivotalsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/pivotalsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivotalsoftware/subscriptions","organizations_url":"https://api.github.com/users/pivotalsoftware/orgs","repos_url":"https://api.github.com/users/pivotalsoftware/repos","events_url":"https://api.github.com/users/pivotalsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/pivotalsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pivotalsoftware/quickstep","description":"Quickstep Project","fork":false,"url":"https://api.github.com/repos/pivotalsoftware/quickstep","forks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/forks","keys_url":"https://api.github.com/repos/pivotalsoftware/quickstep/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pivotalsoftware/quickstep/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pivotalsoftware/quickstep/teams","hooks_url":"https://api.github.com/repos/pivotalsoftware/quickstep/hooks","issue_events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/events{/number}","events_url":"https://api.github.com/repos/pivotalsoftware/quickstep/events","assignees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/assignees{/user}","branches_url":"https://api.github.com/repos/pivotalsoftware/quickstep/branches{/branch}","tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/tags","blobs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/refs{/sha}","trees_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/{sha}","languages_url":"https://api.github.com/repos/pivotalsoftware/quickstep/languages","stargazers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/stargazers","contributors_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contributors","subscribers_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscribers","subscription_url":"https://api.github.com/repos/pivotalsoftware/quickstep/subscription","commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/commits{/sha}","git_commits_url":"https://api.github.com/repos/pivotalsoftware/quickstep/git/commits{/sha}","comments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/comments{/number}","issue_comment_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/comments{/number}","contents_url":"https://api.github.com/repos/pivotalsoftware/quickstep/contents/{+path}","compare_url":"https://api.github.com/repos/pivotalsoftware/quickstep/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pivotalsoftware/quickstep/merges","archive_url":"https://api.github.com/repos/pivotalsoftware/quickstep/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pivotalsoftware/quickstep/downloads","issues_url":"https://api.github.com/repos/pivotalsoftware/quickstep/issues{/number}","pulls_url":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls{/number}","milestones_url":"https://api.github.com/repos/pivotalsoftware/quickstep/milestones{/number}","notifications_url":"https://api.github.com/repos/pivotalsoftware/quickstep/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pivotalsoftware/quickstep/labels{/name}","releases_url":"https://api.github.com/repos/pivotalsoftware/quickstep/releases{/id}","deployments_url":"https://api.github.com/repos/pivotalsoftware/quickstep/deployments","created_at":"2015-11-05T01:06:50Z","updated_at":"2016-03-26T15:05:34Z","pushed_at":"2016-03-29T03:20:50Z","git_url":"git://github.com/pivotalsoftware/quickstep.git","ssh_url":"git@github.com:pivotalsoftware/quickstep.git","clone_url":"https://github.com/pivotalsoftware/quickstep.git","svn_url":"https://github.com/pivotalsoftware/quickstep","homepage":null,"size":7604,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":13,"forks":8,"open_issues":13,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100"},"html":{"href":"https://github.com/pivotalsoftware/quickstep/pull/100"},"issue":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/100"},"comments":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/pivotalsoftware/quickstep/statuses/6ced90a3052fd031f2504712310f1deb93ab0592"}}}}