MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / pruneVanishedTopics

Method pruneVanishedTopics

pj_runtime/src/SessionManager.cpp:351–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void RefillGuard::pruneVanishedTopics() {
352 if (session_ == nullptr) {
353 return;
354 }
355 // Scalar: a prior topic still empty after the refill vanished from the new file.
356 // Collect under one engine lock (getTopicStorage needs it held), then retire —
357 // retireTopic re-locks (recursive mutex) and clears its already-empty deque.
358 std::vector<TopicId> vanished_scalar;
359 {
360 auto lock = session_->dataEngine().lockEngine();
361 for (const TopicId topic_id : scalar_snapshot_.prior_topic_ids) {
362 const TopicStorage* storage = session_->dataEngine().getTopicStorage(topic_id);
363 if (storage != nullptr && storage->empty()) {
364 vanished_scalar.push_back(topic_id);
365 }
366 }
367 }
368 for (const TopicId topic_id : vanished_scalar) {
369 session_->dataEngine().retireTopic(topic_id);
370 }
371 // Object: a prior object topic with no entries after the refill vanished too.
372 std::vector<ObjectTopicId> vanished_object;
373 for (const ObjectTopicId object_topic_id : prior_object_topic_ids_) {
374 if (session_->objectStore().entryCount(object_topic_id) == 0) {
375 vanished_object.push_back(object_topic_id);
376 }
377 }
378 if (!vanished_object.empty()) {
379 session_->evictObjectTopics(vanished_object); // drops the empty store series + its parser slot
380 }
381}
382
383void RefillGuard::rollback() {
384 // (a) Adapters drop any partial-refill chunk pointers cached via progress notifies.

Callers 2

TESTFunction · 0.80
onWorkerFinishedMethod · 0.80

Calls 7

lockEngineMethod · 0.80
getTopicStorageMethod · 0.80
retireTopicMethod · 0.80
entryCountMethod · 0.80
objectStoreMethod · 0.80
evictObjectTopicsMethod · 0.80
emptyMethod · 0.45

Tested by 1

TESTFunction · 0.64