mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-04 12:13:09 +00:00
createFileNoReplace and publishCanonicalContent carried the same open-wx / fchmod / write / fsync / close block and the same cleanup handler. Extract writeDurableTempFile and discardTempFile so each publisher is left with only what distinguishes it: a no-replace link, or the compare-and-swap guard and the rename. Also spell out in publishCanonicalContent that its guard is read-then-act rather than atomic. POSIX has no compare-and-swap rename, so the window is narrowed from the ~100 ms the old claim-and-republish path left open to two adjacent syscalls, not closed - and the pre-image sidecar is what keeps that last outcome recoverable. Worth stating so the guard is not mistaken for a strict guarantee later. Built [OnSteroids](https://onsteroids.ai)