pub struct ImageRequestQueue {
inner: Arc<Mutex<ImageRequestQueueInner>>,
}
Expand description
A queue for image requests.
This implements the following features:
- Limit the number of concurrent requests,
- Prioritize requests according to their importance,
- Avoid duplicate requests,
- Watch requests that fail with I/O errors to:
- Reinsert them at the end of the queue to retry them later,
- Reduce the pool capacity temporarily to avoid more similar errors and let the system recover.
- Watch requests that take too long to:
- Log them,
- Ignore them in the count of ongoing requests.
Fields§
§inner: Arc<Mutex<ImageRequestQueueInner>>
Implementations§
Source§impl ImageRequestQueue
impl ImageRequestQueue
Sourcepub async fn add_download_request(
&self,
client: Client,
settings: MediaRequestParameters,
dimensions: Option<FrameDimensions>,
priority: ImageRequestPriority,
) -> ImageRequestHandle
pub async fn add_download_request( &self, client: Client, settings: MediaRequestParameters, dimensions: Option<FrameDimensions>, priority: ImageRequestPriority, ) -> ImageRequestHandle
Add a request to download an image.
If another request for the same image already exists, this will reuse the same request.
Sourcepub async fn add_file_request(
&self,
file: File,
dimensions: Option<FrameDimensions>,
) -> ImageRequestHandle
pub async fn add_file_request( &self, file: File, dimensions: Option<FrameDimensions>, ) -> ImageRequestHandle
Add a request to load an image from a file.
If another request for the same file already exists, this will reuse the same request.
Sourceasync fn mark_as_stalled(&self, request_id: ImageRequestId)
async fn mark_as_stalled(&self, request_id: ImageRequestId)
Mark the request with the given ID as stalled.
Sourceasync fn retry_request(&self, request_id: &ImageRequestId, lower_limit: bool)
async fn retry_request(&self, request_id: &ImageRequestId, lower_limit: bool)
Retry the request with the given ID.
If lower_limit
is true
, we will also lower the limit of the queue.
Sourceasync fn remove_request(&self, request_id: &ImageRequestId)
async fn remove_request(&self, request_id: &ImageRequestId)
Remove the request with the given ID.
Auto Trait Implementations§
impl Freeze for ImageRequestQueue
impl !RefUnwindSafe for ImageRequestQueue
impl Send for ImageRequestQueue
impl Sync for ImageRequestQueue
impl Unpin for ImageRequestQueue
impl !UnwindSafe for ImageRequestQueue
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
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
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 more