951caac32d
新增外部生成队列概览和单任务状态契约 将跳一跳、拼消消、敲木鱼图片生成动作接入worker队列 前端生成等待页展示当前任务和队列数量 更新外部生成worker运维文档和团队决策记录
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub enum ExternalGenerationJobStatus {
|
|
Queued,
|
|
Running,
|
|
Completed,
|
|
Failed,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationQueueOverview {
|
|
pub pending_count: u32,
|
|
pub running_count: u32,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationQueueOverviewResponse {
|
|
pub overview: ExternalGenerationQueueOverview,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationJobStatusRecord {
|
|
pub operation_id: String,
|
|
pub status: ExternalGenerationJobStatus,
|
|
pub phase_label: String,
|
|
pub phase_detail: String,
|
|
pub progress: u8,
|
|
pub error: Option<String>,
|
|
pub updated_at_micros: i64,
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ExternalGenerationJobStatusResponse {
|
|
pub job: ExternalGenerationJobStatusRecord,
|
|
}
|