control: `nameOwnerChanged` signals update all caches

When a `nameOwnerChanged` signal is received, update all entries within
the service tree cache for the given service's owner state change. Also,
use the service tree cache to cross reference removal of the associated
interfaces from objects within the objects cache.

Change-Id: Idab52a7533d626f1f7ef03397f904a74cb6457a3
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/triggers/handlers.hpp b/control/json/triggers/handlers.hpp
index f4e7adb..15bced0 100644
--- a/control/json/triggers/handlers.hpp
+++ b/control/json/triggers/handlers.hpp
@@ -1,6 +1,9 @@
 #pragma once
 
 #include "../manager.hpp"
+#include "../utils/flight_recorder.hpp"
+
+#include <fmt/format.h>
 
 #include <sdbusplus/message.hpp>
 
@@ -127,13 +130,12 @@
 
     /**
      * @brief Processes a name owner changed signal and updates the service's
-     * owner state
+     * owner state for all objects/interfaces associated in the cache
      *
      * @param[in] msg - The sdbusplus signal message
-     * @param[in] obj - Object data associated with the signal
      * @param[in] mgr - Manager that stores the service's owner state
      */
-    static bool nameOwnerChanged(message& msg, const SignalObject& obj,
+    static bool nameOwnerChanged(message& msg, const SignalObject&,
                                  Manager& mgr)
     {
         bool hasOwner = false;
@@ -150,8 +152,10 @@
         {
             hasOwner = true;
         }
-
-        mgr.setOwner(std::get<Path>(obj), serv, std::get<Intf>(obj), hasOwner);
+        FlightRecorder::instance().log(
+            "nameOwnerChanged", fmt::format("Service: {}, Owned: {}", serv,
+                                            hasOwner ? "true" : "false"));
+        mgr.setOwner(serv, hasOwner);
         return true;
     }