(w *Writers)
| 541 | } |
| 542 | |
| 543 | func (r *remoteExportStorage) FinishWriting(w *Writers) (ExportedFiles, error) { |
| 544 | defer func() { |
| 545 | glog.Infof("Deleting temporary export directory %s\n", r.les.destination) |
| 546 | if err := os.RemoveAll(r.les.destination); err != nil { |
| 547 | glog.Errorf("error deleting temporary export directory: %w", err) |
| 548 | } |
| 549 | }() |
| 550 | |
| 551 | files, err := r.les.FinishWriting(w) |
| 552 | if err != nil { |
| 553 | return nil, err |
| 554 | } |
| 555 | |
| 556 | for _, f := range files { |
| 557 | var d string |
| 558 | if r.prefix == "" { |
| 559 | d = f |
| 560 | } else { |
| 561 | d = r.prefix + "/" + f |
| 562 | } |
| 563 | filePath := filepath.Join(r.les.destination, f) |
| 564 | // FIXME: tejas [06/2020] - We could probably stream these results, but it's easier to copy for now |
| 565 | glog.Infof("Uploading from %s to %s\n", filePath, d) |
| 566 | _, err := r.mc.FPutObject(context.Background(), r.bucket, d, filePath, minio.PutObjectOptions{ |
| 567 | ContentType: "application/gzip", |
| 568 | }) |
| 569 | if err != nil { |
| 570 | return nil, err |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | return files, nil |
| 575 | } |
| 576 | |
| 577 | func NewExportStorage(in *pb.ExportRequest, backupName string) (ExportStorage, error) { |
| 578 | switch { |
nothing calls this directly
no test coverage detected