MCPcopy Create free account
hub / github.com/containers/image / compressedStream

Method compressedStream

copy/compression.go:426–434  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
426func (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}

Callers 2

Calls 1

compressGoroutineMethod · 0.95

Tested by

no test coverage detected