See documentation for the function
type return_type =
atomic_edit ~f filepathedit
filepathby making a unique copy (peer) that can be openly changed without holding any locks on the original. When the function returns, a short term exclusive lock is held while overwriting the original with the edited copy. If the mtime of the original is changed since the copy was made, the replacement is aborted (indicating another
atomic_editwas first to update the file, or some other process) and Changed is returned with a tuple
(warning message * terd file). The terd file contains the edits and might be used to diff or re-edit.
val atomic_edit :
f:(string -> [ `Abort | `Ok ]) -> string -> return_type