summaryrefslogtreecommitdiff
path: root/redfish-core/lib/power.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-11-13 02:17:05 +0300
committerEd Tanous <ed.tanous@intel.com>2018-11-26 20:08:11 +0300
commit0f74e643ec246c333ef4724af1ecd5adeb1b6658 (patch)
tree37547678cbfd59f8eb67658c87b350073d0e9139 /redfish-core/lib/power.hpp
parent244365165adba1bc6b96aebbd7d305b055f379b1 (diff)
downloadbmcweb-0f74e643ec246c333ef4724af1ecd5adeb1b6658.tar.xz
bmcweb: Redfish away from json cache
In the original incarnation of bmcweb, route registration was done automatically. This has proved to be a terrible idea, wraught with corner cases and issues. The route registration is currently the only user of the redfish::Node::json element. Unfortunately, as written, this structure consumes a lot of memory that's duplicated and not very useful. From a performance perspective, there is almost no difference between rebuilding the structure for each GET request, and having the "cache" that needs to be copied into the response and modified before it can be useful. In the programming tradeoffs for bmc, lower memory usage is more important than latency, especially at these levels. Change-Id: I785e8352123e5e886acf05cd59cb23648f93839d Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'redfish-core/lib/power.hpp')
-rw-r--r--redfish-core/lib/power.hpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index dc291f113c..0cb1aa0c59 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -28,11 +28,6 @@ class Power : public Node
Power(CrowApp& app) :
Node((app), "/redfish/v1/Chassis/<str>/Power/", std::string())
{
- Node::json["@odata.type"] = "#Power.v1_2_1.Power";
- Node::json["@odata.context"] = "/redfish/v1/$metadata#Power.Power";
- Node::json["Id"] = "Power";
- Node::json["Name"] = "Power";
-
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
{boost::beast::http::verb::head, {{"Login"}}},
@@ -54,9 +49,12 @@ class Power : public Node
}
const std::string& chassis_name = params[0];
- Node::json["@odata.id"] =
+ res.jsonValue["@odata.id"] =
"/redfish/v1/Chassis/" + chassis_name + "/Power";
- res.jsonValue = Node::json;
+ res.jsonValue["@odata.type"] = "#Power.v1_2_1.Power";
+ res.jsonValue["@odata.context"] = "/redfish/v1/$metadata#Power.Power";
+ res.jsonValue["Id"] = "Power";
+ res.jsonValue["Name"] = "Power";
auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
res, chassis_name,
std::initializer_list<const char*>{