refactor: remove dead OptimizedFileContent::Mmap variant
OptimizedFileContent::Mmap was constructed nowhere — the documented "Tier 2: memory-mapped I/O (10-100 MB)" path was never wired, so optimized_inner only ever returns Bytes (<10 MB) or Stream (>=10 MB). The variant survived only as an enum case plus two dead match arms in the file and share download handlers. Remove the variant and its arms, and fix the now-misleading retrieval-service tier docs (everything >=10 MB streams via CDC chunk reassembly with the backend read-ahead; there is no mmap tier). Behaviour is unchanged — the deleted arms were unreachable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JG5yYZ9s868mJwqT2Qz7ez
This commit is contained in:
@@ -93,7 +93,7 @@ pub trait FileUploadUseCase: Send + Sync + 'static {
|
||||
/// Optimized file content returned by the retrieval service.
|
||||
///
|
||||
/// The handler only needs to map each variant to the appropriate HTTP
|
||||
/// response; all caching / transcoding / mmap decisions happen in the
|
||||
/// response; all caching / transcoding decisions happen in the
|
||||
/// application layer.
|
||||
pub enum OptimizedFileContent {
|
||||
/// Small-file content (possibly transcoded / compressed) already in RAM.
|
||||
@@ -102,9 +102,7 @@ pub enum OptimizedFileContent {
|
||||
mime_type: Arc<str>,
|
||||
was_transcoded: bool,
|
||||
},
|
||||
/// Memory-mapped file (10–100 MB).
|
||||
Mmap(Bytes),
|
||||
/// Streaming download for very large files (≥100 MB).
|
||||
/// Streaming download for everything above the in-RAM cache threshold.
|
||||
Stream(Pin<Box<dyn Stream<Item = Result<Bytes, std::io::Error>> + Send>>),
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ const CACHE_THRESHOLD: u64 = 10 * 1024 * 1024;
|
||||
/// Implements a multi-tier download strategy:
|
||||
/// - Tier 0: Write-behind cache (just-uploaded files still in RAM)
|
||||
/// - Tier 1: Hot cache + optional WebP transcoding (<10 MB)
|
||||
/// - Tier 2: Memory-mapped I/O (10–100 MB)
|
||||
/// - Tier 3: Streaming (≥100 MB)
|
||||
/// - Tier 2: Streaming for everything ≥10 MB — CDC chunk reassembly with the
|
||||
/// backend's read-ahead (`read_prefetch`); no whole-file buffering.
|
||||
pub struct FileRetrievalService {
|
||||
file_read: Arc<FileBlobReadRepository>,
|
||||
content_cache: Option<Arc<FileContentCache>>,
|
||||
|
||||
Reference in New Issue
Block a user