Expand description
Migration utilities for transitioning from sync to async APIs
This module provides tools and helpers for migrating from the synchronous
MemoryGraph API to the asynchronous AsyncMemoryGraph API.
§Migration Strategies
§1. Gradual Migration (Recommended)
Start by identifying async boundaries in your application and migrate one component at a time:
// Old sync code
use llm_memory_graph::MemoryGraph;
fn process_sync() -> Result<(), Box<dyn std::error::Error>> {
let graph = MemoryGraph::open(Default::default())?;
let session = graph.create_session()?;
Ok(())
}
// New async code
use llm_memory_graph::AsyncMemoryGraph;
async fn process_async() -> Result<(), Box<dyn std::error::Error>> {
let graph = AsyncMemoryGraph::open(Default::default()).await?;
let session = graph.create_session().await?;
Ok(())
}§2. Parallel APIs
Both APIs can coexist during migration. The sync and async versions use the same storage format and are fully compatible.
§Data Compatibility
- Same storage format (Sled-based)
- No data migration required
- Can switch between sync and async at any time
- Node IDs and edge IDs are compatible
Structs§
- Checkpoint
Verification - Result of verifying a migration checkpoint
- Compatibility
Report - Report on database compatibility between sync and async APIs
- Migration
Checkpoint - Snapshot of database state for migration checkpoints
- Migration
Helper - Migration helper providing utilities for transitioning between sync and async APIs
- Migration
Test Report - Report from running a complete migration test