RawScanLoadController
- class RawScanLoadController(filestore: FileStoreInterface)
Orchestrates the loading of
RawScanobjects from a file store. This controller centralizes loader selection, classification, and batch-loading workflows. Implemented as a singleton to ensure consistent loader registry and classifier usage across the application.- Parameters:
filestore (FileStoreInterface) – File storage backend used to resolve file paths.
Overview
The controller coordinates three main concerns:
Classification: Determines the appropriate loader for a file via
RawScanClassifier.Loader resolution: Uses
LoaderRegistryto map classifications to concrete loader implementations.Batch orchestration: Provides optimized loading for multiple files or folders.
Private Methods
Public Methods
- load_file(file_path: str, loader: LoaderInterface | None = None) RawScan
Load a single file into a
RawScan.If no loader is provided, one is inferred via classification.
- Parameters:
file_path (str) – Path to the file.
loader (LoaderInterface, optional) – Optional explicit loader instance.
- Returns:
Loaded raw scan object.
- Return type:
RawScan
- load_files(file_paths: list[str], loader: LoaderInterface | None = None, quick: bool = Config['library.storage.raw.classification.quick']) list[RawScan]
Load multiple files into a list of
RawScanobjects.When
quickis enabled and no loader is provided, the loader is resolved once using the first file and reused for all subsequent files. This assumes homogeneous file types and improves performance.
Design Notes
Singleton pattern ensures a single shared controller instance.
Pluggable loaders via
LoaderRegistrysupport extensibility.Performance optimization via
quickmode reduces redundant classification.Assumes consistent file types when
quick=True; misuse may lead to incorrect loader selection.