Bump github.com/containers/storage from 1.14.0 to 1.15.1

Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.14.0 to 1.15.1.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.14.0...v1.15.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
This commit is contained in:
dependabot-preview[bot]
2019-11-29 09:16:44 +00:00
committed by Daniel J Walsh
parent 73248bd639
commit 04bc64f593
162 changed files with 43129 additions and 37580 deletions

View File

@@ -3,6 +3,7 @@ package flate
import (
"io"
"math"
"sync"
)
const (
@@ -49,11 +50,24 @@ func NewStatelessWriter(dst io.Writer) io.WriteCloser {
return &statelessWriter{dst: dst}
}
// bitWriterPool contains bit writers that can be reused.
var bitWriterPool = sync.Pool{
New: func() interface{} {
return newHuffmanBitWriter(nil)
},
}
// StatelessDeflate allows to compress directly to a Writer without retaining state.
// When returning everything will be flushed.
func StatelessDeflate(out io.Writer, in []byte, eof bool) error {
var dst tokens
bw := newHuffmanBitWriter(out)
bw := bitWriterPool.Get().(*huffmanBitWriter)
bw.reset(out)
defer func() {
// don't keep a reference to our output
bw.reset(nil)
bitWriterPool.Put(bw)
}()
if eof && len(in) == 0 {
// Just write an EOF block.
// Could be faster...