pub struct CascStorage { /* private fields */ }Expand description
Main CASC storage implementation
Implementations§
Source§impl CascStorage
impl CascStorage
Sourcepub fn new(config: CascConfig) -> Result<Self>
pub fn new(config: CascConfig) -> Result<Self>
Create a new CASC storage instance
Sourcepub fn load_indices(&self) -> Result<()>
pub fn load_indices(&self) -> Result<()>
Load indices from disk
Sourcepub async fn new_async(config: CascConfig) -> Result<Self>
pub async fn new_async(config: CascConfig) -> Result<Self>
Create new CASC storage asynchronously (recommended for async contexts)
Sourcepub async fn load_indices_parallel(&self) -> Result<()>
pub async fn load_indices_parallel(&self) -> Result<()>
Load indices from disk with parallel processing (3-5x faster)
Sourcepub fn load_indices_sequential(&self) -> Result<()>
pub fn load_indices_sequential(&self) -> Result<()>
Load indices from disk (sequential fallback)
Sourcepub fn load_archives(&self) -> Result<()>
pub fn load_archives(&self) -> Result<()>
Load archive files
Sourcepub fn read_arc(&self, ekey: &EKey) -> Result<Arc<Vec<u8>>>
pub fn read_arc(&self, ekey: &EKey) -> Result<Arc<Vec<u8>>>
Read a file by its encoding key (zero-copy when cached)
Sourcepub fn read(&self, ekey: &EKey) -> Result<Vec<u8>>
pub fn read(&self, ekey: &EKey) -> Result<Vec<u8>>
Read a file by its encoding key (compatibility method, always clones)
Sourcepub fn write(&self, ekey: &EKey, data: &[u8]) -> Result<()>
pub fn write(&self, ekey: &EKey, data: &[u8]) -> Result<()>
Write a file with the given encoding key
Sourcepub fn rebuild_indices(&self) -> Result<()>
pub fn rebuild_indices(&self) -> Result<()>
Build indices from scratch by scanning archives
Sourcepub fn stats(&self) -> StorageStats
pub fn stats(&self) -> StorageStats
Get storage statistics
Sourcepub fn enumerate_files_vec(&self) -> Vec<(EKey, ArchiveLocation)>
pub fn enumerate_files_vec(&self) -> Vec<(EKey, ArchiveLocation)>
Enumerate all files in the storage Returns a vector of (EKey, ArchiveLocation) pairs
Sourcepub fn enumerate_files(
&self,
) -> impl Iterator<Item = (EKey, ArchiveLocation)> + '_
pub fn enumerate_files( &self, ) -> impl Iterator<Item = (EKey, ArchiveLocation)> + '_
Enumerate all files in the storage Returns an iterator over (EKey, ArchiveLocation) pairs
Sourcepub fn get_all_ekeys(&self) -> Vec<EKey>
pub fn get_all_ekeys(&self) -> Vec<EKey>
Get all EKeys in the storage
Sourcepub fn test_ekey_lookup(&self) -> Result<()>
pub fn test_ekey_lookup(&self) -> Result<()>
Test function to verify EKey lookup is working
Sourcepub fn files_per_archive(&self) -> HashMap<u16, usize>
pub fn files_per_archive(&self) -> HashMap<u16, usize>
Count files per archive
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the cache
Sourcepub fn init_tact_manifests(&mut self, config: ManifestConfig)
pub fn init_tact_manifests(&mut self, config: ManifestConfig)
Initialize TACT manifest support with configuration
Sourcepub fn load_encoding_manifest(&self, data: Vec<u8>) -> Result<()>
pub fn load_encoding_manifest(&self, data: Vec<u8>) -> Result<()>
Load encoding manifest from raw data
Sourcepub fn load_root_manifest_from_file(&self, path: &Path) -> Result<()>
pub fn load_root_manifest_from_file(&self, path: &Path) -> Result<()>
Load root manifest from file
Sourcepub fn load_encoding_manifest_from_file(&self, path: &Path) -> Result<()>
pub fn load_encoding_manifest_from_file(&self, path: &Path) -> Result<()>
Load encoding manifest from file
Sourcepub fn load_listfile(&self, path: &Path) -> Result<usize>
pub fn load_listfile(&self, path: &Path) -> Result<usize>
Load a community listfile for filename resolution
Sourcepub fn read_by_filename(&self, filename: &str) -> Result<Vec<u8>>
pub fn read_by_filename(&self, filename: &str) -> Result<Vec<u8>>
Read a file by filename (requires loaded listfile or root manifest)
Sourcepub fn get_fdid_for_filename(&self, filename: &str) -> Option<u32>
pub fn get_fdid_for_filename(&self, filename: &str) -> Option<u32>
Get FileDataID for a filename (if known)
Sourcepub fn get_all_fdids(&self) -> Result<Vec<u32>>
pub fn get_all_fdids(&self) -> Result<Vec<u32>>
Get all known FileDataIDs
Sourcepub fn tact_manifests_loaded(&self) -> bool
pub fn tact_manifests_loaded(&self) -> bool
Check if TACT manifests are loaded and ready
Sourcepub fn get_file_mapping(&self, fdid: u32) -> Result<FileMapping>
pub fn get_file_mapping(&self, fdid: u32) -> Result<FileMapping>
Get file mapping information for a FileDataID
Sourcepub fn clear_manifest_cache(&self)
pub fn clear_manifest_cache(&self)
Clear TACT manifest caches
Sourcepub async fn init_async_indices(&mut self) -> Result<()>
pub async fn init_async_indices(&mut self) -> Result<()>
Initialize async index manager for parallel operations
Sourcepub async fn lookup_async(&self, ekey: &EKey) -> Option<ArchiveLocation>
pub async fn lookup_async(&self, ekey: &EKey) -> Option<ArchiveLocation>
Perform async lookup using the async index manager
Sourcepub async fn lookup_batch_async(
&self,
ekeys: &[EKey],
) -> Vec<Option<ArchiveLocation>>
pub async fn lookup_batch_async( &self, ekeys: &[EKey], ) -> Vec<Option<ArchiveLocation>>
Batch lookup for multiple keys using async operations
Sourcepub async fn start_index_background_updates(&self, interval: Duration)
pub async fn start_index_background_updates(&self, interval: Duration)
Start background index updates with specified interval
Sourcepub async fn stop_index_background_updates(&self)
pub async fn stop_index_background_updates(&self)
Stop background index updates
Sourcepub async fn get_async_index_stats(&self) -> Option<AsyncIndexStats>
pub async fn get_async_index_stats(&self) -> Option<AsyncIndexStats>
Get async index statistics
Sourcepub async fn clear_async_index_cache(&self)
pub async fn clear_async_index_cache(&self)
Clear async index cache
Sourcepub fn init_progressive_loading(&mut self, config: ProgressiveConfig)
pub fn init_progressive_loading(&mut self, config: ProgressiveConfig)
Initialize progressive file loading with configuration
Sourcepub async fn read_progressive(
&self,
ekey: &EKey,
size_hint: SizeHint,
) -> Result<Arc<ProgressiveFile>>
pub async fn read_progressive( &self, ekey: &EKey, size_hint: SizeHint, ) -> Result<Arc<ProgressiveFile>>
Read a file progressively with size hints
Sourcepub async fn read_by_fdid_progressive(
&self,
fdid: u32,
) -> Result<Arc<ProgressiveFile>>
pub async fn read_by_fdid_progressive( &self, fdid: u32, ) -> Result<Arc<ProgressiveFile>>
Read a file by FileDataID progressively with size hints from manifest
Sourcepub fn get_size_hint_for_ekey(&self, ekey: &EKey) -> SizeHint
pub fn get_size_hint_for_ekey(&self, ekey: &EKey) -> SizeHint
Get size hint for an EKey from archive location
Sourcepub fn has_progressive_loading(&self) -> bool
pub fn has_progressive_loading(&self) -> bool
Check if progressive loading is available
Sourcepub async fn cleanup_progressive_files(&self)
pub async fn cleanup_progressive_files(&self)
Cleanup inactive progressive files
Sourcepub async fn get_progressive_stats(&self) -> Vec<(EKey, LoadingStats)>
pub async fn get_progressive_stats(&self) -> Vec<(EKey, LoadingStats)>
Get progressive loading statistics