Skip to content

Refactoring: Track filestates directly within Writable objects - #1937

Open
franzpoeschel wants to merge 6 commits into
openPMD:devfrom
franzpoeschel:track-filestate-in-writable
Open

Refactoring: Track filestates directly within Writable objects#1937
franzpoeschel wants to merge 6 commits into
openPMD:devfrom
franzpoeschel:track-filestate-in-writable

Conversation

@franzpoeschel

@franzpoeschel franzpoeschel commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Move file state tracking from backend-specific maps (m_files, m_fileData, m_jsonVals) directly into the Writable object via writable->fileState.

Summary

This refactoring moves file state management from scattered backend-specific data structures into a centralized location within Writable. The InvalidatableFile wrapper class is replaced by internal::FileState struct, with backend-specific state stored in std::any backendSpecificState.

Changes

Core Changes

  • InvalidatableFile class replaced by internal::FileState struct
  • File state moved from backend-specific maps to Writable::fileState
  • Common IO operations centralized in AbstractIOHandlerImplCommon
  • ADIOS2 and JSON backends updated to use new file state tracking pattern
  • HDF5 still uses its own structures and ignores the Writable filestate, can be done at a later point

Behavioral Changes

  • ADIOS2 createFile file existence check: Now uses auxiliary::file_exists() to detect files on disk (previously only checked for files opened in current session)
  • deregister is now a no-op: File cleanup is handled by FileState destructor pattern
  • ADIOS2 closeFile: Marks backendSpecificState as nullopt instead of erasing from m_files

ADIOS2 implementation

JSON implementation

Use AbstractIOHandlerImplCommon there now too

Some bug fixes after recent PRs

Remove useless check in touch() task

Fixes after rebase (not yet complete)
@franzpoeschel franzpoeschel changed the title Refactoring: Tracke filestates directly within Writable objects Refactoring: Track filestates directly within Writable objects Sep 8, 2026
franzpoeschel and others added 4 commits September 8, 2026 14:54
Add null check for search->parent in second while loop to prevent
dereferencing null when traversing parent chain without finding a
valid fileState.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant