From 00fdfa063610a480cddf15e3cf6151731cf8db51 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 20 Apr 2023 13:29:07 +0200 Subject: [PATCH] rename ImagePushReport to ImagePushStream The Report will be used in a future change as a new return value for the internal Push API. Note: this change is only breaking internal APIs while user-facing external ones remain unchanges. Signed-off-by: Valentin Rothberg --- pkg/api/handlers/libpod/images_push.go | 10 +++++----- pkg/bindings/images/push.go | 2 +- pkg/domain/entities/images.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/api/handlers/libpod/images_push.go b/pkg/api/handlers/libpod/images_push.go index 4102f23de1..bd907a4458 100644 --- a/pkg/api/handlers/libpod/images_push.go +++ b/pkg/api/handlers/libpod/images_push.go @@ -122,18 +122,18 @@ func PushImage(w http.ResponseWriter, r *http.Request) { enc := json.NewEncoder(w) enc.SetEscapeHTML(true) for { - var report entities.ImagePushReport + var stream entities.ImagePushStream select { case s := <-writer.Chan(): - report.Stream = string(s) - if err := enc.Encode(report); err != nil { + stream.Stream = string(s) + if err := enc.Encode(stream); err != nil { logrus.Warnf("Failed to encode json: %v", err) } flush() case <-pushCtx.Done(): if pushError != nil { - report.Error = pushError.Error() - if err := enc.Encode(report); err != nil { + stream.Error = pushError.Error() + if err := enc.Encode(stream); err != nil { logrus.Warnf("Failed to encode json: %v", err) } } diff --git a/pkg/bindings/images/push.go b/pkg/bindings/images/push.go index c04ffbf904..dae5da2b5f 100644 --- a/pkg/bindings/images/push.go +++ b/pkg/bindings/images/push.go @@ -69,7 +69,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO dec := json.NewDecoder(response.Body) LOOP: for { - var report entities.ImagePushReport + var report entities.ImagePushStream if err := dec.Decode(&report); err != nil { if errors.Is(err, io.EOF) { break diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 7232df5e39..f56cf15b44 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -247,9 +247,9 @@ type ImagePushOptions struct { OciEncryptLayers *[]int } -// ImagePushReport is the response from pushing an image. -// Currently only used in the remote API. -type ImagePushReport struct { +// ImagePushStream is the response from pushing an image. Only used in the +// remote API. +type ImagePushStream struct { // Stream used to provide push progress Stream string `json:"stream,omitempty"` // Error contains text of errors from pushing