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

Method commitChunksLocked

pj_datastore/src/engine.cpp:286–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286std::vector<TopicId> DataEngine::commitChunksLocked(
287 std::vector<std::pair<TopicId, TopicChunk>> chunks) { // NOLINT(performance-unnecessary-value-param)
288 std::vector<TopicId> changed;
289 for (auto& [topic_id, chunk] : chunks) {
290 auto* storage = getTopicStorage(topic_id);
291 if (storage != nullptr) {
292 auto status = storage->appendSealedChunk(std::move(chunk));
293 if (!status.has_value()) {
294 continue; // chunk rejected (e.g. out-of-order); do not mark topic as changed
295 }
296 // A topic that receives real data is no longer "absent": un-retire it so a
297 // recomputed filter output (retired by a reload's replaceDatasetFrom) reappears in
298 // listTopics()/the catalog once its fresh chunks land. Mirrors the un-retire-on-
299 // readopt at replaceDatasetFrom.
300 impl_->retired_topic_ids.erase(topic_id);
301 if (changed.empty() || changed.back() != topic_id) {
302 changed.push_back(topic_id);
303 }
304 }
305 }
306 // Deduplicate (flushAll() may emit multiple chunks for one topic).
307 std::sort(changed.begin(), changed.end());
308 changed.erase(std::unique(changed.begin(), changed.end()), changed.end());
309 return changed;
310}
311
312void DataEngine::enforceRetention(Timestamp retention_window_ns) {
313 std::unique_lock<std::recursive_mutex> lock(impl_->mutex_);

Callers 2

runSisoIncrementalFunction · 0.80
runMimoIncrementalFunction · 0.80

Calls 5

appendSealedChunkMethod · 0.80
eraseMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected