Class FileSystemPipelineStateStore
java.lang.Object
com.tnsai.quality.security.harness.FileSystemPipelineStateStore
- All Implemented Interfaces:
PipelineStateStore
Disk-backed
PipelineStateStore (TNS-291 phase 2).
Lays out state as:
<baseDir>/<projectId>/ ├── project.json ├── files/<path-hash>.json # one FileRecord per source file ├── runs/<run-id>.json # one entry per stage execution └── reports/<name> # exporter outputs
Idempotency / crash-safety:
- Writes go to
<target>.tmpthenFiles.move(ATOMIC_MOVE)— a partially written file never replaces a good one. - Per-path
ReentrantLockserialises concurrent writers for the sameFileRecord(run-log writes hold a single store-wide lock). - The file name is the SHA-256 of the relative path; same path = same file regardless of OS-specific encoding quirks.
- Since:
- 0.10.0 (TNS-291)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.quality.security.harness.PipelineStateStore
PipelineStateStore.RunMetadata -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend a stage-execution entry to the run log.Look up a record by its relative path.voidinitProject(String projectId, Path projectRoot) Initialise (or open) project state underprojectId.All records currently stored for the project, in deterministic order.All run-log entries forstage, oldest first.Visible for tests — points at this store's project directory.voidsaveFile(FileRecord record) Persist aFileRecordfor the file atrecord.path().voidwriteReport(String name, byte[] content) Write a binary report (findings.sarif,findings.md, …) underreports/.
-
Constructor Details
-
FileSystemPipelineStateStore
- Parameters:
baseDir- directory under which<projectId>/...layouts are created. Created lazily oninitProject(java.lang.String, java.nio.file.Path).
-
-
Method Details
-
initProject
Description copied from interface:PipelineStateStoreInitialise (or open) project state underprojectId. Creates the disk layout if missing; idempotent.- Specified by:
initProjectin interfacePipelineStateStore
-
saveFile
Description copied from interface:PipelineStateStorePersist aFileRecordfor the file atrecord.path(). Subsequent reads return this record until the next write.- Specified by:
saveFilein interfacePipelineStateStore
-
getFile
Description copied from interface:PipelineStateStoreLook up a record by its relative path.- Specified by:
getFilein interfacePipelineStateStore
-
listFiles
Description copied from interface:PipelineStateStoreAll records currently stored for the project, in deterministic order.- Specified by:
listFilesin interfacePipelineStateStore
-
appendRun
Description copied from interface:PipelineStateStoreAppend a stage-execution entry to the run log. Used by stages to record theirStageResultfor thereportstage.- Specified by:
appendRunin interfacePipelineStateStore
-
listRuns
Description copied from interface:PipelineStateStoreAll run-log entries forstage, oldest first.- Specified by:
listRunsin interfacePipelineStateStore
-
writeReport
Description copied from interface:PipelineStateStoreWrite a binary report (findings.sarif,findings.md, …) underreports/. Overwrites any existing file with the same name.- Specified by:
writeReportin interfacePipelineStateStore
-
projectDir
Visible for tests — points at this store's project directory.
-