| 288 | // --- RefillGuard: the transactional in-place reload (see SessionManager::beginRefill). --- |
| 289 | |
| 290 | RefillGuard::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 | |
| 310 | RefillGuard::RefillGuard(RefillGuard&& other) noexcept |
| 311 | : session_(other.session_), |
nothing calls this directly
no test coverage detected