Documentation
¶
Overview ¶
Package writes is the one way Jade changes a file in the workspace (release plan 0.0.7, "One write path"). A write is atomic — a reader or a crash never sees half a file — and a change to several files lands in all of them or in none.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Digest ¶
Digest names a file's contents: 12 hex characters of its SHA-256. Reads return it, and edits accept it as a precondition that sees every change to the file, not only Jade's.
func File ¶
File writes data to path atomically: a temporary file beside it, then a rename. An existing file keeps its permissions, and a symlink is followed, so the link stays a link and its target changes.
func Files ¶
Files writes every change or none. What each path held is read first; if any write fails, the files already written are put back — a created file removed — and the error says which write failed and whether the restore held. A rename across four files that lands in three compiles nowhere.
func Observe ¶
Observe registers fn to be told the path of every write or removal under root before it happens. The workspace uses it to record what a file held before the first change since a checkpoint, which no caller could otherwise supply. Several may observe one root: two sessions on one workspace each keep their own checkpoints. A single observer per root let the second session silently replace the first's.