pub struct DefaultHttpTransfer { /* private fields */ }Expand description
Built-in HTTP transfer backend based on reqwest and async file I/O.
Implementations§
Source§impl DefaultHttpTransfer
impl DefaultHttpTransfer
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a backend with default HTTP timeout and keepalive values.
§Examples
use rusty_cat::DefaultHttpTransfer;
let backend = DefaultHttpTransfer::new();
let _ = backend;Sourcepub fn with_http_timeouts(
http_timeout: Duration,
tcp_keepalive: Duration,
) -> Self
pub fn with_http_timeouts( http_timeout: Duration, tcp_keepalive: Duration, ) -> Self
Creates built-in backend with explicit timeout and keepalive values.
§Range guidance
http_timeout: recommended1s..=120stcp_keepalive: recommended10s..=300s
§Examples
use std::time::Duration;
use rusty_cat::DefaultHttpTransfer;
let backend = DefaultHttpTransfer::with_http_timeouts(
Duration::from_secs(15),
Duration::from_secs(60),
);
let _ = backend;Sourcepub fn try_with_http_timeouts(
http_timeout: Duration,
tcp_keepalive: Duration,
) -> Result<Self, MeowError>
pub fn try_with_http_timeouts( http_timeout: Duration, tcp_keepalive: Duration, ) -> Result<Self, MeowError>
Preferred fallible constructor with explicit error propagation.
§Errors
Returns HttpClientBuildFailed when reqwest::Client cannot be
constructed with the provided timeout/keepalive values.
§Examples
use std::time::Duration;
use rusty_cat::DefaultHttpTransfer;
let backend = DefaultHttpTransfer::try_with_http_timeouts(
Duration::from_secs(10),
Duration::from_secs(30),
)?;
let _ = backend;Sourcepub fn with_client(client: Client) -> Self
pub fn with_client(client: Client) -> Self
Creates backend with an externally provided reqwest::Client.
§Examples
use rusty_cat::DefaultHttpTransfer;
let reqwest_client = reqwest::Client::new();
let backend = DefaultHttpTransfer::with_client(reqwest_client);
let _ = backend;Sourcepub fn with_fallbacks(
client: Client,
upload: Arc<dyn BreakpointUpload + Send + Sync>,
download: Arc<dyn BreakpointDownload + Send + Sync>,
) -> Self
pub fn with_fallbacks( client: Client, upload: Arc<dyn BreakpointUpload + Send + Sync>, download: Arc<dyn BreakpointDownload + Send + Sync>, ) -> Self
Creates backend with explicit fallback upload/download protocol plugins.
Task-level protocol instances still take precedence when present.
§Examples
use std::sync::Arc;
use rusty_cat::{DefaultHttpTransfer, DefaultStyleUpload, StandardRangeDownload};
let backend = DefaultHttpTransfer::with_fallbacks(
reqwest::Client::new(),
Arc::new(DefaultStyleUpload::default()),
Arc::new(StandardRangeDownload::default()),
);
let _ = backend;Trait Implementations§
Source§impl Default for DefaultHttpTransfer
impl Default for DefaultHttpTransfer
Source§impl TransferTrait for DefaultHttpTransfer
impl TransferTrait for DefaultHttpTransfer
Source§fn prepare<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
local_offset: u64,
) -> Pin<Box<dyn Future<Output = Result<PrepareOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
local_offset: u64,
) -> Pin<Box<dyn Future<Output = Result<PrepareOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Prepares transfer execution according to task direction.
Source§fn transfer_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
offset: u64,
chunk_size: u64,
remote_total_size: u64,
) -> Pin<Box<dyn Future<Output = Result<ChunkOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transfer_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
offset: u64,
chunk_size: u64,
remote_total_size: u64,
) -> Pin<Box<dyn Future<Output = Result<ChunkOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Transfers one chunk according to task direction.
Source§fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
) -> Pin<Box<dyn Future<Output = Result<(), MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
) -> Pin<Box<dyn Future<Output = Result<(), MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles task cancel; upload direction may trigger protocol abort.
Source§fn supports_parallel_parts(&self, task: &TransferTask) -> bool
fn supports_parallel_parts(&self, task: &TransferTask) -> bool
Parallel parts are only offered for uploads whose resolved protocol proves out-of-order safety; downloads always stay serial.
Source§fn transfer_chunk_part<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
offset: u64,
chunk_size: u64,
remote_total_size: u64,
) -> Pin<Box<dyn Future<Output = Result<ChunkOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transfer_chunk_part<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
offset: u64,
chunk_size: u64,
remote_total_size: u64,
) -> Pin<Box<dyn Future<Output = Result<ChunkOutcome, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Uploads one chunk without finalizing (parallel path). Completion is run
exactly once by the scheduler via Self::complete.
Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 TransferTask,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, MeowError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Finalizes an upload after all parts have been uploaded; delegates to the
protocol’s complete_upload.