(line string, engine *agent.QueryEngine, backend luminaui.RendererBackend)
| 322 | if *dryRun { |
| 323 | return writeJSON(os.Stdout, memory.FabricMigrationReport{MigrationID: "memory-" + snapshot.Checksum[:16], |
| 324 | TenantID: identity.TenantID, ProjectID: identity.ProjectID, Space: snapshot.Space, |
| 325 | Events: len(snapshot.Events), Identities: len(snapshot.Identities), Nodes: len(snapshot.Nodes), Conflicts: len(snapshot.Conflicts), |
| 326 | Resolutions: len(snapshot.Resolutions), Checksum: snapshot.Checksum, DryRun: true, Status: "validated"}) |
| 327 | } |
| 328 | targetConfig := cfg |
| 329 | targetConfig.MemoryFabricStore = "postgres" |
| 330 | targetConfig.RedisURL = "" |
| 331 | target, err := factory.Open(ctx, targetConfig, agent.MemoryOpenOptions{Identity: identity}) |
| 332 | if err != nil { |
| 333 | return err |
| 334 | } |
| 335 | defer target.Close() |
| 336 | importer, ok := target.(memory.DurableSnapshotImporter) |
| 337 | if !ok { |
| 338 | return fmt.Errorf("PostgreSQL Memory Fabric does not support durable import") |
| 339 | } |
| 340 | report, err := importer.ImportDurableSnapshot(ctx, snapshot, "memory-"+snapshot.Checksum[:16], false) |
| 341 | if err != nil { |
| 342 | return err |
| 343 | } |
| 344 | if err := target.Flush(ctx); err != nil { |
| 345 | return err |
| 346 | } |
| 347 | verified, err := target.(memory.DurableSnapshotExporter).ExportDurableSnapshot(ctx, snapshot.Space) |
| 348 | if err != nil { |
| 349 | return err |
| 350 | } |
| 351 | if verified.Checksum != snapshot.Checksum { |
| 352 | return fmt.Errorf("Memory Fabric migration checksum mismatch: source=%s target=%s", |
| 353 | snapshot.Checksum, verified.Checksum) |
| 354 | } |
| 355 | if _, err := target.Doctor(ctx); err != nil { |
| 356 | return err |
| 357 | } |
no test coverage detected