pub struct StreamingManager { /* private fields */ }Available on crate feature
streaming only.Expand description
File-based streaming cache manager
Implementations§
Source§impl StreamingManager
impl StreamingManager
Sourcepub fn new(root_path: PathBuf) -> StreamingManager
pub fn new(root_path: PathBuf) -> StreamingManager
Create a new streaming cache manager with default configuration
Sourcepub fn new_with_config(
root_path: PathBuf,
config: StreamingCacheConfig,
) -> StreamingManager
pub fn new_with_config( root_path: PathBuf, config: StreamingCacheConfig, ) -> StreamingManager
Create a new streaming cache manager with custom configuration
Sourcepub async fn new_with_existing_cache(
root_path: PathBuf,
) -> Result<StreamingManager, Box<dyn Error + Send + Sync>>
pub async fn new_with_existing_cache( root_path: PathBuf, ) -> Result<StreamingManager, Box<dyn Error + Send + Sync>>
Create a new streaming cache manager and rebuild reference counts from existing cache
Sourcepub async fn new_with_existing_cache_and_config(
root_path: PathBuf,
config: StreamingCacheConfig,
) -> Result<StreamingManager, Box<dyn Error + Send + Sync>>
pub async fn new_with_existing_cache_and_config( root_path: PathBuf, config: StreamingCacheConfig, ) -> Result<StreamingManager, Box<dyn Error + Send + Sync>>
Create a new streaming cache manager with config and rebuild reference counts from existing cache
Sourcepub async fn verify_content_integrity(
&self,
digest: &str,
content_path: &Path,
) -> Result<bool, Box<dyn Error + Send + Sync>>
pub async fn verify_content_integrity( &self, digest: &str, content_path: &Path, ) -> Result<bool, Box<dyn Error + Send + Sync>>
Verify content integrity by checking if file content matches its digest
Sourcepub async fn verify_cache_integrity(
&self,
) -> Result<CacheIntegrityReport, Box<dyn Error + Send + Sync>>
pub async fn verify_cache_integrity( &self, ) -> Result<CacheIntegrityReport, Box<dyn Error + Send + Sync>>
Verify all cached content integrity and return report
Trait Implementations§
Source§impl Clone for StreamingManager
impl Clone for StreamingManager
Source§fn clone(&self) -> StreamingManager
fn clone(&self) -> StreamingManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamingManager
impl Debug for StreamingManager
Source§impl StreamingCacheManager for StreamingManager
impl StreamingCacheManager for StreamingManager
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(Response<<StreamingManager as StreamingCacheManager>::Body>, CachePolicy)>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(Response<<StreamingManager as StreamingCacheManager>::Body>, CachePolicy)>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
Attempts to pull a cached response and related policy from cache with streaming body.
Source§fn put<'life0, 'async_trait, B>(
&'life0 self,
cache_key: String,
response: Response<B>,
policy: CachePolicy,
_request_url: Url,
metadata: Option<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<<StreamingManager as StreamingCacheManager>::Body>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
B: Body + Send + 'static + 'async_trait,
<B as Body>::Data: Send,
<B as Body>::Error: Into<StreamingError>,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
fn put<'life0, 'async_trait, B>(
&'life0 self,
cache_key: String,
response: Response<B>,
policy: CachePolicy,
_request_url: Url,
metadata: Option<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = Result<Response<<StreamingManager as StreamingCacheManager>::Body>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
B: Body + Send + 'static + 'async_trait,
<B as Body>::Data: Send,
<B as Body>::Error: Into<StreamingError>,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
Attempts to cache a response with a streaming body and related policy.
Source§fn convert_body<'life0, 'async_trait, B>(
&'life0 self,
response: Response<B>,
) -> Pin<Box<dyn Future<Output = Result<Response<<StreamingManager as StreamingCacheManager>::Body>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
B: Body + Send + 'static + 'async_trait,
<B as Body>::Data: Send,
<B as Body>::Error: Into<StreamingError>,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
fn convert_body<'life0, 'async_trait, B>(
&'life0 self,
response: Response<B>,
) -> Pin<Box<dyn Future<Output = Result<Response<<StreamingManager as StreamingCacheManager>::Body>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
B: Body + Send + 'static + 'async_trait,
<B as Body>::Data: Send,
<B as Body>::Error: Into<StreamingError>,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Into<StreamingError> + Send + Sync + 'static,
StreamingManager: 'async_trait,
Converts a generic body to the manager’s body type for non-cacheable responses.
This is called when a response should not be cached but still needs to be returned
with the correct body type.
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamingManager: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StreamingManager: 'async_trait,
Attempts to remove a record from cache.
Source§fn body_to_bytes_stream(
body: <StreamingManager as StreamingCacheManager>::Body,
) -> impl Stream<Item = Result<Bytes, Box<dyn Error + Send + Sync>>> + Sendwhere
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Send + Sync + 'static,
fn body_to_bytes_stream(
body: <StreamingManager as StreamingCacheManager>::Body,
) -> impl Stream<Item = Result<Bytes, Box<dyn Error + Send + Sync>>> + Sendwhere
<<StreamingManager as StreamingCacheManager>::Body as Body>::Data: Send,
<<StreamingManager as StreamingCacheManager>::Body as Body>::Error: Send + Sync + 'static,
Available on crate feature
streaming only.Convert the manager’s body type to a reqwest-compatible bytes stream.
This enables efficient streaming without collecting the entire body.
Auto Trait Implementations§
impl !Freeze for StreamingManager
impl !RefUnwindSafe for StreamingManager
impl Send for StreamingManager
impl Sync for StreamingManager
impl Unpin for StreamingManager
impl !UnwindSafe for StreamingManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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