host-bmc: handle PDR repo change event from remote endpoint

When the PDR repository change event is initiated with the
event data operation as RECORDS_DELETED, we need to delete the
PDRs from the repository based on the record handles.

Change-Id: Ia484b7a0465169bc471f93bda0baa3c4b8ed5f63
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 079c6dc..de828ec 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -1228,4 +1228,17 @@
     getFRURecordTableMetadataByRemote(fruRecordSetPDRs);
 }
 
+void HostPDRHandler::deletePDRFromRepo(PDRRecordHandles&& recordHandles)
+{
+    for (auto& recordHandle : recordHandles)
+    {
+        int rc = pldm_pdr_delete_by_record_handle(repo, recordHandle, true);
+        if (rc)
+        {
+            error("Failed to delete the record handle: {REC_HANDLE}",
+                  "REC_HANDLE", recordHandle);
+        }
+    }
+}
+
 } // namespace pldm