clear_database_storage

Function clear_database_storage 

Source
pub async fn clear_database_storage(db_name: &str) -> Result<(), DatabaseError>
Expand description

Clear all storage data for a specific database

Removes all blocks, metadata, commit markers, and allocation maps for the specified database from global storage. This is a destructive operation used primarily before importing a new database.

§Arguments

  • db_name - Name of the database to clear

§Returns

  • Ok(()) - Storage cleared successfully
  • Err(DatabaseError) - If clearing fails

§Safety

This operation clears data from global storage but does not affect:

  • Open database connections (they may still reference cleared data)
  • IndexedDB persistence (for WASM, requires separate clearing)

§Example

use absurder_sql::storage::import::clear_database_storage;

// Clear all data for "mydb"
clear_database_storage("mydb").await?;