archive

package
Version: v0.0.0-...-9e6982f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Extracted from github.com/docker/docker/pkg/archive

Extracted from github.com/docker/docker/pkg/pools

Index

Constants

This section is empty.

Variables

View Source
var (
	// BufioReader32KPool is a pool which returns bufio.Reader with a 32K buffer.
	BufioReader32KPool = newBufioReaderPoolWithSize(buffer32K)
)

Functions

func DecompressStream

func DecompressStream(archive io.Reader) (io.ReadCloser, error)

DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.

func NewReadCloserWrapper

func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser

NewReadCloserWrapper returns a new io.ReadCloser.

Types

type BufioReaderPool

type BufioReaderPool struct {
	// contains filtered or unexported fields
}

BufioReaderPool is a bufio reader that uses sync.Pool.

func (*BufioReaderPool) Get

func (bufPool *BufioReaderPool) Get(r io.Reader) *bufio.Reader

Get returns a bufio.Reader which reads from r. The buffer size is that of the pool.

func (*BufioReaderPool) NewReadCloserWrapper

func (bufPool *BufioReaderPool) NewReadCloserWrapper(buf *bufio.Reader, r io.Reader) io.ReadCloser

NewReadCloserWrapper returns a wrapper which puts the bufio.Reader back into the pool and closes the reader if it's an io.ReadCloser.

func (*BufioReaderPool) Put

func (bufPool *BufioReaderPool) Put(b *bufio.Reader)

Put puts the bufio.Reader back into the pool.

type Compression

type Compression int
const (
	// Uncompressed represents the uncompressed.
	Uncompressed Compression = iota
	// Bzip2 is bzip2 compression algorithm.
	Bzip2
	// Gzip is gzip compression algorithm.
	Gzip
	// Xz is xz compression algorithm.
	Xz
)

func DetectCompression

func DetectCompression(source []byte) Compression

DetectCompression detects the compression algorithm of the source.

func (*Compression) Extension

func (compression *Compression) Extension() string

Extension returns the extension of a file that uses the specified compression algorithm.

type ReadCloserWrapper

type ReadCloserWrapper struct {
	io.Reader
	// contains filtered or unexported fields
}

ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser It calls the given callback function when closed. It should be constructed with NewReadCloserWrapper

func (*ReadCloserWrapper) Close

func (r *ReadCloserWrapper) Close() error

Close calls back the passed closer function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL