pub struct DownloadCommand { /* private fields */ }Implementations§
Source§impl DownloadCommand
impl DownloadCommand
Sourcepub fn new(
gid: GroupId,
uri: &str,
options: &DownloadOptions,
output_dir: Option<&str>,
output_name: Option<&str>,
) -> Result<Self>
pub fn new( gid: GroupId, uri: &str, options: &DownloadOptions, output_dir: Option<&str>, output_name: Option<&str>, ) -> Result<Self>
Create a DownloadCommand with a standalone RequestGroup (not registered in RequestGroupMan). Use this for simple CLI/test scenarios where external progress queries are not needed.
Sourcepub fn new_with_group(
group: Arc<RwLock<RequestGroup>>,
uri: &str,
options: &DownloadOptions,
output_dir: Option<&str>,
output_name: Option<&str>,
) -> Result<Self>
pub fn new_with_group( group: Arc<RwLock<RequestGroup>>, uri: &str, options: &DownloadOptions, output_dir: Option<&str>, output_name: Option<&str>, ) -> Result<Self>
Create a DownloadCommand with a shared RequestGroup Arc (registered in RequestGroupMan). Use this for RPC and CLI paths where external progress queries are needed.
Sourcepub fn new_with_client(
gid: GroupId,
uri: &str,
options: &DownloadOptions,
output_dir: Option<&str>,
output_name: Option<&str>,
client: Arc<Client>,
) -> Result<Self>
pub fn new_with_client( gid: GroupId, uri: &str, options: &DownloadOptions, output_dir: Option<&str>, output_name: Option<&str>, client: Arc<Client>, ) -> Result<Self>
Create a DownloadCommand with a custom HTTP client and standalone group.
Sourcepub fn new_with_group_and_client(
group: Arc<RwLock<RequestGroup>>,
uri: &str,
options: &DownloadOptions,
output_dir: Option<&str>,
output_name: Option<&str>,
client: Arc<Client>,
) -> Result<Self>
pub fn new_with_group_and_client( group: Arc<RwLock<RequestGroup>>, uri: &str, options: &DownloadOptions, output_dir: Option<&str>, output_name: Option<&str>, client: Arc<Client>, ) -> Result<Self>
Create a DownloadCommand with a shared group Arc and custom HTTP client.
Sourcepub fn new_with_stat_man(
gid: GroupId,
uri: &str,
options: &DownloadOptions,
output_dir: Option<&str>,
output_name: Option<&str>,
stat_man: Arc<ServerStatMan>,
) -> Result<Self>
pub fn new_with_stat_man( gid: GroupId, uri: &str, options: &DownloadOptions, output_dir: Option<&str>, output_name: Option<&str>, stat_man: Arc<ServerStatMan>, ) -> Result<Self>
Create a DownloadCommand with a shared ServerStatMan.
This allows multiple downloads to share server performance statistics, enabling intelligent mirror selection based on historical data.
Sourcepub fn enable_perf_monitor(&mut self)
pub fn enable_perf_monitor(&mut self)
Enable performance monitoring for this download.
This adds minimal overhead (< 1%) to track throughput, latency, memory, and lock wait times.
Sourcepub fn get_perf_metrics(&self) -> Metrics
pub fn get_perf_metrics(&self) -> Metrics
Get performance metrics snapshot (low-overhead, always available)
Sourcepub fn get_perf_report(&self) -> Option<String>
pub fn get_perf_report(&self) -> Option<String>
Get performance report if monitoring is enabled
Sourcepub fn get_perf_report_json(&self) -> Option<String>
pub fn get_perf_report_json(&self) -> Option<String>
Get performance report in JSON format if monitoring is enabled
pub async fn group(&self) -> RwLockReadGuard<'_, RequestGroup>
pub async fn group_mut(&self) -> RwLockWriteGuard<'_, RequestGroup>
Sourcepub fn no_proxy_matcher(&self) -> Option<&NoProxyMatcher>
pub fn no_proxy_matcher(&self) -> Option<&NoProxyMatcher>
Get the NoProxy matcher for checking if a host should bypass proxy
Sourcepub fn stat_man(&self) -> &Arc<ServerStatMan> ⓘ
pub fn stat_man(&self) -> &Arc<ServerStatMan> ⓘ
Get a reference to the server statistics manager.
Trait Implementations§
Source§impl Command for DownloadCommand
impl Command for DownloadCommand
fn execute<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn status(&self) -> CommandStatus
fn timeout(&self) -> Option<Duration>
Source§fn started_at(&self) -> Option<Instant>
fn started_at(&self) -> Option<Instant>
set_started_at]. Read moreSource§fn set_started_at(&mut self, _instant: Instant)
fn set_started_at(&mut self, _instant: Instant)
started_at].Auto Trait Implementations§
impl !RefUnwindSafe for DownloadCommand
impl !UnwindSafe for DownloadCommand
impl Freeze for DownloadCommand
impl Send for DownloadCommand
impl Sync for DownloadCommand
impl Unpin for DownloadCommand
impl UnsafeUnpin for DownloadCommand
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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 more