compression

package
v0.0.0-...-3b44145 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package compression holds the algorithms for compressing the list of sorted lists of integers

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrGapShouldBeGreaterThanListLen tells that the list length is less or equal to
	// the skipping gap
	ErrGapShouldBeGreaterThanListLen = errors.New("gap should be greater than the list length")
	// ErrGapOverflow tells that it was at attempt to create
	// encoder/decoder skipping gap more than maxSkippingGap
	ErrGapOverflow = errors.New("gap value overflow")
)

Functions

func UnpackPos

func UnpackPos(packed uint16) (int, bool)

UnpackPos splits the given uint16 packed value on a pair (delta position, is last block flag)

Types

type Decoder

type Decoder interface {
	// Decode decodes the given byte array to the buf list
	// Returns a number of elements encoded
	Decode(in store.Input, buf []uint32) (int, error)
}

Decoder represents entity for decoding given byte array to posting list

func BinaryDecoder

func BinaryDecoder() Decoder

BinaryDecoder returns new instance of binaryEnc

func SkippingDecoder

func SkippingDecoder(gap int) (Decoder, error)

SkippingDecoder creates a new instance of skipping decoder

func VBDecoder

func VBDecoder() Decoder

VBDecoder decodes given bytes array to posting list which was encoded by VBEncoder

type Encoder

type Encoder interface {
	// Encode encodes the given positing list into the buf array
	// Returns a number of written bytes
	Encode(list []uint32, out store.Output) (int, error)
}

Encoder represents entity for encoding given posting list to byte array

func BinaryEncoder

func BinaryEncoder() Encoder

BinaryEncoder returns new instance of binaryEnc which encodes each Position in 4 bytes

func BitmapEncoder

func BitmapEncoder() Encoder

BitmapEncoder returns new instance of bitmapEnc which compress the uint32 list with the roaring bitmap library

func SkippingEncoder

func SkippingEncoder(gap int) (Encoder, error)

SkippingEncoder creates a new instance of skipping encoder

func VBEncoder

func VBEncoder() Encoder

VBEncoder returns new instance of vbEnc that encodes posting list using delta encoding variable length byte string compression

Jump to

Keyboard shortcuts

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