Help us shape the future of Go! Take the 2026 Go Developer Survey

record

package
v0.37.7 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 59

Documentation

Overview

Package record contains the various record types used for encoding various Head block data in the WAL and in-memory snapshot.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned if a looked up resource was not found. Duplicate ErrNotFound from head.go.

Functions

This section is empty.

Types

type Decoder

type Decoder struct{}

Decoder decodes series, sample, and tombstone records. The zero value is ready to use.

func (*Decoder) Exemplars

func (d *Decoder) Exemplars(rec []byte, exemplars []RefExemplar) ([]RefExemplar, error)

func (*Decoder) ExemplarsFromBuffer

func (d *Decoder) ExemplarsFromBuffer(dec *encoding.Decbuf, exemplars []RefExemplar) ([]RefExemplar, error)

func (*Decoder) Samples

func (d *Decoder) Samples(rec []byte, samples []RefSample) ([]RefSample, error)

Samples appends samples in rec to the given slice.

func (*Decoder) Series

func (d *Decoder) Series(rec []byte, series []RefSeries) ([]RefSeries, error)

Series appends series in rec to the given slice.

func (*Decoder) Tombstones

func (d *Decoder) Tombstones(rec []byte, tstones []tombstones.Stone) ([]tombstones.Stone, error)

Tombstones appends tombstones in rec to the given slice.

func (*Decoder) Type

func (d *Decoder) Type(rec []byte) Type

Type returns the type of the record. Returns RecordUnknown if no valid record type is found.

type Encoder

type Encoder struct{}

Encoder encodes series, sample, and tombstones records. The zero value is ready to use.

func (*Encoder) EncodeExemplarsIntoBuffer

func (e *Encoder) EncodeExemplarsIntoBuffer(exemplars []RefExemplar, buf *encoding.Encbuf)

func (*Encoder) Exemplars

func (e *Encoder) Exemplars(exemplars []RefExemplar, b []byte) []byte

func (*Encoder) Samples

func (e *Encoder) Samples(samples []RefSample, b []byte) []byte

Samples appends the encoded samples to b and returns the resulting slice.

func (*Encoder) Series

func (e *Encoder) Series(series []RefSeries, b []byte) []byte

Series appends the encoded series to b and returns the resulting slice.

func (*Encoder) Tombstones

func (e *Encoder) Tombstones(tstones []tombstones.Stone, b []byte) []byte

Tombstones appends the encoded tombstones to b and returns the resulting slice.

type RefExemplar

type RefExemplar struct {
	Ref    chunks.HeadSeriesRef
	T      int64
	V      float64
	Labels labels.Labels
}

RefExemplar is an exemplar with it's labels, timestamp, value the exemplar was collected/observed with, and a reference to a series.

type RefSample

type RefSample struct {
	Ref chunks.HeadSeriesRef
	T   int64
	V   float64
}

RefSample is a timestamp/value pair associated with a reference to a series.

type RefSeries

type RefSeries struct {
	Ref    chunks.HeadSeriesRef
	Labels labels.Labels
}

RefSeries is the series labels with the series ID.

type Type

type Type uint8

Type represents the data type of a record.

const (
	// Unknown is returned for unrecognised WAL record types.
	Unknown Type = 255
	// Series is used to match WAL records of type Series.
	Series Type = 1
	// Samples is used to match WAL records of type Samples.
	Samples Type = 2
	// Tombstones is used to match WAL records of type Tombstones.
	Tombstones Type = 3
	// Exemplars is used to match WAL records of type Exemplars.
	Exemplars Type = 4
)

Jump to

Keyboard shortcuts

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