( ctx context.Context, client ctrl.Client, instance *Instance, cluster *apiv1.Cluster, )
| 570 | } |
| 571 | |
| 572 | func executeLogicalImport( |
| 573 | ctx context.Context, |
| 574 | client ctrl.Client, |
| 575 | instance *Instance, |
| 576 | cluster *apiv1.Cluster, |
| 577 | ) error { |
| 578 | destinationPool := instance.ConnectionPool() |
| 579 | defer destinationPool.ShutdownConnections() |
| 580 | |
| 581 | originPool, err := getConnectionPoolerForExternalCluster(ctx, cluster, client, cluster.Namespace) |
| 582 | if err != nil { |
| 583 | return err |
| 584 | } |
| 585 | defer originPool.ShutdownConnections() |
| 586 | |
| 587 | cloneType := cluster.Spec.Bootstrap.InitDB.Import.Type |
| 588 | switch cloneType { |
| 589 | case apiv1.MicroserviceSnapshotType: |
| 590 | return logicalimport.Microservice(ctx, cluster, destinationPool, originPool) |
| 591 | case apiv1.MonolithSnapshotType: |
| 592 | return logicalimport.Monolith(ctx, cluster, destinationPool, originPool) |
| 593 | default: |
| 594 | return fmt.Errorf("unrecognized clone type %s", cloneType) |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | func getConnectionPoolerForExternalCluster( |
| 599 | ctx context.Context, |
no test coverage detected