MCPcopy Index your code
hub / github.com/kopia/kopia / detectRestoreMode

Method detectRestoreMode

cli/command_restore.go:317–339  ·  view source on GitHub ↗
(ctx context.Context, m, targetpath string)

Source from the content-addressed store, hash-verified

315}
316
317func (c *commandRestore) detectRestoreMode(ctx context.Context, m, targetpath string) string {
318 if m != "auto" {
319 return m
320 }
321
322 switch {
323 case strings.HasSuffix(targetpath, ".zip"):
324 log(ctx).Infof("Restoring to a zip file (%v)...", targetpath)
325 return restoreModeZip
326
327 case strings.HasSuffix(targetpath, ".tar"):
328 log(ctx).Infof("Restoring to an uncompressed tar file (%v)...", targetpath)
329 return restoreModeTar
330
331 case strings.HasSuffix(targetpath, ".tar.gz") || strings.HasSuffix(targetpath, ".tgz"):
332 log(ctx).Infof("Restoring to a tar+gzip file (%v)...", targetpath)
333 return restoreModeTgz
334
335 default:
336 log(ctx).Infof("Restoring to local filesystem (%v) with parallelism=%v...", targetpath, c.restoreParallel)
337 return restoreModeLocal
338 }
339}
340
341func printRestoreStats(ctx context.Context, st *restore.Stats) {
342 var maybeSkipped, maybeDeletedDirs, maybeDeletedFiles, maybeDeletedSymlinks, maybeErrors string

Callers 1

restoreOutputMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected