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

Method RefillGuard

pj_runtime/src/SessionManager.cpp:290–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288// --- RefillGuard: the transactional in-place reload (see SessionManager::beginRefill). ---
289
290RefillGuard::RefillGuard(SessionManager& session, DatasetId dataset_id) : session_(&session), dataset_id_(dataset_id) {
291 // GUI thread, no event loop — same contract as replaceDataset.
292 Q_ASSERT(session.thread() == QThread::currentThread());
293
294 // Capture the prior topic id sets BEFORE detaching: scalars for the empty-state
295 // notify, object ids so rollback can tell which object topics a failed refill added.
296 const std::vector<TopicId> scalar_topics = session.dataEngine().listTopics(dataset_id);
297 prior_object_topic_ids_ = session.objectStore().listTopics(dataset_id);
298
299 // (1) Adapters drop cached TopicChunk* before any deque is moved (same ordering
300 // as replaceDataset).
301 session.notifyDatasetAboutToBeReplaced(dataset_id);
302 // (2) scalar + (3) object: DETACH (move aside, not free), keeping ids registered
303 // so the progressive refill writes back into the same ids.
304 scalar_snapshot_ = session.dataEngine().detachDatasetChunks(dataset_id);
305 object_snapshot_ = session.objectStore().detachDataset(dataset_id);
306 // (4) UI sees the dataset empty (non-live). no-ops on an empty id list.
307 session.notifyIngest(QVector<TopicId>(scalar_topics.begin(), scalar_topics.end()), /*live=*/false);
308}
309
310RefillGuard::RefillGuard(RefillGuard&& other) noexcept
311 : session_(other.session_),

Callers

nothing calls this directly

Calls 8

objectStoreMethod · 0.80
detachDatasetChunksMethod · 0.80
detachDatasetMethod · 0.80
notifyIngestMethod · 0.80
listTopicsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected