summaryrefslogtreecommitdiff
path: root/redfish-core/lib/chassis.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/chassis.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/chassis.hpp')
-rw-r--r--redfish-core/lib/chassis.hpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index cec62d5854..0f2b92b055 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -45,12 +45,6 @@ class ChassisCollection : public Node
public:
ChassisCollection(CrowApp &app) : Node(app, "/redfish/v1/Chassis/")
{
- Node::json["@odata.type"] = "#ChassisCollection.ChassisCollection";
- Node::json["@odata.id"] = "/redfish/v1/Chassis";
- Node::json["@odata.context"] =
- "/redfish/v1/$metadata#ChassisCollection.ChassisCollection";
- Node::json["Name"] = "Chassis Collection";
-
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
{boost::beast::http::verb::head, {{"Login"}}},
@@ -73,7 +67,12 @@ class ChassisCollection : public Node
"xyz.openbmc_project.Inventory.Item.PowerSupply",
"xyz.openbmc_project.Inventory.Item.System",
};
- res.jsonValue = Node::json;
+ res.jsonValue["@odata.type"] = "#ChassisCollection.ChassisCollection";
+ res.jsonValue["@odata.id"] = "/redfish/v1/Chassis";
+ res.jsonValue["@odata.context"] =
+ "/redfish/v1/$metadata#ChassisCollection.ChassisCollection";
+ res.jsonValue["Name"] = "Chassis Collection";
+
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
@@ -118,13 +117,6 @@ class Chassis : public Node
Chassis(CrowApp &app) :
Node(app, "/redfish/v1/Chassis/<str>/", std::string())
{
- Node::json["@odata.type"] = "#Chassis.v1_4_0.Chassis";
- Node::json["@odata.id"] = "/redfish/v1/Chassis";
- Node::json["@odata.context"] = "/redfish/v1/$metadata#Chassis.Chassis";
- Node::json["Name"] = "Chassis Collection";
- Node::json["ChassisType"] = "RackMount";
- Node::json["PowerState"] = "On";
-
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
{boost::beast::http::verb::head, {{"Login"}}},
@@ -150,7 +142,14 @@ class Chassis : public Node
return;
}
- res.jsonValue = Node::json;
+ res.jsonValue["@odata.type"] = "#Chassis.v1_4_0.Chassis";
+ res.jsonValue["@odata.id"] = "/redfish/v1/Chassis";
+ res.jsonValue["@odata.context"] =
+ "/redfish/v1/$metadata#Chassis.Chassis";
+ res.jsonValue["Name"] = "Chassis Collection";
+ res.jsonValue["ChassisType"] = "RackMount";
+ res.jsonValue["PowerState"] = "On";
+
const std::string &chassisId = params[0];
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(