Documentation ¶
Index ¶
- func CompressStringArray(input []string, compressor Compressor) ([]byte, error)
- func DecompressStringArray(input []byte, decompressor Decompressor) ([]string, error)
- func MustCompressStringArray(input []string, compressor Compressor) []byte
- func MustDecompressStringArray(input []byte, compressor Decompressor) []string
- type Compressor
- type Decompressor
- type NoOpCompressor
- type NoOpDecompressor
- type ThreadSafeZlibCompressor
- type ThreadSafeZlibDecompressor
- type ZlibCompressor
- type ZlibDecompressor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressStringArray ¶
func CompressStringArray(input []string, compressor Compressor) ([]byte, error)
func DecompressStringArray ¶
func DecompressStringArray(input []byte, decompressor Decompressor) ([]string, error)
func MustCompressStringArray ¶ added in v0.3.47
func MustCompressStringArray(input []string, compressor Compressor) []byte
func MustDecompressStringArray ¶ added in v0.3.47
func MustDecompressStringArray(input []byte, compressor Decompressor) []string
Types ¶
type Compressor ¶
type Compressor interface { // Compress compresses the byte array Compress(b []byte) ([]byte, error) }
Compressor is a fast, single threaded compressor. This type allows us to reuse buffers etc for performance
type Decompressor ¶
type Decompressor interface { // Decompress decompresses the byte array Decompress(b []byte) ([]byte, error) }
Decompressor is a fast, single threaded compressor. This type allows us to reuse buffers etc for performance
type NoOpCompressor ¶
type NoOpCompressor struct{}
NoOpCompressor is a Compressor that does nothing. Useful for tests.
type NoOpDecompressor ¶
type NoOpDecompressor struct{}
NoOpDecompressor is a DeCompressor that does nothing. Useful for tests.
func (*NoOpDecompressor) Decompress ¶
func (c *NoOpDecompressor) Decompress(b []byte) ([]byte, error)
type ThreadSafeZlibCompressor ¶
type ThreadSafeZlibCompressor struct {
// contains filtered or unexported fields
}
ThreadSafeZlibCompressor provides a thread safe compressor, at the cost of instantiating a new ZlibCompressor for each Compress call
func NewThreadSafeZlibCompressor ¶
func NewThreadSafeZlibCompressor(minCompressSize int) *ThreadSafeZlibCompressor
type ThreadSafeZlibDecompressor ¶
type ThreadSafeZlibDecompressor struct{}
ThreadSafeZlibDecompressor provides a thread safe decompressor, at the cost of instantiating a new ZlibDecompressor for each Decompress call
func NewThreadSafeZlibDecompressor ¶
func NewThreadSafeZlibDecompressor() *ThreadSafeZlibDecompressor
func (*ThreadSafeZlibDecompressor) Decompress ¶
func (d *ThreadSafeZlibDecompressor) Decompress(b []byte) ([]byte, error)
type ZlibCompressor ¶
type ZlibCompressor struct {
// contains filtered or unexported fields
}
ZlibCompressor compresses to Zlib, which for KB size payloads seems more (cpu) efficient than the newer formats such as zstd. The compressor will only compress if the msg is greater than minCompressSize
func NewZlibCompressor ¶
func NewZlibCompressor(minCompressSize int) (*ZlibCompressor, error)
type ZlibDecompressor ¶
type ZlibDecompressor struct {
// contains filtered or unexported fields
}
ZlibDecompressor decompresses Zlib
func NewZlibDecompressor ¶
func NewZlibDecompressor() *ZlibDecompressor
func (*ZlibDecompressor) Decompress ¶
func (d *ZlibDecompressor) Decompress(b []byte) ([]byte, error)