pub struct Storage { /* private fields */ }Expand description
Unified read-only CASC storage (local disk or CDN)
Storage is the primary entry point for reading CASC archives. Use open() for local disk, openOnline() for CDN-backed access. The same public read API works identically regardless of backing store.
All public methods are thread-safe: read operations acquire a shared lock.
Uses the PImpl (Pointer to Implementation) idiom to hide internals.
@see StorageWritable for write + persist operations.
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open(path: &str, pool: Option<&HostWorkerPool>) -> Option<Storage>
pub fn open(path: &str, pool: Option<&HostWorkerPool>) -> Option<Storage>
Open an existing local CASC storage. @param path Path to the game’s top-level directory (containing .build.info) or its Data subdirectory. @param pool Optional WorkerPool for parallel I/O (non-owning). @return A valid Storage, or std::nullopt on failure.
Sourcepub fn open_path_locale_mask_pool(
path: &str,
locale_mask: u32,
pool: Option<&HostWorkerPool>,
) -> Option<Storage>
pub fn open_path_locale_mask_pool( path: &str, locale_mask: u32, pool: Option<&HostWorkerPool>, ) -> Option<Storage>
@overload Open with locale mask.
Sourcepub fn open_path_product_pool(
path: &str,
product: &str,
pool: Option<&HostWorkerPool>,
) -> Option<Storage>
pub fn open_path_product_pool( path: &str, product: &str, pool: Option<&HostWorkerPool>, ) -> Option<Storage>
@overload Open a specific product from a multi-product .build.info. @param product Product code selecting the build, e.g. “w3” (Warcraft III retail) vs “w3t” (its PTR). Matched case-insensitively against the active builds; empty selects the first active build. See OpenOptions::product. Open fails if the product has no active build.
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
@return True if this storage has a write overlay (StorageWritable).
Sourcepub fn root_format(&self) -> RootFormat
pub fn root_format(&self) -> RootFormat
@return The root manifest format, or RootFormat::Unknown.
Sourcepub fn read_file(&self, casc_path: &str) -> Option<Bytes>
pub fn read_file(&self, casc_path: &str) -> Option<Bytes>
@return File contents, or std::nullopt if the path is not found.
Sourcepub fn read_file_casc_path_locale_flags_open_flags(
&self,
casc_path: &str,
locale_flags: u32,
open_flags: u32,
) -> Option<Bytes>
pub fn read_file_casc_path_locale_flags_open_flags( &self, casc_path: &str, locale_flags: u32, open_flags: u32, ) -> Option<Bytes>
@overload Read a file by path with locale and open flags.
Sourcepub fn read_file_file_id_hint(
&self,
file_id: i32,
hint: FileIdHint,
) -> Option<Bytes>
pub fn read_file_file_id_hint( &self, file_id: i32, hint: FileIdHint, ) -> Option<Bytes>
@overload Read a file by WoW-style FileDataId.
Sourcepub fn read_file_file_id_locale_flags_open_flags_hint(
&self,
file_id: i32,
locale_flags: u32,
open_flags: u32,
hint: FileIdHint,
) -> Option<Bytes>
pub fn read_file_file_id_locale_flags_open_flags_hint( &self, file_id: i32, locale_flags: u32, open_flags: u32, hint: FileIdHint, ) -> Option<Bytes>
@overload Read a file by FileDataId with locale and open flags.
Sourcepub fn file_exists(&self, casc_path: &str) -> bool
pub fn file_exists(&self, casc_path: &str) -> bool
@return True if the path resolves to a known file.
Sourcepub fn file_exists_file_id_hint(&self, file_id: i32, hint: FileIdHint) -> bool
pub fn file_exists_file_id_hint(&self, file_id: i32, hint: FileIdHint) -> bool
@overload Check existence by FileDataId.
Sourcepub fn file_size(&self, casc_path: &str) -> Option<u64>
pub fn file_size(&self, casc_path: &str) -> Option<u64>
@return Uncompressed file size, or std::nullopt if not found.
Sourcepub fn file_size_file_id_hint(
&self,
file_id: i32,
hint: FileIdHint,
) -> Option<u64>
pub fn file_size_file_id_hint( &self, file_id: i32, hint: FileIdHint, ) -> Option<u64>
@overload
Sourcepub fn list_files(&self) -> Vec<String>
pub fn list_files(&self) -> Vec<String>
@return All known file paths.
Sourcepub fn total_file_count(&self) -> Option<u32>
pub fn total_file_count(&self) -> Option<u32>
@return Total number of files in the root manifest.
Sourcepub fn import_keys_from_string(&mut self, key_list: &str) -> bool
pub fn import_keys_from_string(&mut self, key_list: &str) -> bool
Import encryption keys from a formatted string (one per line).
Sourcepub fn import_keys_from_file(&mut self, key_file_path: &str) -> bool
pub fn import_keys_from_file(&mut self, key_file_path: &str) -> bool
Import encryption keys from a file.
Sourcepub fn find_encryption_key(&self, key_name: u64) -> Option<[u8; 16]>
pub fn find_encryption_key(&self, key_name: u64) -> Option<[u8; 16]>
@return The encryption key for @p keyName, or std::nullopt if not found.
Sourcepub fn flush_cache(&mut self)
pub fn flush_cache(&mut self)
Clear the in-memory decoded-data cache (container cache).
Sourcepub fn prefetch(&mut self) -> bool
pub fn prefetch(&mut self) -> bool
Force every deferred load (encoding, root, VFS, index files, orphan bitvector) to resolve. Idempotent.
Sourcepub fn last_error() -> u32
pub fn last_error() -> u32
@return Last error code (thread-local).