Use atomic discards for the operational DS
Port away from sysrepo::Connection::discardOperationalChanges() because
sysrepo now supports discarding via the usual sr_edit_batch(), yay.
The actual changes are slightly different, some high-level leaf-list
instances for example are apparently not reported.
Change-Id: I3c4f7e5aabe65c52f557c4cd060e0a6fbc316e16
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/dependencies/+/6243
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/sysrepo-ietf-alarms/+/6248
diff --git a/src/ietf-hardware/sysrepo/Sysrepo.cpp b/src/ietf-hardware/sysrepo/Sysrepo.cpp
index 444a714..b06a72e 100644
--- a/src/ietf-hardware/sysrepo/Sysrepo.cpp
+++ b/src/ietf-hardware/sysrepo/Sysrepo.cpp
@@ -60,11 +60,11 @@
}
}
- for (const auto& component : deletedComponents) {
- conn.discardOperationalChanges(component);
- }
+ std::vector<std::string> discards;
+ discards.reserve(deletedComponents.size());
+ std::copy(deletedComponents.begin(), deletedComponents.end(), std::back_inserter(discards));
- utils::valuesPush(hwStateValues, {}, m_session, ::sysrepo::Datastore::Operational);
+ utils::valuesPush(hwStateValues, {}, discards, m_session, ::sysrepo::Datastore::Operational);
prevValues = std::move(hwStateValues);
std::this_thread::sleep_for(m_pollInterval);