pub struct MigrationHelper;Expand description
Migration helper providing utilities for transitioning between sync and async APIs
Implementations§
Source§impl MigrationHelper
impl MigrationHelper
Sourcepub async fn verify_compatibility(
config: &Config,
) -> Result<CompatibilityReport>
pub async fn verify_compatibility( config: &Config, ) -> Result<CompatibilityReport>
Verify that a database is compatible with both sync and async APIs
This function checks that:
- The database can be opened with sync API
- The database can be opened with async API
- Both APIs can read the same data
§Examples
use llm_memory_graph::{Config, migration::MigrationHelper};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::new("./data/graph.db");
MigrationHelper::verify_compatibility(&config).await?;
println!("Database is compatible!");
Ok(())
}Sourcepub async fn create_checkpoint(config: &Config) -> Result<MigrationCheckpoint>
pub async fn create_checkpoint(config: &Config) -> Result<MigrationCheckpoint>
Create a migration checkpoint that can be used to rollback if needed
This function creates a snapshot of database statistics that can be compared later to detect any issues during migration.
§Examples
use llm_memory_graph::{Config, migration::MigrationHelper};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::new("./data/graph.db");
let checkpoint = MigrationHelper::create_checkpoint(&config).await?;
println!("Checkpoint: {} nodes, {} edges",
checkpoint.node_count, checkpoint.edge_count);
Ok(())
}Sourcepub async fn verify_checkpoint(
config: &Config,
checkpoint: &MigrationCheckpoint,
) -> Result<CheckpointVerification>
pub async fn verify_checkpoint( config: &Config, checkpoint: &MigrationCheckpoint, ) -> Result<CheckpointVerification>
Verify that a database hasn’t been corrupted after migration
Compares current state against a checkpoint created before migration.
§Examples
use llm_memory_graph::{Config, migration::MigrationHelper};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::new("./data/graph.db");
let before = MigrationHelper::create_checkpoint(&config).await?;
// ... perform migration ...
let result = MigrationHelper::verify_checkpoint(&config, &before).await?;
assert!(result.valid, "Migration corrupted data!");
Ok(())
}Sourcepub async fn run_migration_test(config: &Config) -> Result<MigrationTestReport>
pub async fn run_migration_test(config: &Config) -> Result<MigrationTestReport>
Run a test migration workflow to validate the migration process
This performs a complete migration test:
- Creates a checkpoint
- Tests sync API access
- Tests async API access
- Verifies data integrity
§Examples
use llm_memory_graph::{Config, migration::MigrationHelper};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::new("./data/graph.db");
let report = MigrationHelper::run_migration_test(&config).await?;
println!("Migration test: {}", if report.success { "PASSED" } else { "FAILED" });
Ok(())
}Auto Trait Implementations§
impl Freeze for MigrationHelper
impl RefUnwindSafe for MigrationHelper
impl Send for MigrationHelper
impl Sync for MigrationHelper
impl Unpin for MigrationHelper
impl UnsafeUnpin for MigrationHelper
impl UnwindSafe for MigrationHelper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more