1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! What a scan, an apply or a fetch did.
use crate::entry::Entry;
/// Why a path was not synced on this replica.
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum SkipReason {
/// Excluded by the built-in rule or `.sapphireignore`.
Ignored,
TooLarge {
len: u64,
max: u64,
},
/// The local OS cannot represent the path.
Unrepresentable,
/// Another path differing only in case is already on disk.
CaseCollision {
other: String,
},
Symlink,
/// Not available locally and the content source could not provide the bytes.
ContentUnavailable,
/// The local path holds something this replica has not recorded (a directory, a
/// symlink, or a file it cannot hash within the size cap), so it is left untouched.
Occupied,
/// A per-path I/O error kept this path from being reconciled; sync continues with
/// other paths. The message is the underlying error's `Display`.
Io(String),
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Skipped {
pub path: String,
pub reason: SkipReason,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Conflict {
pub path: String,
pub copy_path: String,
}
/// Why a replica refuses to scan or apply.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PauseReason {
RootMissing,
MarkerMissing,
}
/// Effects of one `scan`, `apply` or `fetch_missing` call.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Report {
/// Local writes recorded, including conflict copies.
pub recorded: Vec<Entry>,
/// Number of path-state changes committed.
pub changed: usize,
pub conflicts: Vec<Conflict>,
pub skipped: Vec<Skipped>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ScanOutcome {
Scanned(Report),
Paused(PauseReason),
}