131 lines
3.4 KiB
Rust
131 lines
3.4 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use std::collections::HashMap;
|
|
|
|
/// File details information
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct FileDetails {
|
|
/// File name
|
|
pub name: String,
|
|
/// File size in KB
|
|
pub size_kb: f64,
|
|
/// Last modified timestamp
|
|
pub modified_at: DateTime<Utc>,
|
|
}
|
|
|
|
/// HTTP validation error details
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct HTTPValidationError {
|
|
/// List of validation errors
|
|
pub detail: Vec<ValidationError>,
|
|
}
|
|
|
|
/// Individual validation error
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ValidationError {
|
|
/// Error location path
|
|
pub loc: Vec<ValidationErrorLocation>,
|
|
/// Error message
|
|
pub msg: String,
|
|
/// Error type
|
|
#[serde(rename = "type")]
|
|
pub error_type: String,
|
|
}
|
|
|
|
/// Validation error location (can be string or integer)
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(untagged)]
|
|
pub enum ValidationErrorLocation {
|
|
String(String),
|
|
Integer(i32),
|
|
}
|
|
|
|
/// Server files information
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerFiles {
|
|
/// Server index in configuration list
|
|
pub server_index: i32,
|
|
/// HTTP URL of the server
|
|
pub http_url: String,
|
|
/// List of input files
|
|
pub input_files: Vec<FileDetails>,
|
|
/// List of output files
|
|
pub output_files: Vec<FileDetails>,
|
|
}
|
|
|
|
/// Server heartbeat request
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerHeartbeatRequest {
|
|
/// Server name
|
|
pub name: String,
|
|
}
|
|
|
|
/// Server queue details
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerQueueDetails {
|
|
/// Number of running tasks
|
|
pub running_count: i32,
|
|
/// Number of pending tasks
|
|
pub pending_count: i32,
|
|
}
|
|
|
|
/// Server registration request
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerRegistrationRequest {
|
|
/// Server name
|
|
pub name: String,
|
|
/// HTTP URL of the server
|
|
pub http_url: String,
|
|
/// WebSocket URL of the server
|
|
pub ws_url: String,
|
|
}
|
|
|
|
/// Server status information
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerStatus {
|
|
/// Server index in configuration list
|
|
pub server_index: i32,
|
|
/// HTTP URL of the server
|
|
pub http_url: String,
|
|
/// WebSocket URL of the server
|
|
pub ws_url: String,
|
|
/// Whether the server is reachable
|
|
pub is_reachable: bool,
|
|
/// Whether the server is free
|
|
pub is_free: bool,
|
|
/// Queue details
|
|
pub queue_details: ServerQueueDetails,
|
|
}
|
|
|
|
/// Server status response
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerStatusResponse {
|
|
/// Server name
|
|
pub name: String,
|
|
/// HTTP URL of the server
|
|
pub http_url: String,
|
|
/// WebSocket URL of the server
|
|
pub ws_url: String,
|
|
/// Server status
|
|
pub status: String,
|
|
/// Last heartbeat timestamp
|
|
pub last_heartbeat: Option<String>,
|
|
/// Last health check timestamp
|
|
pub last_health_check: Option<String>,
|
|
/// Current number of tasks
|
|
pub current_tasks: i32,
|
|
/// Maximum concurrent tasks
|
|
pub max_concurrent_tasks: i32,
|
|
/// Server capabilities
|
|
pub capabilities: HashMap<String, serde_json::Value>,
|
|
/// Server metadata
|
|
pub metadata: HashMap<String, serde_json::Value>,
|
|
}
|
|
|
|
/// Server unregister request
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ServerUnregisterRequest {
|
|
/// Server name
|
|
pub name: String,
|
|
}
|