| 41 | } |
| 42 | |
| 43 | func Import(ctx context.Context, connectionString string, bulkOutDir string) error { |
| 44 | if bulkOutDir == "" { |
| 45 | return fmt.Errorf("bulk output directory cannot be empty") |
| 46 | } |
| 47 | |
| 48 | dg, err := newClient(connectionString) |
| 49 | if err != nil { |
| 50 | return err |
| 51 | } |
| 52 | resp, err := initiateSnapshotStream(ctx, dg) |
| 53 | if err != nil { |
| 54 | return err |
| 55 | } |
| 56 | |
| 57 | return streamSnapshot(ctx, dg, bulkOutDir, resp.Groups) |
| 58 | } |
| 59 | |
| 60 | // isRetryableError returns true for transient errors that may resolve after a brief wait, |
| 61 | // such as Raft proposal backlogs during membership changes. |