mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 08:05:15 +08:00
feat: implement production cas v1
This commit is contained in:
@@ -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<()>;
|
||||
|
||||
/// 批量保存翻译
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user