v2

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DataHeaderLength = 0

DataHeaderLength is the length in bytes for the data header

View Source
const IndexHeaderLength = int(uint64Size) // 64bit checksum (xxhash)

IndexHeaderLength is the length in bytes for the record header

Variables

View Source
var (
	// Gzip is the gnu zip compression pool
	Gzip = GzipPool{/* contains filtered or unexported fields */}
	// Lz4_64k is the l4z compression pool, with 64k buffer size
	Lz4_64k = LZ4Pool{/* contains filtered or unexported fields */}
	// Lz4_256k uses 256k buffer
	Lz4_256k = LZ4Pool{/* contains filtered or unexported fields */}
	// Lz4_1M uses 1M buffer
	Lz4_1M = LZ4Pool{/* contains filtered or unexported fields */}
	// Lz4_4M uses 4M buffer
	Lz4_4M = LZ4Pool{/* contains filtered or unexported fields */}
	// Snappy is the snappy compression pool
	Snappy SnappyPool
	// Noop is the no compression pool
	Noop NoopPool
	// Zstd Pool
	Zstd = ZstdPool{}
	// S2 Pool
	S2 = S2Pool{}

	// BytesBufferPool is a bytes buffer used for lines decompressed.
	// Buckets [0.5KB,1KB,2KB,4KB,8KB]
	BytesBufferPool = pool.New(1<<9, 1<<13, 2, func(size int) interface{} { return make([]byte, 0, size) })
)

Functions

func NewDataReader

func NewDataReader(r backend.ContextReader, encoding backend.Encoding) (common.DataReader, error)

NewDataReader constructs a v2 DataReader that handles paged...reading

func NewDataWriter

func NewDataWriter(writer io.Writer, encoding backend.Encoding) (common.DataWriter, error)

NewDataWriter creates a paged page writer

func NewIndexReader

func NewIndexReader(r backend.ContextReader, pageSizeBytes int, totalRecords int) (common.IndexReader, error)

NewIndexReader returns an index reader for a byte slice of marshalled ordered records. The index has not changed between v0 and v1.

func NewIndexWriter

func NewIndexWriter(pageSizeBytes int) common.IndexWriter

NewIndexWriter returns an index writer that writes to the provided io.Writer. The index has not changed between v0 and v1.

func NewObjectReaderWriter

func NewObjectReaderWriter() common.ObjectReaderWriter

func NewRecordReaderWriter

func NewRecordReaderWriter() common.RecordReaderWriter

Types

type GzipPool added in v1.2.0

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

GzipPool is a gun zip compression pool

func (*GzipPool) Encoding added in v1.2.0

func (pool *GzipPool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*GzipPool) GetReader added in v1.2.0

func (pool *GzipPool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*GzipPool) GetWriter added in v1.2.0

func (pool *GzipPool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*GzipPool) PutReader added in v1.2.0

func (pool *GzipPool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*GzipPool) PutWriter added in v1.2.0

func (pool *GzipPool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*GzipPool) ResetReader added in v1.2.0

func (pool *GzipPool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*GzipPool) ResetWriter added in v1.2.0

func (pool *GzipPool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

type LZ4Pool added in v1.2.0

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

LZ4Pool is an pool...of lz4s...

func (*LZ4Pool) Encoding added in v1.2.0

func (pool *LZ4Pool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*LZ4Pool) GetReader added in v1.2.0

func (pool *LZ4Pool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*LZ4Pool) GetWriter added in v1.2.0

func (pool *LZ4Pool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*LZ4Pool) PutReader added in v1.2.0

func (pool *LZ4Pool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*LZ4Pool) PutWriter added in v1.2.0

func (pool *LZ4Pool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*LZ4Pool) ResetReader added in v1.2.0

func (pool *LZ4Pool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*LZ4Pool) ResetWriter added in v1.2.0

func (pool *LZ4Pool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

type NoopPool added in v1.2.0

type NoopPool struct{}

NoopPool is for people who think compression is for the weak

func (*NoopPool) Encoding added in v1.2.0

func (pool *NoopPool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*NoopPool) GetReader added in v1.2.0

func (pool *NoopPool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*NoopPool) GetWriter added in v1.2.0

func (pool *NoopPool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*NoopPool) PutReader added in v1.2.0

func (pool *NoopPool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*NoopPool) PutWriter added in v1.2.0

func (pool *NoopPool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*NoopPool) ResetReader added in v1.2.0

func (pool *NoopPool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*NoopPool) ResetWriter added in v1.2.0

func (pool *NoopPool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

type ReaderPool added in v1.2.0

type ReaderPool interface {
	GetReader(io.Reader) (io.Reader, error)
	PutReader(io.Reader)
	ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)
	Encoding() backend.Encoding
}

ReaderPool similar to WriterPool but for reading chunks.

type S2Pool added in v1.2.0

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

S2Pool is one s short of s3

func (*S2Pool) Encoding added in v1.2.0

func (pool *S2Pool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*S2Pool) GetReader added in v1.2.0

func (pool *S2Pool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*S2Pool) GetWriter added in v1.2.0

func (pool *S2Pool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*S2Pool) PutReader added in v1.2.0

func (pool *S2Pool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*S2Pool) PutWriter added in v1.2.0

func (pool *S2Pool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*S2Pool) ResetReader added in v1.2.0

func (pool *S2Pool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*S2Pool) ResetWriter added in v1.2.0

func (pool *S2Pool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

type SnappyPool added in v1.2.0

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

SnappyPool is a really cool looking pool. Dang that pool is _snappy_.

func (*SnappyPool) Encoding added in v1.2.0

func (pool *SnappyPool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*SnappyPool) GetReader added in v1.2.0

func (pool *SnappyPool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*SnappyPool) GetWriter added in v1.2.0

func (pool *SnappyPool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*SnappyPool) PutReader added in v1.2.0

func (pool *SnappyPool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*SnappyPool) PutWriter added in v1.2.0

func (pool *SnappyPool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*SnappyPool) ResetReader added in v1.2.0

func (pool *SnappyPool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*SnappyPool) ResetWriter added in v1.2.0

func (pool *SnappyPool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

type WriterPool added in v1.2.0

type WriterPool interface {
	GetWriter(io.Writer) (io.WriteCloser, error)
	PutWriter(io.WriteCloser)
	ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)
	Encoding() backend.Encoding
}

WriterPool is a pool of io.Writer This is used by every chunk to avoid unnecessary allocations.

func GetWriterPool added in v1.2.0

func GetWriterPool(enc backend.Encoding) (WriterPool, error)

type ZstdPool added in v1.2.0

type ZstdPool struct {
}

ZstdPool is a zstd compression pool

func (*ZstdPool) Encoding added in v1.2.0

func (pool *ZstdPool) Encoding() backend.Encoding

Encoding implements WriterPool and ReaderPool

func (*ZstdPool) GetReader added in v1.2.0

func (pool *ZstdPool) GetReader(src io.Reader) (io.Reader, error)

GetReader gets or creates a new CompressionReader and reset it to read from src

func (*ZstdPool) GetWriter added in v1.2.0

func (pool *ZstdPool) GetWriter(dst io.Writer) (io.WriteCloser, error)

GetWriter gets or creates a new CompressionWriter and reset it to write to dst

func (*ZstdPool) PutReader added in v1.2.0

func (pool *ZstdPool) PutReader(reader io.Reader)

PutReader places back in the pool a CompressionReader

func (*ZstdPool) PutWriter added in v1.2.0

func (pool *ZstdPool) PutWriter(writer io.WriteCloser)

PutWriter places back in the pool a CompressionWriter

func (*ZstdPool) ResetReader added in v1.2.0

func (pool *ZstdPool) ResetReader(src io.Reader, resetReader io.Reader) (io.Reader, error)

ResetReader implements ReaderPool

func (*ZstdPool) ResetWriter added in v1.2.0

func (pool *ZstdPool) ResetWriter(dst io.Writer, resetWriter io.WriteCloser) (io.WriteCloser, error)

ResetWriter implements WriterPool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL