ef

package module
v0.0.0-...-42257fc Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2017 License: MIT Imports: 4 Imported by: 0

README

go-ef

A Go implementation of the Elias-Fano encoding

Build Status GoDoc Go Report Card cover.run go

Example
package main
import (
    "fmt"
    "github.com/amallia/go-ef"
    "os"
)

func main() {
    array := []uint64{1,5,10}
    size := len(array)
    max := array[size-1]
    obj := ef.New(max, size)

    obj.Compress(array)

    v, err := obj.Next()
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    fmt.Println(v) // 1

    obj.Next()
    fmt.Println(obj.Value()) // 5
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EliasFano

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

EliasFano codec structure

func New

func New(universe uint64, n uint64) *EliasFano

New creates a new empty EliasFano object

func (*EliasFano) Bitsize

func (ef *EliasFano) Bitsize() uint64

Bitsize returns the size of the internal bitvector.

func (*EliasFano) Compress

func (ef *EliasFano) Compress(elems []uint64)

Compress a monotone increasing array of positive integers. It sets the position at the beginning.

func (*EliasFano) Info

func (ef *EliasFano) Info()

Info prints info regarding the EliasFano codec.

func (*EliasFano) Move

func (ef *EliasFano) Move(position uint64) (uint64, error)

Move the internal iterator to the given position and returns a value or an error.

func (*EliasFano) Next

func (ef *EliasFano) Next() (uint64, error)

Next moves the internal iterator to the next position and returns a value or an error.

func (*EliasFano) Position

func (ef *EliasFano) Position() uint64

Position return the current position of the internal iterator.

func (*EliasFano) Reset

func (ef *EliasFano) Reset()

Reset moves the internal iterator to the beginning.

func (*EliasFano) Size

func (ef *EliasFano) Size() uint64

Size returns the number of elements encoded.

func (*EliasFano) Value

func (ef *EliasFano) Value() uint64

Value returns the value of the current element.

Jump to

Keyboard shortcuts

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