pub struct RequestBatcher { /* private fields */ }
Expand description
HTTP/2 request batcher for CDN downloads
Implementations§
Source§impl RequestBatcher
impl RequestBatcher
Sourcepub fn new(client: Client, config: BatchConfig) -> Self
pub fn new(client: Client, config: BatchConfig) -> Self
Create a new request batcher
Sourcepub async fn submit_request(
&self,
request: BatchRequest,
) -> Result<UnboundedReceiver<BatchResponse>>
pub async fn submit_request( &self, request: BatchRequest, ) -> Result<UnboundedReceiver<BatchResponse>>
Submit a request to be batched
Returns a receiver for the response. The request will be batched with others and executed when the batch is full or the timeout expires.
Sourcepub async fn submit_requests_and_wait(
&self,
requests: Vec<BatchRequest>,
) -> Vec<BatchResponse>
pub async fn submit_requests_and_wait( &self, requests: Vec<BatchRequest>, ) -> Vec<BatchResponse>
Submit multiple requests and wait for all responses
Sourcepub async fn get_stats(&self) -> BatchStats
pub async fn get_stats(&self) -> BatchStats
Get current statistics
Sourcepub fn create_cdn_requests(
cdn_host: &str,
path: &str,
hashes: &[String],
) -> Vec<BatchRequest>
pub fn create_cdn_requests( cdn_host: &str, path: &str, hashes: &[String], ) -> Vec<BatchRequest>
Create batch requests for CDN file downloads
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RequestBatcher
impl !RefUnwindSafe for RequestBatcher
impl Send for RequestBatcher
impl Sync for RequestBatcher
impl Unpin for RequestBatcher
impl !UnwindSafe for RequestBatcher
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