-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathevent.rs
More file actions
72 lines (60 loc) · 1.66 KB
/
event.rs
File metadata and controls
72 lines (60 loc) · 1.66 KB
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
68
69
70
71
72
use std::time::Duration;
use bstr::BString;
// Re-export ExecutionItemDisplay from vite_task_plan since it's the canonical definition
pub use vite_task_plan::ExecutionItemDisplay;
use super::cache::CacheMiss;
#[derive(Debug)]
pub enum OutputKind {
Stdout,
Stderr,
}
#[derive(Debug)]
pub enum CacheDisabledReason {
InProcessExecution,
NoCacheMetadata,
CycleDetected,
}
#[derive(Debug)]
pub enum CacheNotUpdatedReason {
/// Cache was hit - task was replayed from cache, no update needed
CacheHit,
/// Caching was disabled for this task
CacheDisabled,
/// Execution exited with non-zero status
NonZeroExitStatus,
}
#[derive(Debug)]
pub enum CacheUpdateStatus {
/// Cache was successfully updated with new fingerprint and outputs
Updated,
/// Cache was not updated (with reason)
NotUpdated(CacheNotUpdatedReason),
}
#[derive(Debug)]
pub enum CacheStatus {
Disabled(CacheDisabledReason),
Miss(CacheMiss),
Hit { replayed_duration: Duration },
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExecutionId(u32);
impl ExecutionId {
pub(crate) fn zero() -> Self {
Self(0)
}
pub(crate) fn next(&self) -> Self {
Self(self.0.checked_add(1).expect("ExecutionId overflow"))
}
}
#[derive(Debug)]
pub struct ExecutionEvent {
pub execution_id: ExecutionId,
pub kind: ExecutionEventKind,
}
#[derive(Debug)]
pub enum ExecutionEventKind {
Start { display: Option<ExecutionItemDisplay>, cache_status: CacheStatus },
Output { kind: OutputKind, content: BString },
Error { message: String },
Finish { status: Option<i32>, cache_update_status: CacheUpdateStatus },
}