MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / append_line

Method append_line

src/storage.rs:473–481  ·  view source on GitHub ↗

Appends one line via a single `O_APPEND` write so concurrent hook processes never interleave partial lines or lose each other's entries the way read-modify-rewrite appends do.

(path: &Path, line: &str)

Source from the content-addressed store, hash-verified

471 /// processes never interleave partial lines or lose each other's entries
472 /// the way read-modify-rewrite appends do.
473 pub fn append_line(path: &Path, line: &str) -> io::Result<()> {
474 if let Some(parent) = path.parent() {
475 Self::create_dir_all(parent)?;
476 }
477 reject_symlink_components(path, "private store file")?;
478 Self::open_private(path, fs::OpenOptions::new().append(true))?
479 .write_all(format!("{line}\n").as_bytes())?;
480 set_private_file_permissions(path)
481 }
482
483 /// Opens `path` for writing, creating it if missing with owner-only
484 /// permissions applied at create time (Unix), so a fresh file never

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected