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:
@@ -64,6 +64,9 @@ var pushCommand = cli.Command{
|
||||
Name: "platform",
|
||||
Usage: "push content from a specific platform",
|
||||
Value: &cli.StringSlice{},
|
||||
}, cli.IntFlag{
|
||||
Name: "max-concurrent-uploaded-layers",
|
||||
Usage: "Set the max concurrent uploaded layers for each push",
|
||||
}),
|
||||
Action: func(context *cli.Context) error {
|
||||
var (
|
||||
@@ -144,10 +147,17 @@ var pushCommand = cli.Command{
|
||||
return nil, nil
|
||||
})
|
||||
|
||||
return client.Push(ctx, ref, desc,
|
||||
ropts := []containerd.RemoteOpt{
|
||||
containerd.WithResolver(resolver),
|
||||
containerd.WithImageHandler(jobHandler),
|
||||
)
|
||||
}
|
||||
|
||||
if context.IsSet("max-concurrent-uploaded-layers") {
|
||||
mcu := context.Int("max-concurrent-uploaded-layers")
|
||||
ropts = append(ropts, containerd.WithMaxConcurrentUploadedLayers(mcu))
|
||||
}
|
||||
|
||||
return client.Push(ctx, ref, desc, ropts...)
|
||||
})
|
||||
|
||||
// don't show progress if debug mode is set
|
||||
|
Reference in New Issue
Block a user