Skip to main content

Module thumbnail_cache

Module thumbnail_cache 

Source
Expand description

Two-tier (memory + disk) thumbnail cache for the library grid.

Remote thumbnails are fetched via the API client and decoded into GDK textures. An LRU memory cache with a configurable byte budget keeps hot textures in RAM, while a persistent disk cache avoids redundant network requests across sessions. In-flight deduplication ensures concurrent requests for the same asset coalesce into one load.

StructsΒ§

InflightGuard πŸ”’
Guard that cleans up in-flight channel entries on drop.
SizedLruCache πŸ”’
LRU Cache that limits memory usage based on estimated byte size.
ThumbnailCache
A combined memory (LRU) and disk-based caching manager for remote and local assets.

ConstantsΒ§

FALLBACK_CPUS πŸ”’
LARGE_LOAD_MAX πŸ”’
SMALL_LOAD_MAX πŸ”’

FunctionsΒ§

auto_memory_budget πŸ”’
Pick a thumbnail-cache RAM budget from MemTotal in /proc/meminfo, clamped to [AUTO_MIN_BYTES, AUTO_MAX_BYTES]. Falls back to the floor if the file can’t be read.
await_inflight πŸ”’
Helper to await an in-flight thumbnail load result from a subscriber channel.
cache_key πŸ”’
Construct a cache key string for remote assets.
custom_decode_to_thumbnail πŸ”’
Decodes an image file through the application’s custom texture pipeline and scale the result down to a 256x256 thumbnail pixbuf.
decode_local_pixbuf πŸ”’
Decode a local file to a 256x256 thumbnail pixbuf, routing through video, RAW, or standard image pipelines as appropriate.
decode_to_scaled_texture πŸ”’
Asynchronously decode image bytes into a scaled texture.
encode_png_bytes πŸ”’
estimate_texture_bytes πŸ”’
Estimate memory byte size occupied by a texture.
ffmpeg_extract_thumbnail πŸ”’
Extract a thumbnail frame from a video file using ffmpeg.
local_cache_key πŸ”’
Construct a cache key string for local assets using hashed paths.
pack_pixel_rows πŸ”’
pixbuf_png_bytes πŸ”’
read_meminfo_total_bytes πŸ”’
run_ffmpeg_frame πŸ”’
Run ffmpeg to extract a single frame at the given seek position.
scale_pixbuf_to_thumbnail πŸ”’
Scale a pixbuf down to fit within 256x256 if needed.
target_dim_for_bucket πŸ”’

Type AliasesΒ§

InflightMap πŸ”’
InflightRx πŸ”’
InflightSlot πŸ”’