sensor-cache: Invalidate cache when sensor disappears

When a sensor disappears from DBus, invalidate the cache.
Ideally it could be done by adding a match for interfacesRemoved
signal.
However, interfacesRemoved signal is not emitted if a service is
terminated or crashed, so we have to use nameOwnerChanged signal
as well. The `nameOwnerChanged` signal does not provide DBus object's
information, so the code needs to record the relationship between sensor
ids and the services, so that when the event occurs, it knows which
sensors should be invalidated.

Tested: Manually stop virtual-sensor, and verify the related sensors are
        shown as `na` in ipmitool sensor list:

            total_power      | na         |            | na    | na        | na        | na        | na        | na        | na

        Restart virtual-sensor, and verify the related sensors have
        valid readings:

            total_power      | 510.000    | Watts      | ok    | na        | na        | na        | na        | na        | na

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If145a1cd163477c3aca3fd17f3dbde96263f6b75
1 file changed