tsz

package module
v0.0.0-...-0bd30b3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 51

README

go-tsz

Master Branch Master Build Status Master Coverage Status Go Report Card GoDoc

Description

Package tsz is a fork of github.com/dgryski/go-tsz that implements improvements over the original Gorilla paper developed by @burmann in his Master Thesis and released in https://github.com/burmanm/gorilla-tsc.

Differences from the original paper
  • Maximum number of leading zeros is stored with 6 bits to allow up to 63 leading zeros, which are necessary when storing long values.

  • Timestamp delta-of-delta is stored by first turning it to a positive integer with ZigZag encoding and then reduced by one to fit in the necessary bits. In the decoding phase all the values are incremented by one to fetch the original value.

  • The compressed blocks are created with a 27 bit delta header (unlike in the original paper, which uses a 14 bit delta header). This allows to use up to one day block size using millisecond precision.

Getting started

This library is written in Go language, please refer to the guides in https://golang.org for getting started.

This project include a Makefile that allows you to test and build the project with simple commands. To see all available options:

make help

Running all tests

Before committing the code, please check if it passes all tests using

make qa

Documentation

Overview

Package tsz implement time-series compression

http://www.vldb.org/pvldb/vol8/p1816-teller.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iter

type Iter struct {
	T0 uint64
	// contains filtered or unexported fields
}

Iter lets you iterate over a series. It is not concurrency-safe.

func NewIterator

func NewIterator(b []byte) (*Iter, error)

NewIterator for the series

func (*Iter) Err

func (it *Iter) Err() error

Err error at the current iterator position

func (*Iter) Next

func (it *Iter) Next() bool

Next iteration of the series iterator

func (*Iter) Values

func (it *Iter) Values() (uint64, float64)

Values at the current iterator position

type Series

type Series struct {
	sync.Mutex

	T0 uint64
	// contains filtered or unexported fields
}

Series is the basic series primitive you can concurrently put values, finish the stream, and create iterators

func New

func New(t0 uint64) *Series

New series

func (*Series) Bytes

func (s *Series) Bytes() []byte

Bytes value of the series stream

func (*Series) Finish

func (s *Series) Finish()

Finish the series by writing an end-of-stream record

func (*Series) Iter

func (s *Series) Iter() *Iter

Iter lets you iterate over a series. It is not concurrency-safe.

func (*Series) MarshalBinary

func (s *Series) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*Series) Push

func (s *Series) Push(t uint64, v float64)

Push a timestamp and value to the series. Values must be inserted in monotonically increasing time order.

func (*Series) UnmarshalBinary

func (s *Series) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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