Documentation
¶
Overview ¶
Package pforenc contains a Go TurboPFor encoder.
Index ¶
Constants ¶
const LargestP4 = 1025
LargestP4 is the largest number of bytes our encoder will emit when encoding 256 uint32 values in TurboPFor format (safe upper bound for buffers).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockEncoder ¶
type BlockEncoder struct {
// contains filtered or unexported fields
}
BlockEncoder encodes one or more TurboPFor blocks, each containing at most 256 values (for efficient SIMD processing).
A zero value BlockEncoder is ready to use. BlockEncoder is not safe for concurrent use by multiple goroutines.
func (*BlockEncoder) EncodeBlock ¶
func (be *BlockEncoder) EncodeBlock(dest []byte, vals []uint32) []byte
EncodeBlock encodes len(vals)<=256 uint32s into dest (one TurboPFor block).
type StreamEncoder ¶
type StreamEncoder struct {
// contains filtered or unexported fields
}
StreamEncoder accumulates uint32s until one full TurboPFor block, then encodes that block for writing it to disk/network.
A zero value StreamEncoder is ready to use. StreamEncoder is not safe for concurrent use by multiple goroutines.
func (*StreamEncoder) Add ¶
func (se *StreamEncoder) Add(val uint32) (full bool)
Add stores val in the StreamEncoder's buffer.
Contract: When Add returns true (full), you must EncodeBlock().
func (*StreamEncoder) EncodeBlock ¶
func (se *StreamEncoder) EncodeBlock() []byte
EncodeBlock encodes the accumulated values in TurboPFor format and returns the bytes of the (full or remainder) block.
Contract: the returned bytes are valid until the next EncodeBlock.