Add xyz.openbmc_project.ObjectMapper.Private

The mapper client bindings currently use the NameOwnerChanged
signal as a trigger for a mapper query when waiting for an
object to appear on the bus.  This works because at the moment
the mapper returns a busy response to clients in the window
between NameOwnerChanged and completion of its discovery.

A forthcoming patch will change this behavior such that the
mapper will go ahead and respond in the window to improve
overall mapper responsiveness, at the cost of the current
causal ordering guarantee.

The ordering guarantee is what allows the current wait binding
implementation to work.  Without it, the wait binding requires
a means to determine when it is safe to make a make a query.

Add a new mapper interface xyz.openbmc_project.ObjectMapper.Private
with a single signal IntrospectionComplete to meet this
requirement.  "Private" because the signal should only be
consumed by the mapper client bindings.

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: Ia7b65cd7edd37c49fa7b5ad808b0c59304c68717
diff --git a/obmc/mapper/utils.py b/obmc/mapper/utils.py
index 706cc61..3937cf6 100644
--- a/obmc/mapper/utils.py
+++ b/obmc/mapper/utils.py
@@ -40,16 +40,14 @@
         self.waitlist_keyword = kw.pop('waitlist_keyword', None)
 
         self.bus.add_signal_receiver(
-            self.name_owner_changed_handler,
-            dbus_interface=dbus.BUS_DAEMON_IFACE,
-            signal_name='NameOwnerChanged')
+            self.introspection_handler,
+            dbus_interface=obmc.mapper.MAPPER_IFACE + '.Private',
+            signal_name='IntrospectionComplete')
         self.bus.add_signal_receiver(
-            self.interfaces_added_handler,
-            dbus_interface=dbus.BUS_DAEMON_IFACE + '.ObjectManager',
-            sender_keyword='sender',
-            signal_name='InterfacesAdded')
+            self.introspection_handler,
+            dbus_interface=dbus.BUS_DAEMON_IFACE + '.ObjectManager')
 
-        self.name_owner_changed_handler()
+        self.introspection_handler()
 
     @staticmethod
     def default_error(e):
@@ -61,11 +59,11 @@
 
         self.done = True
         self.bus.remove_signal_receiver(
-            self.name_owner_changed_handler,
-            dbus_interface=dbus.BUS_DAEMON_IFACE,
-            signal_name='NameOwnerChanged')
+            self.introspection_handler,
+            dbus_interface=obmc.mapper.MAPPER_IFACE + '.Private',
+            signal_name='IntrospectionComplete')
         self.bus.remove_signal_receiver(
-            self.interfaces_added_handler,
+            self.introspection_handler,
             dbus_interface=dbus.BUS_DAEMON_IFACE + '.ObjectManager',
             signal_name='InterfacesAdded')
 
@@ -119,18 +117,10 @@
         self.waitlist[path] = list(info)[0]
         self.check_done()
 
-    def name_owner_changed_handler(self, *a, **kw):
+    def introspection_handler(self, *a, **kw):
         if self.done:
             return
 
         for path in filter(
                 lambda x: not self.waitlist[x], self.waitlist.keys()):
             self.get_object_async(path, 0)
-
-    def interfaces_added_handler(self, path, *a, **kw):
-        if self.done:
-            return
-
-        if path in self.waitlist.keys():
-            self.waitlist[path] = kw['sender']
-        self.check_done()