rlepluslazy

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 58

Documentation

Index

Constants

View Source
const Version = 0

Variables

View Source
var (
	ErrWrongVersion = errors.New("invalid RLE+ version")
	ErrDecode       = fmt.Errorf("invalid encoding for RLE+ version %d", Version)
)
View Source
var ErrEndOfIterator = errors.New("end of iterator")
View Source
var ErrSameValRuns = errors.New("2 consecutive runs with the same value")

Functions

func Count

func Count(ri RunIterator) (uint64, error)

func EncodeRuns

func EncodeRuns(rit RunIterator, buf []byte) ([]byte, error)

func IsSet

func IsSet(ri RunIterator, x uint64) (bool, error)

func SliceFromRuns

func SliceFromRuns(source RunIterator) ([]uint64, error)

func ValidateRLE added in v0.2.3

func ValidateRLE(buf []byte) error

ValidateRLE validates the RLE+ in buf does not overflow Uint64

Types

type BitIterator

type BitIterator interface {
	Next() (uint64, error)
	Nth(n uint64) (uint64, error)
	HasNext() bool
}

func BitsFromRuns

func BitsFromRuns(source RunIterator) (BitIterator, error)

func BitsFromSlice

func BitsFromSlice(slice []uint64) BitIterator

type RLE

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

func FromBuf

func FromBuf(buf []byte) (RLE, error)

func (*RLE) Bytes added in v0.1.0

func (rle *RLE) Bytes() []byte

Bytes returns the encoded RLE.

Do not modify.

func (*RLE) Count

func (rle *RLE) Count() (uint64, error)

func (*RLE) MarshalJSON

func (rle *RLE) MarshalJSON() ([]byte, error)

Encoded as an array of run-lengths, always starting with zeroes (absent values) E.g.: The set {0, 1, 2, 8, 9} is the bitfield 1110000011, and would be marshalled as [0, 3, 5, 2]

func (*RLE) RunIterator

func (rle *RLE) RunIterator() (RunIterator, error)

func (*RLE) UnmarshalJSON

func (rle *RLE) UnmarshalJSON(b []byte) error

func (*RLE) Validate added in v0.2.1

func (rle *RLE) Validate() error

Validate is a separate function to show up on profile for repeated decode evaluation

type Run

type Run struct {
	Val bool
	Len uint64
}

func (Run) Valid

func (r Run) Valid() bool

type RunIterable

type RunIterable interface {
	RunIterator() (RunIterator, error)
}

type RunIterator

type RunIterator interface {
	NextRun() (Run, error)
	HasNext() bool
}

func And

func And(a, b RunIterator) (RunIterator, error)

func DecodeRLE

func DecodeRLE(buf []byte) (RunIterator, error)

func Fill

func Fill(iter RunIterator) (RunIterator, error)

Returns iterator with all bits up to the last bit set: in: 11100000111010001110000 out: 1111111111111111111

func JoinClose

func JoinClose(it RunIterator, closeness uint64) (RunIterator, error)

func NewFromZipfDist added in v0.2.2

func NewFromZipfDist(seed int64, size int) RunIterator

func Or

func Or(a, b RunIterator) (RunIterator, error)

func RunsFromBits

func RunsFromBits(source BitIterator) (RunIterator, error)

func RunsFromSlice

func RunsFromSlice(slice []uint64) (RunIterator, error)

func Subtract

func Subtract(a, b RunIterator) (RunIterator, error)

func Union added in v0.1.0

func Union(iters ...RunIterator) (RunIterator, error)

Union returns the union of the passed iterators. Internally, this calls Or on the passed iterators, combining them with a binary tree of Ors.

type RunSliceIterator

type RunSliceIterator struct {
	Runs []Run
	// contains filtered or unexported fields
}

func (*RunSliceIterator) HasNext

func (ri *RunSliceIterator) HasNext() bool

func (*RunSliceIterator) NextRun

func (ri *RunSliceIterator) NextRun() (Run, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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