pub struct StorageWritable { /* private fields */ }Expand description
Writable CASC storage (read + write + save)
Inherits all read operations from Storage. Adds write overlay and persist-to-disk support.
Only local-backed storages can be writable (CDN is read-only).
extends=whiteout::storages::casc::Storage
Implementations§
Source§impl StorageWritable
impl StorageWritable
Sourcepub fn create(
opts: &CreateOptions,
pool: Option<&HostWorkerPool>,
) -> Option<StorageWritable>
pub fn create( opts: &CreateOptions, pool: Option<&HostWorkerPool>, ) -> Option<StorageWritable>
Create a new empty storage in memory.
No file is written to disk until save() is called.
@param opts Creation options (product name, version, root format). @param pool Optional WorkerPool for parallel I/O. @return A valid empty StorageWritable ready for writeFile() calls.
Sourcepub fn reserve_file_id(&mut self, name: &str) -> Option<u32>
pub fn reserve_file_id(&mut self, name: &str) -> Option<u32>
Reserve a file-data-ID for a named asset.
Allocates the next available file-data-ID and associates it with @p name. The interpretation of @p name depends on the root format:
- WoW / WoWTvfs: @p name is a full CASC path (e.g.
"Base\\creatures\\beast\\beast.m2"). - Diablo 3 / Diablo 4 / TVFS: @p name is"asset_name.ext", where the extension determines the SNO group. A CoreTOC entry is created automatically.
Returns @c std::nullopt if the name already exists in the root or in a previous reservation.
@code auto id = storage.reserveFileId(“my_beast.app”); if (id) storage.writeFile(*id, data); @endcode
Sourcepub fn write_file(
&mut self,
path: &str,
data: &[u8],
opts: &WriteOptions,
) -> bool
pub fn write_file( &mut self, path: &str, data: &[u8], opts: &WriteOptions, ) -> bool
Write a file by path.
Data is stored in an in-memory overlay until save() is called.
@param path CASC path for the new or updated file. @param data File contents. @param opts Write options (locale, content flags, compression). @return True on success.
Sourcepub fn write_file_file_id_data_opts_hint(
&mut self,
file_id: i32,
data: &[u8],
opts: &WriteOptions,
hint: FileIdHint,
) -> bool
pub fn write_file_file_id_data_opts_hint( &mut self, file_id: i32, data: &[u8], opts: &WriteOptions, hint: FileIdHint, ) -> bool
@overload Write a file by FileDataId.
Sourcepub fn delete_file(&mut self, path: &str) -> bool
pub fn delete_file(&mut self, path: &str) -> bool
Mark a file for deletion (effective on next save).
Sourcepub fn delete_file_file_id_hint(
&mut self,
file_id: i32,
hint: FileIdHint,
) -> bool
pub fn delete_file_file_id_hint( &mut self, file_id: i32, hint: FileIdHint, ) -> bool
@overload