chunks

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 14 Imported by: 18

Documentation

Index

Constants

View Source
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
)

Variables

This section is empty.

Functions

func MergeChunks added in v0.5.0

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.

Types

type ByteSlice

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

ByteSlice abstracts a byte slice.

type Meta

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 added in v0.5.0

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

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

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

type Reader

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

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

func NewDirReader

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

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

Chunk returns a chunk from a given reference.

func (*Reader) Close

func (s *Reader) Close() error

func (*Reader) Size added in v0.4.0

func (s *Reader) Size() int64

Size returns the size of the chunks.

type Writer

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

Writer implements the ChunkWriter interface for the standard serialization format.

func NewWriter

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

NewWriter returns a new writer against the given directory.

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) WriteChunks

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

Jump to

Keyboard shortcuts

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