tsz

package
v0.0.0-...-15fa731 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package tsz implements time-series compression it is a fork of https://github.com/dgryski/go-tsz which implements http://www.vldb.org/pvldb/vol8/p1816-teller.pdf see devdocs/chunk-format.md for more info

Package tsz implements time-series compression it is a fork of https://github.com/dgryski/go-tsz which implements http://www.vldb.org/pvldb/vol8/p1816-teller.pdf see devdocs/chunk-format.md for more info

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iter

type Iter interface {
	Next() bool
	Values() (uint32, float64)
	Err() error
}

type Iter4h

type Iter4h struct {
	T0 uint32
	// contains filtered or unexported fields
}

Iter4h lets you iterate over a Series4h. It is not concurrency-safe. For more info, see Series4h

func NewIterator4h

func NewIterator4h(b []byte, intervalHint uint32) (*Iter4h, error)

NewIterator4h creates an Iter4h

func (*Iter4h) Err

func (it *Iter4h) Err() error

Err error at the current iterator position

func (*Iter4h) Next

func (it *Iter4h) Next() bool

Next iteration of the series iterator

func (*Iter4h) Values

func (it *Iter4h) Values() (uint32, float64)

Values at the current iterator position

type IterLong

type IterLong struct {
	T0 uint32
	// contains filtered or unexported fields
}

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

func NewIteratorLong

func NewIteratorLong(t0 uint32, b []byte) (*IterLong, error)

NewIteratorLong for the series

func (*IterLong) Err

func (it *IterLong) Err() error

Err error at the current iterator position

func (*IterLong) Next

func (it *IterLong) Next() bool

Next iteration of the series iterator

func (*IterLong) Values

func (it *IterLong) Values() (uint32, float64)

Values at the current iterator position

type Series4h

type Series4h struct {
	sync.Mutex

	// TODO(dgryski): timestamps in the paper are uint64
	T0 uint32
	// contains filtered or unexported fields
}

Series4h is the basic series primitive you can concurrently put values, finish the stream, and create iterators you shouldn't use it for chunks longer than 4.5 hours, due to overflow of the first delta (14 bits), though in some cases, the corresponding iterator can reconstruct the data. Only works for <=9h deltas/chunks though. See https://github.com/grafana/metrictank/pull/1126

func NewSeries4h

func NewSeries4h(t0 uint32) *Series4h

NewSeries4h creates a new Series4h

func (*Series4h) Bytes

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

Bytes value of the series stream

func (*Series4h) Finish

func (s *Series4h) Finish()

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

func (*Series4h) Iter

func (s *Series4h) Iter(intervalHint uint32) *Iter4h

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

func (*Series4h) MarshalBinary

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

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*Series4h) Push

func (s *Series4h) Push(t uint32, v float64)

Push a timestamp and value to the series

func (*Series4h) UnmarshalBinary

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

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

type SeriesLong

type SeriesLong struct {
	sync.Mutex

	// TODO(dgryski): timestamps in the paper are uint64
	T0 uint32 // exposed for caller convenience. do NOT set directly. set via constructor
	T  uint32 // exposed for caller convenience. do NOT set directly. may only be set via Push()

	Finished bool // exposed for caller convenience. do NOT set directly.
	// contains filtered or unexported fields
}

SeriesLong similar to Series4h, except:

  • it doesn't write t0 to the stream (for callers that track t0 corresponding to a chunk separately)
  • it doesn't store an initial delta. instead, it assumes a starting delta of 60 and uses delta-of-delta encoding from the get-go.
  • it uses a more compact way to mark end-of-stream

func NewSeriesLong

func NewSeriesLong(t0 uint32) *SeriesLong

New series

func (*SeriesLong) Bytes

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

Bytes value of the series stream

func (*SeriesLong) Finish

func (s *SeriesLong) Finish()

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

func (*SeriesLong) Iter

func (s *SeriesLong) Iter() *IterLong

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

func (*SeriesLong) MarshalBinary

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

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*SeriesLong) Push

func (s *SeriesLong) Push(t uint32, v float64)

Push a timestamp and value to the series

func (*SeriesLong) UnmarshalBinary

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

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

Jump to

Keyboard shortcuts

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