Add a quite flat to image load for adding progress bar to load

Signed-off-by: Lei Jitang <leijitang@huawei.com>
This commit is contained in:
Lei Jitang 2016-02-03 21:04:55 -05:00
Родитель 8e06f43466
Коммит 8734fd79cb
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -12,8 +12,13 @@ import (
// ImageLoad loads an image in the docker host from the client host.
// It's up to the caller to close the io.ReadCloser returned by
// this function.
func (cli *Client) ImageLoad(ctx context.Context, input io.Reader) (types.ImageLoadResponse, error) {
resp, err := cli.postRaw(ctx, "/images/load", url.Values{}, input, nil)
func (cli *Client) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error) {
v := url.Values{}
v.Set("quiet", "0")
if quiet {
v.Set("quiet", "1")
}
resp, err := cli.postRaw(ctx, "/images/load", v, input, nil)
if err != nil {
return types.ImageLoadResponse{}, err
}

Просмотреть файл

@ -52,7 +52,7 @@ type APIClient interface {
ImageImport(ctx context.Context, options types.ImageImportOptions) (io.ReadCloser, error)
ImageInspectWithRaw(imageID string, getSize bool) (types.ImageInspect, []byte, error)
ImageList(options types.ImageListOptions) ([]types.Image, error)
ImageLoad(ctx context.Context, input io.Reader) (types.ImageLoadResponse, error)
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
ImagePull(ctx context.Context, options types.ImagePullOptions, privilegeFunc RequestPrivilegeFunc) (io.ReadCloser, error)
ImagePush(ctx context.Context, options types.ImagePushOptions, privilegeFunc RequestPrivilegeFunc) (io.ReadCloser, error)
ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error)