Skip to main content

Module sparse_cache

Module sparse_cache 

Source
Expand description

Sparse byte-range cache for on-demand partial file downloads.

Backs each open file handle with a tempfile sized to the MTP object’s total length. Tracks which byte ranges have been populated. When a FUSE read(offset, size) arrives, SparseCache::missing_ranges tells the caller which ranges still need to be fetched from MTP; after the caller writes the fetched bytes via SparseCache::write_at, SparseCache::read_at serves the requested slice from the tempfile.

Ranges are kept sorted and merged so that adjacent writes coalesce.

Structs§

SparseCache
A tempfile-backed cache that tracks populated byte ranges.