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

Function newRemoteExportStorage

worker/export.go:506–537  ·  view source on GitHub ↗
(in *pb.ExportRequest, backupName string)

Source from the content-addressed store, hash-verified

504}
505
506func newRemoteExportStorage(in *pb.ExportRequest, backupName string) (*remoteExportStorage, error) {
507 tmpDir, err := os.MkdirTemp(x.WorkerConfig.TmpDir, "export")
508 if err != nil {
509 return nil, err
510 }
511 localStorage, err := newLocalExportStorage(tmpDir, backupName)
512 if err != nil {
513 return nil, err
514 }
515
516 uri, err := url.Parse(in.Destination)
517 if err != nil {
518 return nil, err
519 }
520
521 mc, err := x.NewMinioClient(uri, &x.MinioCredentials{
522 AccessKey: in.AccessKey,
523 SecretKey: in.SecretKey,
524 SessionToken: in.SessionToken,
525 Anonymous: in.Anonymous,
526 })
527 if err != nil {
528 return nil, err
529 }
530
531 bucket, prefix, err := mc.ValidateBucket(uri)
532 if err != nil {
533 return nil, err
534 }
535
536 return &remoteExportStorage{mc, bucket, prefix, localStorage}, nil
537}
538
539func (r *remoteExportStorage) OpenFile(fileName string) (*ExportWriter, error) {
540 return r.les.OpenFile(fileName)

Callers 1

NewExportStorageFunction · 0.85

Calls 4

ValidateBucketMethod · 0.95
NewMinioClientFunction · 0.92
newLocalExportStorageFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…