pub struct ThumbnailService { /* private fields */ }Expand description
Thumbnail service with LRU cache management
Implementations§
Source§impl ThumbnailService
impl ThumbnailService
Sourcepub fn new<P: AsRef<Path>>(drive_root: P, max_cache_gb: f64) -> Result<Self>
pub fn new<P: AsRef<Path>>(drive_root: P, max_cache_gb: f64) -> Result<Self>
Create a new thumbnail service for a drive
Sourcepub fn generate_thumbnail(
&self,
photo_path: &Path,
file_hash: &str,
orientation: i32,
size: ThumbnailSize,
) -> Result<PathBuf, String>
pub fn generate_thumbnail( &self, photo_path: &Path, file_hash: &str, orientation: i32, size: ThumbnailSize, ) -> Result<PathBuf, String>
Generate a thumbnail synchronously with a timeout guard.
Call this from a background task (spawn_blocking) after get_thumbnail returns Pending.
pub fn generate_thumbnail_background( &self, photo_path: &Path, file_hash: &str, orientation: i32, size: ThumbnailSize, ) -> Result<PathBuf, String>
Sourcepub fn generate_background_batch(
&self,
items: &[(PathBuf, String, i32)],
size: ThumbnailSize,
force: bool,
cancel: &AtomicBool,
) -> Vec<Option<Result<PathBuf, String>>>
pub fn generate_background_batch( &self, items: &[(PathBuf, String, i32)], size: ThumbnailSize, force: bool, cancel: &AtomicBool, ) -> Vec<Option<Result<PathBuf, String>>>
Generate background thumbnails for a batch on a few scoped worker
threads (one per background permit), returning results in input
order. None marks items skipped because cancel was set.
Dedicated threads, not Rayon: workers park on the limiter while foreground requests run, and parking Rayon’s global pool would stall face detection and other parallel work sharing it.
Sourcepub fn generate_thumbnail_background_forced(
&self,
photo_path: &Path,
file_hash: &str,
orientation: i32,
size: ThumbnailSize,
) -> Result<PathBuf, String>
pub fn generate_thumbnail_background_forced( &self, photo_path: &Path, file_hash: &str, orientation: i32, size: ThumbnailSize, ) -> Result<PathBuf, String>
Background generation that ignores an existing adequate thumbnail — used by “regenerate thumbnails” so quality upgrades actually happen even though the old (adequate) rendition is still on disk.
Sourcepub fn forget_cached_paths(&self)
pub fn forget_cached_paths(&self)
Forget remembered thumbnail locations, after the cache folder moved.
Sourcepub fn load_existing_thumbnails(&self) -> Result<()>
pub fn load_existing_thumbnails(&self) -> Result<()>
Scan existing thumbnails on disk and populate cache
pub fn load_existing_thumbnails_until(&self, cancel: &AtomicBool) -> Result<()>
Auto Trait Implementations§
impl !Freeze for ThumbnailService
impl RefUnwindSafe for ThumbnailService
impl Send for ThumbnailService
impl Sync for ThumbnailService
impl Unpin for ThumbnailService
impl UnsafeUnpin for ThumbnailService
impl UnwindSafe for ThumbnailService
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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