pub struct ImageCacheWriter { /* private fields */ }Expand description
Update handle for image files.
- Generates thumbnails with the
imagecrate (224×224 JPEG). Cloneonly bumpsArccounters.
Implementations§
Source§impl ImageCacheWriter
impl ImageCacheWriter
pub fn as_session(config: ImageCacheConfig) -> Result<Self>
pub fn onetime(location: DbLocation) -> Result<Self>
pub fn upsert(&self, req: UpsertImageRequest) -> Result<()>
Sourcepub fn upsert_all(
&self,
reqs: Vec<UpsertImageRequest>,
) -> Vec<(PathBuf, Result<()>)>
pub fn upsert_all( &self, reqs: Vec<UpsertImageRequest>, ) -> Vec<(PathBuf, Result<()>)>
Batch variant of upsert. Returns (PathBuf, Result<()>) per
request.
§Parallelization strategy
- Freshness checks and thumbnail generation run in parallel (rayon over the read pool).
- Database writes are serialized on the write connection.
- Entries that are already fresh and carry nothing new are skipped entirely — the steady-state startup pass over an unchanged library performs no writes and no hashing.
Individual errors are stored per element; other requests continue.
pub fn delete(&self, path: &Path) -> Result<bool>
Sourcepub fn delete_in_dir(&self, dir: &Path) -> Result<usize>
pub fn delete_in_dir(&self, dir: &Path) -> Result<usize>
Remove every cached entry whose file lives directly in dir,
deleting the associated thumbnail file (when recorded) as well.
Non-recursive: entries in subdirectories are untouched.
Returns the number of entries removed (RFC 004).
pub fn list_paths(&self) -> Result<Vec<String>>
pub fn as_reader(&self) -> ImageCacheReader
pub fn lookup(&self, path: &Path) -> Result<LookupResult<ImageCacheEntry>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageCacheWriter
impl RefUnwindSafe for ImageCacheWriter
impl Send for ImageCacheWriter
impl Sync for ImageCacheWriter
impl Unpin for ImageCacheWriter
impl UnsafeUnpin for ImageCacheWriter
impl UnwindSafe for ImageCacheWriter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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