| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
use crate::domain::{AppId, Status, Step, StepRunId, Target, Version}; |
| 6 |
use ops_core::eventbus; |
| 7 |
use serde::{Deserialize, Serialize}; |
| 8 |
|
| 9 |
pub type EventEnvelope = eventbus::EventEnvelope<Event>; |
| 10 |
pub type EventTx = eventbus::EventTx<Event>; |
| 11 |
|
| 12 |
pub fn channel() -> EventTx { |
| 13 |
eventbus::channel() |
| 14 |
} |
| 15 |
|
| 16 |
pub fn emit(tx: &EventTx, event: Event) { |
| 17 |
eventbus::emit(tx, event) |
| 18 |
} |
| 19 |
|
| 20 |
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] |
| 21 |
#[serde(tag = "kind", rename_all = "snake_case")] |
| 22 |
pub enum Event { |
| 23 |
|
| 24 |
BuildRequested { app: AppId, version: Version, targets: Vec<Target> }, |
| 25 |
|
| 26 |
|
| 27 |
TargetAborted { app: AppId, target: Target }, |
| 28 |
TargetStart { app: AppId, version: Version, target: Target }, |
| 29 |
StepStart { run_id: StepRunId, app: AppId, version: Version, target: Target, step: Step }, |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
StepLogChunk { run_id: StepRunId, seq: u32, text: String }, |
| 35 |
StepDone { run_id: StepRunId, app: AppId, target: Target, step: Step, status: Status }, |
| 36 |
TargetOk { app: AppId, version: Version, target: Target, artifacts: Vec<String> }, |
| 37 |
TargetFailed { app: AppId, version: Version, target: Target, step: Step, error: String }, |
| 38 |
|
| 39 |
NotarizeRetry { app: AppId, target: Target, attempt: u32, reason: String }, |
| 40 |
ArtifactCollected { app: AppId, target: Target, path: String, bytes: i64 }, |
| 41 |
PublishOk { app: AppId, target: Target, channel: String }, |
| 42 |
PublishFailed { app: AppId, target: Target, channel: String, error: String }, |
| 43 |
} |
| 44 |
|