pub enum Effect {
PathCreate {
path: PathBuf,
},
File {
path: PathBuf,
prev_blob: String,
meta: Meta,
},
Symlink {
path: PathBuf,
target: PathBuf,
},
Dir {
path: PathBuf,
mode: u32,
entries: Vec<String>,
},
HttpMutation {
method: String,
url: String,
compensator: Option<HttpCompensator>,
},
Exec {
command: String,
cwd: PathBuf,
},
}Expand description
A reversible (or at least auditable) side effect.
The Path* / File / Symlink / Dir variants are fully reversible.
HttpMutation and Exec are recorded for audit and carry the shape needed
to reverse them later, but are not auto-reversed yet.
Variants§
PathCreate
A path that did not exist when we captured it. Inverse: delete whatever is now there (file, symlink, or whole directory tree).
File
A regular file whose prior contents + metadata were captured. Inverse: restore the contents and re-apply mode/mtime.
Symlink
A symlink that existed at capture time. Inverse: recreate it pointing at
target (we snapshot the link itself, never the file it points to).
Dir
A directory that existed at capture time, plus the names of its immediate children. Inverse: ensure the directory exists with its mode, and prune any children the agent added that weren’t here originally.
HttpMutation
A network mutation (POST/PUT/PATCH/DELETE). The compensator is the
request that reverses it (e.g. a DELETE to undo a POST). Recorded only.
Exec
A shell command. Audit-only; arbitrary commands have no general inverse.