pub struct FileWriteParams {
pub path: PathBuf,
pub content: String,
pub create_dirs: bool,
pub append: bool,
}Expand description
file_write parameters (TC22 A3).
Writes content to path as a single UTF-8 regular file. The daemon
canonicalizes the PARENT directory (the target file need not exist
yet), policy-gates the canonical target against paths.write_allow,
audits BEFORE the write, bounds content to MAX_FILE_WRITE_BYTES,
and writes ATOMICALLY (temp file in the same dir + rename) so a partial
or torn write can never be observed.
Fields§
§path: PathBufAbsolute path to the target file. Absolute is required: the daemon has no workspace root, so a relative path is rejected rather than resolved against the daemon’s working directory.
content: StringUTF-8 content to write. Bounded by MAX_FILE_WRITE_BYTES; an
oversize payload is rejected before any filesystem touch.
create_dirs: boolCreate missing parent directories WITHIN an allowed path. The
parent must still pass policy: create_dirs never widens the
allow-list, it only saves a separate mkdir for a path the policy
already permits. Defaults to false.
append: boolAppend content to the target instead of replacing it. Same policy
gate (FileWrite), same MAX_FILE_WRITE_BYTES cap per call, same
missing-file creation semantics. Defaults to false (full replace).
Integrity (honest): the original content is never modified and racing appends never interleave (OS append-mode offset atomicity). All-or- nothing is NOT promised: a mid-write I/O failure can leave a partial append and surfaces as an error.
Trait Implementations§
Source§impl Clone for FileWriteParams
impl Clone for FileWriteParams
Source§fn clone(&self) -> FileWriteParams
fn clone(&self) -> FileWriteParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more