tsdb: github.com/prometheus/tsdb/chunks Index | Files

package chunks

import "github.com/prometheus/tsdb/chunks"

Index

Package Files

chunks.go

Constants

const (
    // MagicChunks is 4 bytes at the head of a series file.
    MagicChunks = 0x85BD40DD
    // MagicChunksSize is the size in bytes of MagicChunks.
    MagicChunksSize = 4

    ChunksFormatVersionSize = 1
)

func MergeChunks Uses

func MergeChunks(a, b chunkenc.Chunk) (*chunkenc.XORChunk, error)

MergeChunks vertically merges a and b, i.e., if there is any sample with same timestamp in both a and b, the sample in a is discarded.

type ByteSlice Uses

type ByteSlice interface {
    Len() int
    Range(start, end int) []byte
}

ByteSlice abstracts a byte slice.

type Meta Uses

type Meta struct {
    // Ref and Chunk hold either a reference that can be used to retrieve
    // chunk data or the data itself.
    // Generally, only one of them is set.
    Ref   uint64
    Chunk chunkenc.Chunk

    // Time range the data covers.
    // When MaxTime == math.MaxInt64 the chunk is still open and being appended to.
    MinTime, MaxTime int64
}

Meta holds information about a chunk of data.

func MergeOverlappingChunks Uses

func MergeOverlappingChunks(chks []Meta) ([]Meta, error)

MergeOverlappingChunks removes the samples whose timestamp is overlapping. The last appearing sample is retained in case there is overlapping. This assumes that `chks []Meta` is sorted w.r.t. MinTime.

func (*Meta) OverlapsClosedInterval Uses

func (cm *Meta) OverlapsClosedInterval(mint, maxt int64) bool

OverlapsClosedInterval Returns true if the chunk overlaps [mint, maxt].

type Reader Uses

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

Reader implements a ChunkReader for a serialized byte stream of series data.

func NewDirReader Uses

func NewDirReader(dir string, pool chunkenc.Pool) (*Reader, error)

NewDirReader returns a new Reader against sequentially numbered files in the given directory.

func (*Reader) Chunk Uses

func (s *Reader) Chunk(ref uint64) (chunkenc.Chunk, error)

Chunk returns a chunk from a given reference.

func (*Reader) Close Uses

func (s *Reader) Close() error

func (*Reader) Size Uses

func (s *Reader) Size() int64

Size returns the size of the chunks.

type Writer Uses

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

Writer implements the ChunkWriter interface for the standard serialization format.

func NewWriter Uses

func NewWriter(dir string) (*Writer, error)

NewWriter returns a new writer against the given directory.

func (*Writer) Close Uses

func (w *Writer) Close() error

func (*Writer) WriteChunks Uses

func (w *Writer) WriteChunks(chks ...Meta) error

Package chunks imports 14 packages (graph) and is imported by 17 packages. Updated 2019-08-04. Refresh now. Tools for package owners.