| e0918b88 Andy McCall |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
use crate::pipeline::{Job, Sandbox}; |
| 5 |
use crate::receipt::Receipt; |
| 6 |
use serde::{Deserialize, Serialize}; |
| 7 |
|
| 8 |
|
| 9 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 10 |
pub struct ClaimRequest { |
| 11 |
|
| 12 |
pub runner: String, |
| 13 |
|
| 14 |
pub runtimes: Vec<String>, |
| bb643c25 Andy McCall ↶ |
15 |
|
| 16 |
|
| 17 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 18 |
pub free_memory_mib: Option<u32>, |
| 19 |
|
| 20 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 21 |
pub free_cpus: Option<u32>, |
| e0918b88 Andy McCall |
22 |
} |
| 23 |
|
| 24 |
|
| 25 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 26 |
pub struct Claim { |
| 27 |
pub job_id: i64, |
| 28 |
pub run_id: i64, |
| 29 |
|
| 30 |
pub repo: String, |
| 31 |
|
| 32 |
pub clone_url: String, |
| 33 |
|
| 34 |
pub token: String, |
| 35 |
|
| 36 |
pub heads: Vec<String>, |
| 37 |
|
| 38 |
pub pipeline_hash: String, |
| 39 |
pub job: Job, |
| 40 |
pub sandbox: Sandbox, |
| 41 |
|
| 42 |
pub timeout_s: u64, |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 47 |
pub struct Record { |
| 48 |
|
| 49 |
pub t: u64, |
| 50 |
|
| 51 |
pub stream: String, |
| 52 |
pub text: String, |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] |
| 57 |
pub struct LogBatch { |
| 58 |
pub records: Vec<Record>, |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] |
| 63 |
pub struct Finish { |
| 64 |
|
| 65 |
pub exit_code: Option<i32>, |
| 66 |
pub duration_ms: u64, |
| 67 |
pub receipt: Option<Receipt>, |
| 47c1d64d Andy McCall ↶ |
68 |
|
| 69 |
|
| 70 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 71 |
pub signed_receipt: Option<String>, |
| e0918b88 Andy McCall |
72 |
|
| 73 |
pub error: Option<String>, |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
pub const MAX_RECORD_TEXT: usize = 16 * 1024; |
| 78 |
|
| 79 |
pub const MAX_RECORDS: usize = 50_000; |