feat(pj_datastore): in-place dataset replace primitives (replaceDatasetFrom) for reload#112
Closed
facontidavide wants to merge 2 commits into
Closed
feat(pj_datastore): in-place dataset replace primitives (replaceDatasetFrom) for reload#112facontidavide wants to merge 2 commits into
facontidavide wants to merge 2 commits into
Conversation
….6.0) Add DataEngine::replaceDatasetFrom and ObjectStore::replaceDatasetFrom: swap a dataset's data in place while keeping its DatasetId/TopicId/ObjectTopicId stable, so a host reload can refresh data without orphaning curve keys or 2D-dock bindings. Topics are matched by name; matched topics have their chunks/entries replaced (each moved chunk's topic_id re-stamped to the primary id), staged-only topics are created/registered under the primary dataset, and primary-only topics are retired (scalars: chunks cleared + hidden from listTopics, storage kept so a cached reader pointer hits an empty deque; objects: removed). Returns the staged->primary id map so the host re-registers object parsers under stable ids. - engine: replaceDatasetFrom + retired_topic_ids (listTopics filter); factor the chunk-deque move shared with flushTo into adoptChunksFrom (re-stamps topic_id). - object_store: replaceDatasetFrom; factor find-and-erase into eraseTopicLocked. - replace_result.hpp: DatasetReplaceResult / ObjectDatasetReplaceResult. - tests: 7 new (engine + object store): chunk move/id rewrite, added/retired, id stability; entry move/id preserve, removed/added. Additive API only (pimpl, no vtable/struct changes) -> MINOR bump 0.5.1 -> 0.6.0; abi/baseline.abi unchanged (the additions live in pj_datastore, outside the pj_base ABI canary). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
@copilot fix pre-commit |
Contributor
Fixed in |
Contributor
Author
|
Superseded by the pj_datastore extraction (#113/#114). The datastore primitives in this PR were re-landed in the app repo as PlotJuggler/PJ4#124 (identical content — all 7 source/test files are byte-for-byte the same); closing as obsolete. The only parts not carried over were the SDK-local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
DataEngine::replaceDatasetFromandObjectStore::replaceDatasetFrom— primitives that swap a dataset's data in place while keeping itsDatasetId/TopicId/ObjectTopicIdstable. This lets a host (PlotJuggler 4) implement data reload as a true replace: refresh a dataset's data without orphaning anything keyed by those ids (plot curve keys, 2D object-dock bindings).What & how
DataEngine::replaceDatasetFrom(staged, staged_id, primary_id)— match staged↔primary topics by name. Matched topics: clear the primary's chunks and move the staged topic's chunks in, re-stamping eachTopicChunk.topic_idto the primary id (+ move the inline column layout). Staged-only topics: created under the primary dataset. Primary-only topics: retired — chunks cleared, id hidden fromlistTopics, but theTopicStoragekept so an in-flight reader pointer hits an empty deque rather than freed memory (the engine is append-only; this is the honest "logical removal").ObjectStore::replaceDatasetFrom(...)— same on the object side, preserving the primaryObjectTopicId; returns the staged→primary id map so the host re-registers object parsers under stable ids.DataEngine::adoptChunksFromnow single-sources the chunk-deque move shared withflushTo;ObjectStore::eraseTopicLockedis shared byremoveTopicand the replace path.replace_result.hpp:DatasetReplaceResult/ObjectDatasetReplaceResult.Tests
7 new unit tests (
engine_integration_test,object_store_test): chunk move +topic_idrewrite, added/retired topics, id stability (reader sees new data under the same id); object entry move +ObjectTopicIdpreservation, removed/added topics. All pass; the existingflushTotests confirm theadoptChunksFromunification is safe.Versioning / ABI
Additive API only (
DataEngine/ObjectStoreare pimpl; no vtable/struct/C-ABI changes) → a MINOR bump0.5.1 → 0.6.0.pj_base/abi/baseline.abiis unchanged — the additions live inpj_datastore, outside thepj_baseABI canary.Consumed by PlotJuggler/PJ4#124 (reload = in-place replace).
🤖 Generated with Claude Code