use serde::{Deserialize, Serialize};
mod control;
mod events;
mod jobs;
pub use control::{
Busy, Check, CheckStatus, ConfigCheck, ConfigFile, Doctor, PauseQuery, Paused, RunningJob,
};
pub use events::{Event, EventEnvelope, EventQuery};
pub use jobs::{
Bucket, CacheHistory, CacheHistoryQuery, CacheKind, CacheSize, CacheVolume, Caches, HostSample,
HostSampleQuery, HostSamples, Job, JobMetrics, JobPage, JobQuery, JobRunner, JobState,
JobSummary, LogQuery, LogSummary, Sample, SampleSeries, Stats, StatsQuery, StatsRow, Step,
Timeline,
};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", tag = "kind")]
pub enum Principal {
LocalOwner {
uid: u32,
},
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Status {
pub version: String,
pub shutting_down: bool,
pub budget: Budget,
pub profiles: Vec<ProfileStatus>,
pub repositories: Vec<RepositoryStatus>,
#[serde(default)]
pub queued: Vec<QueuedJob>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Budget {
pub slice: String,
pub memory_max: Option<u64>,
pub memory_in_use: u64,
#[serde(default)]
pub mirror_memory: u64,
#[serde(default)]
pub seed_memory: Vec<SeedMemory>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SeedMemory {
pub profile: String,
pub memory: u64,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProfileStatus {
pub name: String,
pub image: String,
pub cpus: u32,
pub memory: u64,
pub reseeding: bool,
pub slots: Vec<SlotStatus>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SlotStatus {
pub slot: usize,
pub runner: Option<RunnerStatus>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RunnerStatus {
pub repository: String,
pub name: String,
pub runner_id: u64,
pub container: String,
pub busy: bool,
pub started_at: u64,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RepositoryStatus {
pub name: String,
pub profile: String,
pub labels: Vec<String>,
pub paused: bool,
pub queued_jobs: usize,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct QueuedJob {
pub id: u64,
pub repository: String,
pub run_id: u64,
pub run_attempt: u32,
pub workflow: Option<String>,
pub name: String,
pub branch: Option<String>,
pub url: Option<String>,
pub queued_at: u64,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct ShutdownRequest {
#[serde(default)]
pub force: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ErrorResponse {
pub message: String,
}