pub struct EditorImportService;Expand description
图源导入服务
Implementations§
Source§impl EditorImportService
impl EditorImportService
Sourcepub async fn import_provider_pages(
state: &AppState,
episode_id: i32,
force: bool,
) -> ApiResult<ImportProviderResult>
pub async fn import_provider_pages( state: &AppState, episode_id: i32, force: bool, ) -> ApiResult<ImportProviderResult>
从话数图源导入并生成编辑器页面。
§参数
state: 应用状态episode_id: 话数 IDforce: 是否强制重建(删除旧页面与旧标点后重新导入)
§返回
ImportProviderResult:是否新建、页面总数与页面列表
§错误
- 话数不存在或无图源
- 图源下载、解压、上传失败
Sourcepub async fn prepare_upload_credentials(
state: &AppState,
episode_id: i32,
files: Vec<EditorUploadFile>,
) -> ApiResult<EditorUploadCredentialsResponse>
pub async fn prepare_upload_credentials( state: &AppState, episode_id: i32, files: Vec<EditorUploadFile>, ) -> ApiResult<EditorUploadCredentialsResponse>
为前端图源解压直传准备批量上传凭证。
前端把图源 zip 解压(或散图识别)后,调用本接口一次拿到全部页面的图片 OSS
预签名 PUT URL(单次 STS),随后逐张直传图片字节,最后调用
register_pages 落库。
§参数
episode_id: 话数 IDfiles: 待上传文件(页序 + 原始文件名,用于推断对象键后缀)
Sourcepub async fn register_pages(
state: &AppState,
episode_id: i32,
req: RegisterEditorPagesRequest,
) -> ApiResult<ImportProviderResult>
pub async fn register_pages( state: &AppState, episode_id: i32, req: RegisterEditorPagesRequest, ) -> ApiResult<ImportProviderResult>
注册前端已上传到图片 OSS 的页面。
与服务端 import_provider_pages 等价的落库逻辑,但图片由前端直传,
不再依赖 provider_file_oss_id 压缩包。
幂等:已有页面且非 force 时直接返回旧页面;强制重建会校验页面快照及下游工作,
并在同一事务内替换旧页面与标点。
Auto Trait Implementations§
impl Freeze for EditorImportService
impl RefUnwindSafe for EditorImportService
impl Send for EditorImportService
impl Sync for EditorImportService
impl Unpin for EditorImportService
impl UnsafeUnpin for EditorImportService
impl UnwindSafe for EditorImportService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request