mirror of
https://github.com/containers/podman.git
synced 2025-06-27 05:26:50 +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.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)
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user