use async_trait::async_trait;
use crate::http_breakpoint::UploadResumeInfo;
use crate::{MeowError, TransferTask};
#[async_trait]
pub trait BreakpointUpload: Send + Sync {
async fn prepare(
&self,
client: &reqwest::Client,
task: &TransferTask,
local_offset: u64,
) -> Result<UploadResumeInfo, MeowError>;
async fn upload_chunk(
&self,
client: &reqwest::Client,
task: &TransferTask,
chunk: &[u8],
offset: u64,
) -> Result<UploadResumeInfo, MeowError>;
async fn complete_upload(
&self,
_client: &reqwest::Client,
_task: &TransferTask,
) -> Result<(), MeowError> {
Ok(())
}
async fn abort_upload(
&self,
_client: &reqwest::Client,
_task: &TransferTask,
) -> Result<(), MeowError> {
Ok(())
}
}