vitess: github.com/youtube/vitess/go/cgzip Index | Files

package cgzip

import "github.com/youtube/vitess/go/cgzip"

Package cgzip wraps the C library for gzip.

Index

Package Files

adler32.go crc32.go doc.go reader.go writer.go zstream.go

Constants

const (
    // Allowed flush values
    Z_NO_FLUSH      = 0
    Z_PARTIAL_FLUSH = 1
    Z_SYNC_FLUSH    = 2
    Z_FULL_FLUSH    = 3
    Z_FINISH        = 4
    Z_BLOCK         = 5
    Z_TREES         = 6

    // Return codes
    Z_OK            = 0
    Z_STREAM_END    = 1
    Z_NEED_DICT     = 2
    Z_ERRNO         = -1
    Z_STREAM_ERROR  = -2
    Z_DATA_ERROR    = -3
    Z_MEM_ERROR     = -4
    Z_BUF_ERROR     = -5
    Z_VERSION_ERROR = -6

    // compression levels
    Z_NO_COMPRESSION      = 0
    Z_BEST_SPEED          = 1
    Z_BEST_COMPRESSION    = 9
    Z_DEFAULT_COMPRESSION = -1

    // our default buffer size
    // most go io functions use 32KB as buffer size, so 32KB
    // works well here for compressed data buffer
    DEFAULT_COMPRESSED_BUFFER_SIZE = 32 * 1024
)

func Adler32Combine Uses

func Adler32Combine(adler1, adler2 uint32, len2 int) uint32

helper method for partial checksums. From the zlib.h header:

Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1

and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.

func Crc32Combine Uses

func Crc32Combine(crc1, crc2 uint32, len2 int) uint32

helper method for partial checksums. From the zlib.h header:

Combine two CRC-32 checksums into one.  For two sequences of bytes, seq1

and seq2 with lengths len1 and len2, CRC-32 checksums were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 checksum of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2.

func NewAdler32 Uses

func NewAdler32() hash.Hash32

an empty buffer has an adler32 of '1' by default, so start with that (the go hash/adler32 does the same)

func NewCrc32 Uses

func NewCrc32() hash.Hash32

an empty buffer has an crc32 of '1' by default, so start with that (the go hash/crc32 does the same)

func NewReader Uses

func NewReader(r io.Reader) (io.ReadCloser, error)

func NewReaderBuffer Uses

func NewReaderBuffer(r io.Reader, bufferSize int) (io.ReadCloser, error)

type Writer Uses

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

err starts out as nil we will call deflateEnd when we set err to a value: - whatever error is returned by the underlying writer - io.EOF if Close was called

func NewWriter Uses

func NewWriter(w io.Writer) *Writer

func NewWriterLevel Uses

func NewWriterLevel(w io.Writer, level int) (*Writer, error)

func NewWriterLevelBuffer Uses

func NewWriterLevelBuffer(w io.Writer, level, bufferSize int) (*Writer, error)

func (*Writer) Close Uses

func (z *Writer) Close() error

Calling Close does not close the wrapped io.Writer originally passed to NewWriterX.

func (*Writer) Flush Uses

func (z *Writer) Flush() error

func (*Writer) Write Uses

func (z *Writer) Write(p []byte) (n int, err error)

Package cgzip imports 5 packages (graph) and is imported by 3 packages. Updated 2017-05-08. Refresh now. Tools for package owners.