{"action":"created","comment":{"url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/comments/30392298","id":30392298,"diff_hunk":"@@ -0,0 +1,555 @@\n+/*\n+    Copyright (c) 2011-2015 Anton Matveenko <antmat@yandex-team.ru>\n+    Copyright (c) 2011-2015 Other contributors as noted in the AUTHORS file.\n+\n+    This file is part of Cocaine.\n+\n+    Cocaine is free software; you can redistribute it and/or modify\n+    it under the terms of the GNU Lesser General Public License as published by\n+    the Free Software Foundation; either version 3 of the License, or\n+    (at your option) any later version.\n+\n+    Cocaine is distributed in the hope that it will be useful,\n+    but WITHOUT ANY WARRANTY; without even the implied warranty of\n+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+    GNU Lesser General Public License for more details.\n+\n+    You should have received a copy of the GNU Lesser General Public License\n+    along with this program. If not, see <http://www.gnu.org/licenses/>.\n+*/\n+\n+#ifndef HEADER_HPP\n+#define HEADER_HPP\n+\n+#include \"cocaine/traits.hpp\"\n+#include \"cocaine/exceptions.hpp\"\n+\n+#include <cstring>\n+#include <array>\n+#include <cassert>\n+#include <functional>\n+\n+namespace cocaine { namespace io  {\n+\n+enum class header_id {\n+    TRACE_ID,\n+    SPAN_ID,\n+    PARENT_ID,\n+    //Not used. Just indicates size of headers.\n+    LAST\n+};\n+\n+// Represents header name. Can be constructed only from headers enum.\n+class header_key_t {\n+public:\n+    constexpr\n+    header_key_t(header_id _id) :\n+        id(_id)\n+    {}\n+\n+    inline\n+    const std::string&\n+    name() const {\n+        return names()[static_cast<size_t>(id)];\n+    }\n+\n+private:\n+    header_id id;\n+    static constexpr size_t header_cnt = static_cast<size_t>(header_id::LAST);\n+\n+    inline\n+    static\n+    const std::array<std::string, header_cnt>&\n+    names() {\n+        static std::array<std::string, header_cnt> header_names {{\n+            \"trace_id\",\n+            \"span_id\",\n+            \"parent_id\"\n+        }};\n+        return header_names;\n+    }\n+};\n+\n+// Header class.\n+// Represents non-owning header referring to some external memory.\n+// Can be constructed only via header table\n+class header_t {\n+public:\n+    struct str {","path":"include/cocaine/rpc/asio/header.hpp","position":78,"original_position":78,"commit_id":"522d1e03d354ad1e00e2ad98cb068b5fb7f653cf","original_commit_id":"f0976dacf098e8cdb6210aa64fd1f0cdbbf3c75a","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"body":"literal_t represents literal, while str represents non-owning string. Besides literal_t has constant size, so can not be copied or assigned and do not provide comparision operator.","created_at":"2015-05-15T08:23:24Z","updated_at":"2015-05-15T08:23:24Z","html_url":"https://github.com/cocaine/cocaine-core/pull/203#discussion_r30392298","pull_request_url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203","_links":{"self":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/comments/30392298"},"html":{"href":"https://github.com/cocaine/cocaine-core/pull/203#discussion_r30392298"},"pull_request":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203"}}},"pull_request":{"url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203","id":35334606,"html_url":"https://github.com/cocaine/cocaine-core/pull/203","diff_url":"https://github.com/cocaine/cocaine-core/pull/203.diff","patch_url":"https://github.com/cocaine/cocaine-core/pull/203.patch","issue_url":"https://api.github.com/repos/cocaine/cocaine-core/issues/203","number":203,"state":"open","locked":false,"title":"Headers implementation","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"body":"This PR introduces http2-like headers for cocaine.","created_at":"2015-05-13T14:48:59Z","updated_at":"2015-05-15T08:23:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b692015da16846604badc869f9cc3d753bb684b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203/commits","review_comments_url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203/comments","review_comment_url":"https://api.github.com/repos/cocaine/cocaine-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cocaine/cocaine-core/issues/203/comments","statuses_url":"https://api.github.com/repos/cocaine/cocaine-core/statuses/522d1e03d354ad1e00e2ad98cb068b5fb7f653cf","head":{"label":"antmat:headers","ref":"headers","sha":"522d1e03d354ad1e00e2ad98cb068b5fb7f653cf","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"repo":{"id":30540805,"name":"cocaine-core","full_name":"antmat/cocaine-core","owner":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/antmat/cocaine-core","description":"An open platform to build your own PaaS clouds.","fork":true,"url":"https://api.github.com/repos/antmat/cocaine-core","forks_url":"https://api.github.com/repos/antmat/cocaine-core/forks","keys_url":"https://api.github.com/repos/antmat/cocaine-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antmat/cocaine-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antmat/cocaine-core/teams","hooks_url":"https://api.github.com/repos/antmat/cocaine-core/hooks","issue_events_url":"https://api.github.com/repos/antmat/cocaine-core/issues/events{/number}","events_url":"https://api.github.com/repos/antmat/cocaine-core/events","assignees_url":"https://api.github.com/repos/antmat/cocaine-core/assignees{/user}","branches_url":"https://api.github.com/repos/antmat/cocaine-core/branches{/branch}","tags_url":"https://api.github.com/repos/antmat/cocaine-core/tags","blobs_url":"https://api.github.com/repos/antmat/cocaine-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antmat/cocaine-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antmat/cocaine-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/antmat/cocaine-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antmat/cocaine-core/statuses/{sha}","languages_url":"https://api.github.com/repos/antmat/cocaine-core/languages","stargazers_url":"https://api.github.com/repos/antmat/cocaine-core/stargazers","contributors_url":"https://api.github.com/repos/antmat/cocaine-core/contributors","subscribers_url":"https://api.github.com/repos/antmat/cocaine-core/subscribers","subscription_url":"https://api.github.com/repos/antmat/cocaine-core/subscription","commits_url":"https://api.github.com/repos/antmat/cocaine-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/antmat/cocaine-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/antmat/cocaine-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/antmat/cocaine-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/antmat/cocaine-core/contents/{+path}","compare_url":"https://api.github.com/repos/antmat/cocaine-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antmat/cocaine-core/merges","archive_url":"https://api.github.com/repos/antmat/cocaine-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antmat/cocaine-core/downloads","issues_url":"https://api.github.com/repos/antmat/cocaine-core/issues{/number}","pulls_url":"https://api.github.com/repos/antmat/cocaine-core/pulls{/number}","milestones_url":"https://api.github.com/repos/antmat/cocaine-core/milestones{/number}","notifications_url":"https://api.github.com/repos/antmat/cocaine-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antmat/cocaine-core/labels{/name}","releases_url":"https://api.github.com/repos/antmat/cocaine-core/releases{/id}","created_at":"2015-02-09T14:53:42Z","updated_at":"2015-04-10T11:11:09Z","pushed_at":"2015-05-13T17:37:42Z","git_url":"git://github.com/antmat/cocaine-core.git","ssh_url":"git@github.com:antmat/cocaine-core.git","clone_url":"https://github.com/antmat/cocaine-core.git","svn_url":"https://github.com/antmat/cocaine-core","homepage":"","size":14536,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"cocaine:master","ref":"master","sha":"754abb0bd850d32073223f9eed8fcd308b4b700d","user":{"login":"cocaine","id":1553730,"avatar_url":"https://avatars.githubusercontent.com/u/1553730?v=3","gravatar_id":"","url":"https://api.github.com/users/cocaine","html_url":"https://github.com/cocaine","followers_url":"https://api.github.com/users/cocaine/followers","following_url":"https://api.github.com/users/cocaine/following{/other_user}","gists_url":"https://api.github.com/users/cocaine/gists{/gist_id}","starred_url":"https://api.github.com/users/cocaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocaine/subscriptions","organizations_url":"https://api.github.com/users/cocaine/orgs","repos_url":"https://api.github.com/users/cocaine/repos","events_url":"https://api.github.com/users/cocaine/events{/privacy}","received_events_url":"https://api.github.com/users/cocaine/received_events","type":"Organization","site_admin":false},"repo":{"id":1516094,"name":"cocaine-core","full_name":"cocaine/cocaine-core","owner":{"login":"cocaine","id":1553730,"avatar_url":"https://avatars.githubusercontent.com/u/1553730?v=3","gravatar_id":"","url":"https://api.github.com/users/cocaine","html_url":"https://github.com/cocaine","followers_url":"https://api.github.com/users/cocaine/followers","following_url":"https://api.github.com/users/cocaine/following{/other_user}","gists_url":"https://api.github.com/users/cocaine/gists{/gist_id}","starred_url":"https://api.github.com/users/cocaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocaine/subscriptions","organizations_url":"https://api.github.com/users/cocaine/orgs","repos_url":"https://api.github.com/users/cocaine/repos","events_url":"https://api.github.com/users/cocaine/events{/privacy}","received_events_url":"https://api.github.com/users/cocaine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocaine/cocaine-core","description":"An open platform to build your own PaaS clouds.","fork":false,"url":"https://api.github.com/repos/cocaine/cocaine-core","forks_url":"https://api.github.com/repos/cocaine/cocaine-core/forks","keys_url":"https://api.github.com/repos/cocaine/cocaine-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocaine/cocaine-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocaine/cocaine-core/teams","hooks_url":"https://api.github.com/repos/cocaine/cocaine-core/hooks","issue_events_url":"https://api.github.com/repos/cocaine/cocaine-core/issues/events{/number}","events_url":"https://api.github.com/repos/cocaine/cocaine-core/events","assignees_url":"https://api.github.com/repos/cocaine/cocaine-core/assignees{/user}","branches_url":"https://api.github.com/repos/cocaine/cocaine-core/branches{/branch}","tags_url":"https://api.github.com/repos/cocaine/cocaine-core/tags","blobs_url":"https://api.github.com/repos/cocaine/cocaine-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocaine/cocaine-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocaine/cocaine-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocaine/cocaine-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocaine/cocaine-core/statuses/{sha}","languages_url":"https://api.github.com/repos/cocaine/cocaine-core/languages","stargazers_url":"https://api.github.com/repos/cocaine/cocaine-core/stargazers","contributors_url":"https://api.github.com/repos/cocaine/cocaine-core/contributors","subscribers_url":"https://api.github.com/repos/cocaine/cocaine-core/subscribers","subscription_url":"https://api.github.com/repos/cocaine/cocaine-core/subscription","commits_url":"https://api.github.com/repos/cocaine/cocaine-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocaine/cocaine-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocaine/cocaine-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocaine/cocaine-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cocaine/cocaine-core/contents/{+path}","compare_url":"https://api.github.com/repos/cocaine/cocaine-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocaine/cocaine-core/merges","archive_url":"https://api.github.com/repos/cocaine/cocaine-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocaine/cocaine-core/downloads","issues_url":"https://api.github.com/repos/cocaine/cocaine-core/issues{/number}","pulls_url":"https://api.github.com/repos/cocaine/cocaine-core/pulls{/number}","milestones_url":"https://api.github.com/repos/cocaine/cocaine-core/milestones{/number}","notifications_url":"https://api.github.com/repos/cocaine/cocaine-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocaine/cocaine-core/labels{/name}","releases_url":"https://api.github.com/repos/cocaine/cocaine-core/releases{/id}","created_at":"2011-03-23T12:31:26Z","updated_at":"2015-05-08T11:13:44Z","pushed_at":"2015-05-13T17:37:42Z","git_url":"git://github.com/cocaine/cocaine-core.git","ssh_url":"git@github.com:cocaine/cocaine-core.git","clone_url":"https://github.com/cocaine/cocaine-core.git","svn_url":"https://github.com/cocaine/cocaine-core","homepage":"","size":19907,"stargazers_count":812,"watchers_count":812,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":11,"forks":72,"open_issues":11,"watchers":812,"default_branch":"v0.12"}},"_links":{"self":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203"},"html":{"href":"https://github.com/cocaine/cocaine-core/pull/203"},"issue":{"href":"https://api.github.com/repos/cocaine/cocaine-core/issues/203"},"comments":{"href":"https://api.github.com/repos/cocaine/cocaine-core/issues/203/comments"},"review_comments":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203/comments"},"review_comment":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cocaine/cocaine-core/pulls/203/commits"},"statuses":{"href":"https://api.github.com/repos/cocaine/cocaine-core/statuses/522d1e03d354ad1e00e2ad98cb068b5fb7f653cf"}}}}