pub async fn delete_instance(pool: &Pool<MySql>, id: i64) -> Result<()>
Expand description
Deletes a specific instance from the database.
This function permanently removes an instance record from the database. It’s typically used for cleanup operations after an instance has been terminated, or to remove invalid instances.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the instance to delete
§Returns
Ok(())
- Successfully deleted the instanceErr(anyhow::Error)
- Failed to delete the instance
§Warning
This operation is irreversible and should generally only be performed after ensuring that the actual compute resource has been properly terminated. Otherwise, resource leaks may occur.
§Transaction Handling
This function uses a database transaction to ensure atomicity of the operation. If any part of the operation fails, the entire operation is rolled back.