block-db 0.2.0

Local, multi-threaded, durable byte DB.
Documentation
// Authors: Robert Lopez

use super::{error::Error, util::fs::delete_directory, BlockDB, ConfirmDestructiveAction};

impl BlockDB {
    /// ⚠️ **DELETES the `BlockDB` and _all_ of its data. This action is irreversible.**
    ///
    /// Requires explicitly passing `ConfirmDestructiveAction::IKnowWhatImDoing`
    /// to confirm intent.
    ///
    /// Use with extreme caution. This will remove all `DataFile`s, metadata,
    /// WALs, and configuration associated with the database.
    ///
    /// ---
    /// - **Atomic**
    /// - **Non-corruptible**
    ///
    /// ---
    /// Example
    /// ```
    /// let block_db = BlockDB::open("./data", None).await?;
    ///
    /// block_db.delete(ConfirmDestructiveAction::IKnowWhatImDoing).await?;
    /// ```
    pub async fn delete(self, _: ConfirmDestructiveAction) -> Result<(), Error> {
        delete_directory(&self.path).await?;

        Ok(())
    }
}