pub async fn export_database_with_options(
storage: &mut BlockStorage,
options: ExportOptions,
) -> Result<Vec<u8>, DatabaseError>Expand description
Export database with advanced options (streaming, progress callbacks)
For large databases (>100MB), this function processes blocks in chunks, yields to the event loop between chunks, and reports progress.
§Arguments
storage- Block storage containing the databaseoptions- Export configuration (size limits, chunk size, progress callback)
§Returns
Complete database as bytes
§Example
use absurder_sql::storage::export::{export_database_with_options, ExportOptions};
use absurder_sql::storage::BlockStorage;
async fn export_with_progress(mut storage: BlockStorage) -> Result<Vec<u8>, absurder_sql::types::DatabaseError> {
let options = ExportOptions {
max_size_bytes: Some(1024 * 1024 * 1024), // 1GB limit
chunk_size_bytes: Some(10 * 1024 * 1024), // 10MB chunks
progress_callback: Some(Box::new(|exported, total| {
println!("Progress: {}/{} bytes ({:.1}%)",
exported, total, (exported as f64 / total as f64) * 100.0);
})),
};
export_database_with_options(&mut storage, options).await
}