record

package
v2.24.1-v2-2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned if a looked up resource was not found. Duplicate ErrNotFound from head.go.
	ErrNotFound = errors.New("not found")
)

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) 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) 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 RefSample

type RefSample struct {
	Ref uint64
	T   int64
	V   float64
}

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

type RefSeries

type RefSeries struct {
	Ref    uint64
	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
)

Jump to

Keyboard shortcuts

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