Publishes tmp_dir as final_dir so readers never observe a half-written directory.
A single os.replace() is atomic on both platforms only when final_dir
does not yet exist; a directory can’t be atomically “merged” or overwritten
in place. When final_dir already holds a previous run’s output, it is
first renamed aside (a second atomic op) and removed only after the new
content is in place – never merged, so orphaned files from a previous run
(which DoxygenXmlParser.parse()’s directory-scan fallback could otherwise
pick up) cannot survive a publish.
Methods
publish_atomically
publish_atomically(tmp_dir: Union, final_dir: Union)
Publishes tmp_dir as final_dir so readers never observe a half-written directory.
A single os.replace() is atomic on both platforms only when final_dir
does not yet exist; a directory can’t be atomically “merged” or overwritten
in place. When final_dir already holds a previous run’s output, it is
first renamed aside (a second atomic op) and removed only after the new
content is in place – never merged, so orphaned files from a previous run
(which DoxygenXmlParser.parse()’s directory-scan fallback could otherwise
pick up) cannot survive a publish.
| Parameter | Type | Description |
|---|---|---|
| tmp_dir | Union | Scratch directory a single collect() call wrote into. |
| final_dir | Union | The persistent, shared cache directory for this project_key. |