file_engine/planner/outcome.rs
1use std::path::PathBuf;
2
3use crate::error::Error;
4use crate::profiler::Entry;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum StopReason {
8 Fatal,
9 AbortOnError,
10 Cancelled,
11 Undo,
12}
13
14/// Aggregate result of running an `ExecutionPlan`. Replaces a bare
15/// `Result<(), Error>` because `ErrorStrategy::ContinueAndCollect` can
16/// finish with a mix of successes and failures that a single `Result`
17/// can't represent. See dev-docs/design/batching-engine.md, "outcome.rs".
18#[derive(Debug, Default)]
19pub struct OperationOutcome {
20 pub succeeded: Vec<Entry>,
21 pub failed: Vec<(Entry, Error)>,
22 /// Populated only by move's deferred deletion sweep: entries that
23 /// copied successfully but whose original source could not be
24 /// removed afterward (data duplicated, not lost). Copy never
25 /// populates this field.
26 pub cleanup_failed: Vec<(Entry, Error)>,
27 pub stopped_early: Option<StopReason>,
28 /// Populated only by the directory-permissions pass (`.preserve_permissions()`,
29 /// see dev-docs/design/permissions.md), which always runs to completion
30 /// regardless of individual failures and never affects
31 /// `stopped_early` — a directory `chmod` failure is a best-effort
32 /// finishing touch, not an interruption of the actual data transfer.
33 /// Unconditional (not `#[cfg(unix)]`-gated), same reasoning as
34 /// `Entry.mode`: avoids a platform-conditional shape for a type with
35 /// many existing construction sites. Always empty on non-Unix or
36 /// when permission preservation wasn't requested.
37 pub directories_failed: Vec<(PathBuf, Error)>,
38}