feat: support summary for mc mirror (#4811)
This commit is contained in:
+14
-7
@@ -129,6 +129,10 @@ var (
|
||||
Name: "retry",
|
||||
Usage: "if specified, will enable retrying on a per object basis if errors occur",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "summary",
|
||||
Usage: "print a summary of the mirror session",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -461,13 +465,15 @@ func (mj *mirrorJob) doMirror(ctx context.Context, sURLs URLs) URLs {
|
||||
|
||||
sourcePath := filepath.ToSlash(filepath.Join(sourceAlias, sourceURL.Path))
|
||||
targetPath := filepath.ToSlash(filepath.Join(targetAlias, targetURL.Path))
|
||||
mj.status.PrintMsg(mirrorMessage{
|
||||
Source: sourcePath,
|
||||
Target: targetPath,
|
||||
Size: length,
|
||||
TotalCount: sURLs.TotalCount,
|
||||
TotalSize: sURLs.TotalSize,
|
||||
})
|
||||
if !mj.opts.isSummary {
|
||||
mj.status.PrintMsg(mirrorMessage{
|
||||
Source: sourcePath,
|
||||
Target: targetPath,
|
||||
Size: length,
|
||||
TotalCount: sURLs.TotalCount,
|
||||
TotalSize: sURLs.TotalSize,
|
||||
})
|
||||
}
|
||||
sURLs.MD5 = mj.opts.md5
|
||||
sURLs.DisableMultipart = mj.opts.disableMultipart
|
||||
|
||||
@@ -946,6 +952,7 @@ func runMirror(ctx context.Context, srcURL, dstURL string, cli *cli.Context, enc
|
||||
isOverwrite: isOverwrite,
|
||||
isWatch: isWatch,
|
||||
isMetadata: isMetadata,
|
||||
isSummary: cli.Bool("summary"),
|
||||
isRetriable: cli.Bool("retry"),
|
||||
md5: cli.Bool("md5"),
|
||||
disableMultipart: cli.Bool("disable-multipart"),
|
||||
|
||||
@@ -228,6 +228,7 @@ type mirrorOptions struct {
|
||||
isFake, isOverwrite, activeActive bool
|
||||
isWatch, isRemove, isMetadata bool
|
||||
isRetriable bool
|
||||
isSummary bool
|
||||
excludeOptions, excludeStorageClasses []string
|
||||
encKeyDB map[string][]prefixSSEPair
|
||||
md5, disableMultipart bool
|
||||
|
||||
Reference in New Issue
Block a user