compressedStream returns a stream the input reader compressed using format, and a metadata map. The caller must close the returned reader. AFTER the stream is consumed, metadata will be updated with annotations to use on the data.
(reader io.Reader, algorithm compressiontypes.Algorithm)
| 424 | // The caller must close the returned reader. |
| 425 | // AFTER the stream is consumed, metadata will be updated with annotations to use on the data. |
| 426 | func (ic *imageCopier) compressedStream(reader io.Reader, algorithm compressiontypes.Algorithm) (io.ReadCloser, map[string]string) { |
| 427 | pipeReader, pipeWriter := io.Pipe() |
| 428 | annotations := map[string]string{} |
| 429 | // If this fails while writing data, it will do pipeWriter.CloseWithError(); if it fails otherwise, |
| 430 | // e.g. because we have exited and due to pipeReader.Close() above further writing to the pipe has failed, |
| 431 | // we don’t care. |
| 432 | go ic.compressGoroutine(pipeWriter, reader, annotations, algorithm) // Closes pipeWriter |
| 433 | return pipeReader, annotations |
| 434 | } |
no test coverage detected