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
66
67
|
use crate::specification::{Change, Create, FileCount};
/// A step specification in the execution of a benchmark.
#[derive(Debug)]
pub enum Step {
/// Start a benchmark.
Start(
/// Unique name of the benchmark.
String,
),
/// Finish a benchmark with a given name.
Stop(
/// Unique name of the benchmark.
String,
),
/// Create test data files.
Create(Create),
/// Rename test data files.
Rename(FileCount),
/// Delete test data files.
Delete(FileCount),
/// Make the nth backup in the benchmark.
Backup(
/// n
usize,
),
/// Restore the nth backup in the benchmark.
Restore(
/// n
usize,
),
/// Create and remember a manifest of current live data. Call it id.
ManifestLive(
/// id
usize,
),
/// Create and remember a manifest of latest restored data. Call it id.
ManifestRestored(
/// id
usize,
),
/// Compare two manifests for equality.
CompareManifests(
/// First
usize,
/// Second.
usize,
),
}
/// Possible errors from executing a benchmark step.
#[derive(Debug, thiserror::Error)]
pub enum StepError {
/// Generic I/O error.
#[error(transparent)]
Io(std::io::Error),
}
impl Step {
pub(crate) fn from(change: &Change) -> Self {
match change {
Change::Create(x) => Self::Create(x.clone()),
Change::Rename(x) => Self::Rename(x.clone()),
Change::Delete(x) => Self::Delete(x.clone()),
}
}
}
|