Add simulation snapshot type hierarchy and capture skeleton - #52
Draft
klinakuf wants to merge 4 commits into
Draft
Add simulation snapshot type hierarchy and capture skeleton#52klinakuf wants to merge 4 commits into
klinakuf wants to merge 4 commits into
Conversation
Introduce the event-driven snapshot/restore contracts so extensions can participate incrementally: SimulationSnapshot hierarchy, DES coordination events, CoreSnapshotBehavior barrier, driver restore hook, and stub ResourceSimulation capture with unit tests. Co-authored-by: Cursor <[email protected]>
Collaborator
Author
|
The capture state and restore state have to be private. I think also the name for the restoration is actually initialization where we initialize the simulation state with a snapshot and it continues from there |
Make captureState/initializeState private on ResourceSimulation and rename restore terminology to initialization across events, status enum, and driver API. Co-authored-by: Cursor <[email protected]>
Collaborator
Author
|
Addressed the review comment in the latest commit:
|
Co-authored-by: Cursor <[email protected]>
|
The code lacks appropriate documentation. All code should have API Javadoc, the project should document the requirement and the ADR in mADR format in a doc folder |
Document the snapshot/initialization design in doc/decisions and doc/requirements, and add API Javadoc to all new public snapshot types, events, core orchestration, and the driver initialization overload. Co-authored-by: Cursor <[email protected]>
Collaborator
Author
|
Addressed @snowball77's documentation feedback: Architecture & requirements
API Javadoc
|
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
This PR introduces the foundational contracts for simulation snapshot and restore in Slingshot. It does not yet provide end-to-end checkpointing during a live run; instead it establishes the type hierarchy, DES events, core orchestration, and one stub extension so follow-up PRs can add real state capture without renaming the model.
Type hierarchy (
common.snapshot)SimulationSnapshot— root interface (extensionId(),schemaVersion(),isCompatibleWith())CoreSimulationSnapshot— engine state envelope (simulation time, consumed events)CompositeSimulationSnapshot— aggregate root combining core + extension-owned snapshotsSimulationContext,RestoreStatus,SnapshotScopeEach extension owns a concrete
SimulationSnapshotimplementation (no separate fragment/payload classes).Event-driven coordination (
core.events.snapshot)SimulationSnapshotRequestedExtensionSimulationSnapshotCapturedSimulationSnapshotSimulationSnapshotCompletedCompositeSimulationSnapshotSimulationStateRestoreRequestedExtensionSimulationSnapshotRestoredCore orchestration
SnapshotCapableExtension— marker for participating extensionsSnapshotContributorRegistry— tracks active snapshot contributors per runSnapshotCaptureCoordinator— collects contributor snapshots for one requestCoreSnapshotBehavior— barrier logic (init capture session, collect via@PostIntercept+@Subscribe, assemble composite)DefaultSimulationStateValidator— validates snapshot contributor set matches active extensions (schema1.xonly in this PR)SimulationDriver.init(..., Optional<CompositeSimulationSnapshot>)— optional restore path; validates before schedulingSimulationStateRestoreRequestedahead ofPreSimulationConfigurationStartedNormal runs are unchanged when
init(config, monitor)is used without a snapshot.First extension:
ResourceSimulationSnapshotCapableExtensiondirectly on the existing behavior classResourceSimulationSnapshot(schema1.0.0) — stub: active/passive/linking resource table counts only@OnEvent+@SubscribeAbstractResourceTable.size()added for stub captureTests
New bundle
org.palladiosimulator.analyzer.slingshot.core.testwith:CompositeSimulationSnapshotTestDefaultSimulationStateValidatorTestSnapshotCaptureCoordinatorTestDesign notes
schemaVersionis the per-extension snapshot layout version (not bundle/OSGi version). Restore rejects schemas outside1.xfor now.Out of scope (follow-up PRs)
requestSnapshot()API and enginepause/resumeResourceSimulationSnapshotSimulationEntityRegistryand system/usage snapshot contributorsJobProgressed) restoreSimulationJob"Restore" subtask wiringTest plan
JAVA_HOME=<jdk-17> mvn verify(Tycho requires Java 17; default JDK 23 fails withUnknown OSGi execution environment: JavaSE-23)CompositeSimulationSnapshotTest— composite assembly and typed lookupDefaultSimulationStateValidatorTest— contributor set match / mismatchSnapshotCaptureCoordinatorTest— barrier completes when all contributors presentMade with Cursor