mirror of
https://github.com/containers/podman.git
synced 2025-06-27 13:38:49 +08:00
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 <vrothberg@redhat.com>
This commit is contained in:
@ -122,18 +122,18 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
|||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
enc.SetEscapeHTML(true)
|
enc.SetEscapeHTML(true)
|
||||||
for {
|
for {
|
||||||
var report entities.ImagePushReport
|
var stream entities.ImagePushStream
|
||||||
select {
|
select {
|
||||||
case s := <-writer.Chan():
|
case s := <-writer.Chan():
|
||||||
report.Stream = string(s)
|
stream.Stream = string(s)
|
||||||
if err := enc.Encode(report); err != nil {
|
if err := enc.Encode(stream); err != nil {
|
||||||
logrus.Warnf("Failed to encode json: %v", err)
|
logrus.Warnf("Failed to encode json: %v", err)
|
||||||
}
|
}
|
||||||
flush()
|
flush()
|
||||||
case <-pushCtx.Done():
|
case <-pushCtx.Done():
|
||||||
if pushError != nil {
|
if pushError != nil {
|
||||||
report.Error = pushError.Error()
|
stream.Error = pushError.Error()
|
||||||
if err := enc.Encode(report); err != nil {
|
if err := enc.Encode(stream); err != nil {
|
||||||
logrus.Warnf("Failed to encode json: %v", err)
|
logrus.Warnf("Failed to encode json: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO
|
|||||||
dec := json.NewDecoder(response.Body)
|
dec := json.NewDecoder(response.Body)
|
||||||
LOOP:
|
LOOP:
|
||||||
for {
|
for {
|
||||||
var report entities.ImagePushReport
|
var report entities.ImagePushStream
|
||||||
if err := dec.Decode(&report); err != nil {
|
if err := dec.Decode(&report); err != nil {
|
||||||
if errors.Is(err, io.EOF) {
|
if errors.Is(err, io.EOF) {
|
||||||
break
|
break
|
||||||
|
@ -247,9 +247,9 @@ type ImagePushOptions struct {
|
|||||||
OciEncryptLayers *[]int
|
OciEncryptLayers *[]int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImagePushReport is the response from pushing an image.
|
// ImagePushStream is the response from pushing an image. Only used in the
|
||||||
// Currently only used in the remote API.
|
// remote API.
|
||||||
type ImagePushReport struct {
|
type ImagePushStream struct {
|
||||||
// Stream used to provide push progress
|
// Stream used to provide push progress
|
||||||
Stream string `json:"stream,omitempty"`
|
Stream string `json:"stream,omitempty"`
|
||||||
// Error contains text of errors from pushing
|
// Error contains text of errors from pushing
|
||||||
|
Reference in New Issue
Block a user