feat: implement production cas v1

This commit is contained in:
2026-06-28 12:39:17 +08:00
parent dd53e3054e
commit b202d7b231
33 changed files with 1082 additions and 447 deletions
+4 -6
View File
@@ -298,9 +298,7 @@ pub trait CasRepository: Send + Sync {
///
/// 默认实现读取整个文件到内存。大文件应考虑流式处理。
async fn store_from_file(&self, path: &Path) -> crate::Result<ObjectId> {
let data = tokio::fs::read(path).await.map_err(|e| {
crate::Error::Io(e)
})?;
let data = tokio::fs::read(path).await.map_err(crate::Error::Io)?;
self.store(&data).await
}
@@ -330,9 +328,9 @@ pub trait CasRepository: Send + Sync {
/// - 确保有写入权限
async fn export_to_file(&self, id: &ObjectId, path: &Path) -> crate::Result<()> {
let data = self.get(id).await?;
tokio::fs::write(path, data).await.map_err(|e| {
crate::Error::Io(e)
})?;
tokio::fs::write(path, data)
.await
.map_err(crate::Error::Io)?;
Ok(())
}
}
@@ -302,11 +302,7 @@ pub trait TranslationRepository: Send + Sync {
/// - 使用 UPDATE 语句,只更新 status 字段
/// - 记录状态变更时间
/// - 可选:记录状态变更历史
async fn update_status(
&self,
source_id: &str,
status: TranslationStatus,
) -> crate::Result<()>;
async fn update_status(&self, source_id: &str, status: TranslationStatus) -> crate::Result<()>;
/// 批量保存翻译
///