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

Method clearDatasetChunks

pj_datastore/src/engine.cpp:374–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372}
373
374void DataEngine::clearDatasetChunks(DatasetId dataset_id) {
375 // Like retireTopic, reclaim each topic's materialized chunks — but WITHOUT
376 // adding the ids to retired_topic_ids, so they stay in listTopics() and a refill
377 // writes back into them. For each live topic, clearChunks() empties the deque and
378 // resets the eviction floor + cached min/max + row count, so a DataReader reports
379 // an empty range immediately. Unknown dataset_id -> no-op; clearing an empty topic
380 // is a no-op (idempotent).
381 //
382 // clearChunks() FREES the deque, so hold the engine lock across the whole sweep
383 // (chunk-freeing mutation: GUI-thread-only, callers drop cached TopicChunk* first
384 // — same contract as retireTopic/enforceRetention).
385 auto lock = lockEngine();
386 for (const TopicId topic_id : listTopicsLocked(dataset_id)) {
387 if (TopicStorage* storage = getTopicStorage(topic_id)) {
388 storage->clearChunks();
389 }
390 }
391}
392
393DataEngine::DatasetChunkSnapshot DataEngine::detachDatasetChunks(DatasetId dataset_id) {
394 auto lock = lockEngine();

Callers 1

TESTFunction · 0.80

Calls 1

clearChunksMethod · 0.80

Tested by 1

TESTFunction · 0.64