GitHub PullRequestReviewCommentEvent at 2014-10-06 17:40:29
Repository: rippled
Actor: vinniefalco
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/18471670","id":18471670,"diff_hunk":"@@ -0,0 +1,95 @@\n+//------------------------------------------------------------------------------\n+/*\n+    This file is part of rippled: https://github.com/ripple/rippled\n+    Copyright (c) 2014 Ripple Labs Inc.\n+\n+    Permission to use, copy, modify, and/or distribute this software for any\n+    purpose  with  or without fee is hereby granted, provided that the above\n+    copyright notice and this permission notice appear in all copies.\n+\n+    THE  SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n+    WITH  REGARD  TO  THIS  SOFTWARE  INCLUDING  ALL  IMPLIED  WARRANTIES  OF\n+    MERCHANTABILITY  AND  FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n+    ANY  SPECIAL ,  DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n+    WHATSOEVER  RESULTING  FROM  LOSS  OF USE, DATA OR PROFITS, WHETHER IN AN\n+    ACTION  OF  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n+    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n+*/\n+//==============================================================================\n+\n+#include \"MetricsResource.h\"\n+\n+#include <memory>\n+\n+namespace ripple {\n+\n+namespace metrics {\n+\n+namespace impl {\n+\n+MetricsResource::MetricsResource(ExposableMetricsElement* element)\n+  : m_element (element) {}\n+\n+const std::string\n+MetricsResource::name() const\n+{\n+  return m_element->name();\n+};\n+\n+const Json::Value\n+MetricsResource::history (const clock_type::time_point& since, const resolution& res) const\n+{\n+    Json::Value ret (Json::arrayValue);\n+    std::vector<bucket> hist (m_element->getHistory (since, res));\n+\n+    for (auto i = hist.cbegin(); i != hist.cend(); i++) {\n+        Json::Value dataPoint (Json::objectValue);\n+        dataPoint[\"average\"] = static_cast<int>(i->avg);\n+        dataPoint[\"count\"] = static_cast<int>(i->count);\n+        dataPoint[\"min\"] = static_cast<int>(i->min);\n+        dataPoint[\"max\"] = static_cast<int>(i->max);\n+        ret.append (dataPoint);\n+    }\n+\n+    return ret;\n+}\n+\n+const Json::Value\n+MetricsResourceList::history (const clock_type::time_point& since, const resolution& res) const\n+{\n+    Json::Value ret (Json::objectValue);\n+    for (auto i = m_list.cbegin(); i != m_list.cend(); i++) {\n+        MetricsResource mRes (*i);\n+        ret[mRes.name()] = mRes.history (since, res);\n+    }\n+\n+    return ret;\n+}\n+\n+const Json::Value\n+MetricsResourceList::list () const\n+{\n+    Json::Value ret (Json::arrayValue);\n+    for(auto i = m_list.cbegin (); i != m_list.cend (); i++) {\n+      ret.append ((*i)->name ());\n+    }\n+    return ret;\n+}\n+\n+std::unique_ptr<MetricsResource>\n+MetricsResourceList::getNamedResource (const std::string& name) const\n+{\n+    for(auto i = m_list.cbegin (); i != m_list.cend (); i++) {\n+      if ((*i)->name () == name)\n+        return std::make_unique<MetricsResource> (*i);\n+    }\n+    // FIXME: raise exception?","path":"src/ripple/metrics/impl/MetricsResource.cpp","position":84,"original_position":86,"commit_id":"ccd44c87d2ab7dbb80bef1fd1b7d53dc229b0920","original_commit_id":"04977a669aab9250946ca8079bd893162db5c727","user":{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars.githubusercontent.com/u/1503976?v=2","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"body":"Better question is why aren't we using a case-insensitive `map` or `unordered_map`","created_at":"2014-10-06T17:40:29Z","updated_at":"2014-10-06T17:40:29Z","html_url":"https://github.com/ripple/rippled/pull/606#discussion_r18471670","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/606","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/18471670"},"html":{"href":"https://github.com/ripple/rippled/pull/606#discussion_r18471670"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/606"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/606","id":22230568,"html_url":"https://github.com/ripple/rippled/pull/606","diff_url":"https://github.com/ripple/rippled/pull/606.diff","patch_url":"https://github.com/ripple/rippled/pull/606.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/606","number":606,"state":"open","locked":false,"title":"Implement a statistics HTTP server","user":{"login":"tdfischer","id":15848,"avatar_url":"https://avatars.githubusercontent.com/u/15848?v=2","gravatar_id":"","url":"https://api.github.com/users/tdfischer","html_url":"https://github.com/tdfischer","followers_url":"https://api.github.com/users/tdfischer/followers","following_url":"https://api.github.com/users/tdfischer/following{/other_user}","gists_url":"https://api.github.com/users/tdfischer/gists{/gist_id}","starred_url":"https://api.github.com/users/tdfischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdfischer/subscriptions","organizations_url":"https://api.github.com/users/tdfischer/orgs","repos_url":"https://api.github.com/users/tdfischer/repos","events_url":"https://api.github.com/users/tdfischer/events{/privacy}","received_events_url":"https://api.github.com/users/tdfischer/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-03T21:17:50Z","updated_at":"2014-10-06T17:40:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a390aee59dab731d052d30e449e189d0f18ab62","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/606/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/606/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/606/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/ccd44c87d2ab7dbb80bef1fd1b7d53dc229b0920","head":{"label":"tdfischer:dashboard-buckets","ref":"dashboard-buckets","sha":"ccd44c87d2ab7dbb80bef1fd1b7d53dc229b0920","user":{"login":"tdfischer","id":15848,"avatar_url":"https://avatars.githubusercontent.com/u/15848?v=2","gravatar_id":"","url":"https://api.github.com/users/tdfischer","html_url":"https://github.com/tdfischer","followers_url":"https://api.github.com/users/tdfischer/followers","following_url":"https://api.github.com/users/tdfischer/following{/other_user}","gists_url":"https://api.github.com/users/tdfischer/gists{/gist_id}","starred_url":"https://api.github.com/users/tdfischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdfischer/subscriptions","organizations_url":"https://api.github.com/users/tdfischer/orgs","repos_url":"https://api.github.com/users/tdfischer/repos","events_url":"https://api.github.com/users/tdfischer/events{/privacy}","received_events_url":"https://api.github.com/users/tdfischer/received_events","type":"User","site_admin":false},"repo":{"id":22696391,"name":"rippled","full_name":"tdfischer/rippled","owner":{"login":"tdfischer","id":15848,"avatar_url":"https://avatars.githubusercontent.com/u/15848?v=2","gravatar_id":"","url":"https://api.github.com/users/tdfischer","html_url":"https://github.com/tdfischer","followers_url":"https://api.github.com/users/tdfischer/followers","following_url":"https://api.github.com/users/tdfischer/following{/other_user}","gists_url":"https://api.github.com/users/tdfischer/gists{/gist_id}","starred_url":"https://api.github.com/users/tdfischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdfischer/subscriptions","organizations_url":"https://api.github.com/users/tdfischer/orgs","repos_url":"https://api.github.com/users/tdfischer/repos","events_url":"https://api.github.com/users/tdfischer/events{/privacy}","received_events_url":"https://api.github.com/users/tdfischer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tdfischer/rippled","description":"Ripple peer-to-peer network daemon","fork":true,"url":"https://api.github.com/repos/tdfischer/rippled","forks_url":"https://api.github.com/repos/tdfischer/rippled/forks","keys_url":"https://api.github.com/repos/tdfischer/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tdfischer/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tdfischer/rippled/teams","hooks_url":"https://api.github.com/repos/tdfischer/rippled/hooks","issue_events_url":"https://api.github.com/repos/tdfischer/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/tdfischer/rippled/events","assignees_url":"https://api.github.com/repos/tdfischer/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/tdfischer/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/tdfischer/rippled/tags","blobs_url":"https://api.github.com/repos/tdfischer/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tdfischer/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tdfischer/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/tdfischer/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tdfischer/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/tdfischer/rippled/languages","stargazers_url":"https://api.github.com/repos/tdfischer/rippled/stargazers","contributors_url":"https://api.github.com/repos/tdfischer/rippled/contributors","subscribers_url":"https://api.github.com/repos/tdfischer/rippled/subscribers","subscription_url":"https://api.github.com/repos/tdfischer/rippled/subscription","commits_url":"https://api.github.com/repos/tdfischer/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/tdfischer/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/tdfischer/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/tdfischer/rippled/issues/comments/{number}","contents_url":"https://api.github.com/repos/tdfischer/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/tdfischer/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tdfischer/rippled/merges","archive_url":"https://api.github.com/repos/tdfischer/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tdfischer/rippled/downloads","issues_url":"https://api.github.com/repos/tdfischer/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/tdfischer/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/tdfischer/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/tdfischer/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tdfischer/rippled/labels{/name}","releases_url":"https://api.github.com/repos/tdfischer/rippled/releases{/id}","created_at":"2014-08-06T20:06:08Z","updated_at":"2014-08-13T23:56:42Z","pushed_at":"2014-10-06T17:19:09Z","git_url":"git://github.com/tdfischer/rippled.git","ssh_url":"git@github.com:tdfischer/rippled.git","clone_url":"https://github.com/tdfischer/rippled.git","svn_url":"https://github.com/tdfischer/rippled","homepage":"https://ripple.com","size":63092,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"ripple:develop","ref":"develop","sha":"11615112079f9e69b6f950a2db162bc143ac1de9","user":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=2","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"repo":{"id":2724167,"name":"rippled","full_name":"ripple/rippled","owner":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=2","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ripple/rippled","description":"Ripple peer-to-peer network daemon","fork":false,"url":"https://api.github.com/repos/ripple/rippled","forks_url":"https://api.github.com/repos/ripple/rippled/forks","keys_url":"https://api.github.com/repos/ripple/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ripple/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ripple/rippled/teams","hooks_url":"https://api.github.com/repos/ripple/rippled/hooks","issue_events_url":"https://api.github.com/repos/ripple/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/ripple/rippled/events","assignees_url":"https://api.github.com/repos/ripple/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/ripple/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/ripple/rippled/tags","blobs_url":"https://api.github.com/repos/ripple/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ripple/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ripple/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/ripple/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/ripple/rippled/languages","stargazers_url":"https://api.github.com/repos/ripple/rippled/stargazers","contributors_url":"https://api.github.com/repos/ripple/rippled/contributors","subscribers_url":"https://api.github.com/repos/ripple/rippled/subscribers","subscription_url":"https://api.github.com/repos/ripple/rippled/subscription","commits_url":"https://api.github.com/repos/ripple/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/ripple/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/ripple/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/ripple/rippled/issues/comments/{number}","contents_url":"https://api.github.com/repos/ripple/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/ripple/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ripple/rippled/merges","archive_url":"https://api.github.com/repos/ripple/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ripple/rippled/downloads","issues_url":"https://api.github.com/repos/ripple/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/ripple/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/ripple/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/ripple/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ripple/rippled/labels{/name}","releases_url":"https://api.github.com/repos/ripple/rippled/releases{/id}","created_at":"2011-11-07T04:40:15Z","updated_at":"2014-10-01T16:43:14Z","pushed_at":"2014-10-01T22:10:52Z","git_url":"git://github.com/ripple/rippled.git","ssh_url":"git@github.com:ripple/rippled.git","clone_url":"https://github.com/ripple/rippled.git","svn_url":"https://github.com/ripple/rippled","homepage":"https://ripple.com","size":94563,"stargazers_count":851,"watchers_count":851,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":218,"mirror_url":null,"open_issues_count":135,"forks":218,"open_issues":135,"watchers":851,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/606"},"html":{"href":"https://github.com/ripple/rippled/pull/606"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/606"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/606/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/606/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/606/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/ccd44c87d2ab7dbb80bef1fd1b7d53dc229b0920"}}}}