Add and prepare rust worker management system for file information processing and knowledge base framework

This commit is contained in:
Christbru 2025-10-19 03:53:02 -05:00
commit da6ab3a782
12 changed files with 1402 additions and 251 deletions

56
rust-engine/src/models.rs Normal file
View file

@ -0,0 +1,56 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FileRecord {
pub id: String,
pub filename: String,
pub path: String,
pub description: Option<String>,
pub created_at: Option<DateTime<Utc>>,
}
impl FileRecord {
pub fn new(filename: impl Into<String>, path: impl Into<String>, description: Option<String>) -> Self {
Self {
id: Uuid::new_v4().to_string(),
filename: filename.into(),
path: path.into(),
description,
created_at: None,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum QueryStatus {
Queued,
InProgress,
Completed,
Cancelled,
Failed,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct QueryRecord {
pub id: String,
pub status: QueryStatus,
pub payload: serde_json::Value,
pub result: Option<serde_json::Value>,
pub created_at: Option<DateTime<Utc>>,
pub updated_at: Option<DateTime<Utc>>,
}
impl QueryRecord {
pub fn new(payload: serde_json::Value) -> Self {
Self {
id: Uuid::new_v4().to_string(),
status: QueryStatus::Queued,
payload,
result: None,
created_at: None,
updated_at: None,
}
}
}