feat: support summary for mc mirror (#4811)

This commit is contained in:
jiuker
2024-01-02 10:12:43 -08:00
committed by GitHub
parent 5386533bb9
commit 370b7483b1
2 changed files with 15 additions and 7 deletions
+14 -7
View File
@@ -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"),
+1
View File
@@ -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