MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EnqueueConfigObject

Method EnqueueConfigObject

lib/icingadb/icingadb-worker.cpp:245–268  ·  view source on GitHub ↗

* Enqueue a configuration object for processing in the pending objects thread. * * @param object The configuration object to be enqueued for processing. * @param bits The dirty bits indicating the type of changes to be processed for the object. */

Source from the content-addressed store, hash-verified

243 * @param bits The dirty bits indicating the type of changes to be processed for the object.
244 */
245void IcingaDB::EnqueueConfigObject(const ConfigObject::Ptr& object, uint32_t bits)
246{
247 namespace queue = icingadb::task_queue;
248
249 if (!GetActive() || !m_RconWorker || !m_RconWorker->IsConnected()) {
250 return; // No need to enqueue anything if we're not connected.
251 }
252
253 {
254 std::lock_guard lock(m_PendingItemsMutex);
255 if (auto [it, inserted] = m_PendingItems.emplace(queue::PendingConfigItem{object, bits}); !inserted) {
256 m_PendingItems.modify(it, [bits](queue::PendingQueueItem& item) {
257 auto& configItem = std::get<queue::PendingConfigItem>(item.Item);
258 if (bits & queue::ConfigDelete) {
259 configItem.DirtyBits &= ~(queue::ConfigUpdate | queue::FullState);
260 } else if (bits & queue::ConfigUpdate) {
261 configItem.DirtyBits &= ~queue::ConfigDelete;
262 }
263 configItem.DirtyBits |= bits & queue::DirtyBitsAll;
264 });
265 }
266 }
267 m_PendingItemsCV.notify_one();
268}
269
270void IcingaDB::EnqueueDependencyGroupStateUpdate(const DependencyGroup::Ptr& depGroup)
271{

Calls 2

IsConnectedMethod · 0.80
emplaceMethod · 0.80

Tested by

no test coverage detected