remotes/ctr: allow to limit max concurrent uploads like downloads
Also add flags for push/pull subcommand to limit max concurrent uploads/downloads. Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
@@ -109,7 +109,7 @@ type FetchConfig struct {
|
||||
Platforms []string
|
||||
// Whether or not download all metadata
|
||||
AllMetadata bool
|
||||
// RemoteOpts is not used by ctr, but can be used by other CLI tools
|
||||
// RemoteOpts to configure object resolutions and transfers with remote content providers
|
||||
RemoteOpts []containerd.RemoteOpt
|
||||
// TraceHTTP writes DNS and connection information to the log when dealing with a container registry
|
||||
TraceHTTP bool
|
||||
@@ -145,6 +145,16 @@ func NewFetchConfig(ctx context.Context, clicontext *cli.Context) (*FetchConfig,
|
||||
config.AllMetadata = true
|
||||
}
|
||||
|
||||
if clicontext.IsSet("max-concurrent-downloads") {
|
||||
mcd := clicontext.Int("max-concurrent-downloads")
|
||||
config.RemoteOpts = append(config.RemoteOpts, containerd.WithMaxConcurrentDownloads(mcd))
|
||||
}
|
||||
|
||||
if clicontext.IsSet("max-concurrent-uploaded-layers") {
|
||||
mcu := clicontext.Int("max-concurrent-uploaded-layers")
|
||||
config.RemoteOpts = append(config.RemoteOpts, containerd.WithMaxConcurrentUploadedLayers(mcu))
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user