MCPcopy
hub / github.com/dgraph-io/dgraph / initExportBackup

Function initExportBackup

backup/run.go:391–421  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389}
390
391func initExportBackup() {
392 ExportBackup.Cmd = &cobra.Command{
393 Use: "export_backup",
394 Short: "Export data inside single full or incremental backup",
395 Long: ``,
396 Args: cobra.NoArgs,
397 Run: func(cmd *cobra.Command, args []string) {
398 defer x.StartProfile(ExportBackup.Conf).Stop()
399 if err := runExportBackup(); err != nil {
400 fmt.Fprintln(os.Stderr, err)
401 os.Exit(1)
402 }
403 },
404 Annotations: map[string]string{"group": "tool"},
405 }
406
407 ExportBackup.Cmd.SetHelpTemplate(x.NonRootTemplate)
408 flag := ExportBackup.Cmd.Flags()
409 flag.StringVarP(&opt.location, "location", "l", "",
410 `Sets the location of the backup. Both file URIs and s3 are supported.
411 This command will take care of all the full + incremental backups present in the location.`)
412 flag.StringVarP(&opt.destination, "destination", "d", "",
413 "The folder to which export the backups.")
414 flag.StringVarP(&opt.format, "format", "f", "rdf",
415 "The format of the export output. Accepts a value of either rdf or json")
416 flag.BoolVar(&opt.upgrade, "upgrade", false,
417 `If true, retrieve the CORS from DB and append at the end of GraphQL schema.
418 It also deletes the deprecated types and predicates.
419 Use this option when exporting a backup of 20.11 for loading onto 21.03.`)
420 x.RegisterEncFlag(flag)
421}
422
423type bufWriter struct {
424 writers *worker.Writers

Callers 1

initFunction · 0.85

Calls 4

StartProfileFunction · 0.92
RegisterEncFlagFunction · 0.92
runExportBackupFunction · 0.85
StopMethod · 0.65

Tested by

no test coverage detected