MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / FinishWriting

Method FinishWriting

worker/export.go:543–575  ·  view source on GitHub ↗
(w *Writers)

Source from the content-addressed store, hash-verified

541}
542
543func (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
577func NewExportStorage(in *pb.ExportRequest, backupName string) (ExportStorage, error) {
578 switch {

Callers

nothing calls this directly

Calls 4

InfofMethod · 0.80
RemoveAllMethod · 0.80
FinishWritingMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected