pub struct DownloadManager { /* private fields */ }Expand description
Manager maintaining registered files and sessions for the reverse transfer / browser download API.
Implementations§
Source§impl DownloadManager
impl DownloadManager
pub fn new() -> Self
Sourcepub async fn set_files(&self, files: Vec<DownloadFile>)
pub async fn set_files(&self, files: Vec<DownloadFile>)
Registers a set of files available for downloading.
Sourcepub async fn clear_files(&self)
pub async fn clear_files(&self)
Clears all offered download files and resets download sessions.
Sourcepub async fn get_file_dtos(&self) -> HashMap<String, FileDto>
pub async fn get_file_dtos(&self) -> HashMap<String, FileDto>
Returns a map of all offered file DTOs.
Sourcepub async fn is_session_valid(
&self,
session_id: &str,
client_ip: IpAddr,
) -> bool
pub async fn is_session_valid( &self, session_id: &str, client_ip: IpAddr, ) -> bool
Checks if a session with given ID is currently valid and accepted for the given remote IP.
Sourcepub async fn prepare_session(
&self,
requested_session_id: Option<&str>,
client_ip: IpAddr,
accepted: bool,
) -> String
pub async fn prepare_session( &self, requested_session_id: Option<&str>, client_ip: IpAddr, accepted: bool, ) -> String
Prepares or accepts a download session for a client. Returns the session ID.
Sourcepub async fn get_file_path(
&self,
session_id: &str,
file_id: &str,
client_ip: IpAddr,
) -> Result<PathBuf, StatusCode>
pub async fn get_file_path( &self, session_id: &str, file_id: &str, client_ip: IpAddr, ) -> Result<PathBuf, StatusCode>
Retrieves the local filesystem path for a valid file in an authorized session.
Trait Implementations§
Source§impl Debug for DownloadManager
impl Debug for DownloadManager
Auto Trait Implementations§
impl !Freeze for DownloadManager
impl !RefUnwindSafe for DownloadManager
impl !UnwindSafe for DownloadManager
impl Send for DownloadManager
impl Sync for DownloadManager
impl Unpin for DownloadManager
impl UnsafeUnpin for DownloadManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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