pub trait FileBackend:
Send
+ Sync
+ Debug {
// Required methods
fn get_by_hash(
&self,
hash: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send;
fn get_by_video_and_format(
&self,
video_id: &str,
format_id: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send;
fn get_by_video_and_preferences(
&self,
video_id: &str,
preferences: &FormatPreferences,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send;
fn put(
&self,
file: CachedFile,
source_path: &Path,
) -> impl Future<Output = Result<PathBuf>> + Send;
fn remove(&self, id: &str) -> impl Future<Output = Result<()>> + Send;
fn clean(&self) -> impl Future<Output = Result<()>> + Send;
fn get_thumbnail_by_video_id(
&self,
video_id: &str,
) -> impl Future<Output = Result<Option<(CachedThumbnail, PathBuf)>>> + Send;
fn put_thumbnail(
&self,
thumbnail: CachedThumbnail,
source_path: &Path,
) -> impl Future<Output = Result<PathBuf>> + Send;
fn get_subtitle_by_language(
&self,
video_id: &str,
language: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send;
}Expand description
Trait for file cache backend implementations.
Required Methods§
Sourcefn get_by_hash(
&self,
hash: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
fn get_by_hash( &self, hash: &str, ) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
Sourcefn get_by_video_and_format(
&self,
video_id: &str,
format_id: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
fn get_by_video_and_format( &self, video_id: &str, format_id: &str, ) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
Sourcefn get_by_video_and_preferences(
&self,
video_id: &str,
preferences: &FormatPreferences,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
fn get_by_video_and_preferences( &self, video_id: &str, preferences: &FormatPreferences, ) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
Retrieves a file from the cache based on video ID and quality preferences.
§Arguments
video_id- The video identifierpreferences- The format preferences to match against
§Returns
The cached file entry and its path, or None if no match.
§Errors
Returns an error if the underlying I/O or deserialization fails.
Sourcefn put(
&self,
file: CachedFile,
source_path: &Path,
) -> impl Future<Output = Result<PathBuf>> + Send
fn put( &self, file: CachedFile, source_path: &Path, ) -> impl Future<Output = Result<PathBuf>> + Send
Sourcefn get_thumbnail_by_video_id(
&self,
video_id: &str,
) -> impl Future<Output = Result<Option<(CachedThumbnail, PathBuf)>>> + Send
fn get_thumbnail_by_video_id( &self, video_id: &str, ) -> impl Future<Output = Result<Option<(CachedThumbnail, PathBuf)>>> + Send
Sourcefn put_thumbnail(
&self,
thumbnail: CachedThumbnail,
source_path: &Path,
) -> impl Future<Output = Result<PathBuf>> + Send
fn put_thumbnail( &self, thumbnail: CachedThumbnail, source_path: &Path, ) -> impl Future<Output = Result<PathBuf>> + Send
Sourcefn get_subtitle_by_language(
&self,
video_id: &str,
language: &str,
) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
fn get_subtitle_by_language( &self, video_id: &str, language: &str, ) -> impl Future<Output = Result<Option<(CachedFile, PathBuf)>>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl FileBackend for MokaFileCache
impl FileBackend for PersistentFileBackend
Available on
persistent_cache only.