Skip to content

Commit

Permalink
rename ImagePushReport to ImagePushStream
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vrothberg committed Apr 20, 2023
1 parent 85d383b commit 00fdfa0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/api/handlers/libpod/images_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/domain/entities/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00fdfa0

Please sign in to comment.