tombstones

package
v0.49.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MagicTombstone is 4 bytes at the head of a tombstone file.
	MagicTombstone = 0x0130BA30
)
View Source
const TombstonesFilename = "tombstones"

Variables

This section is empty.

Functions

func Encode

func Encode(tr Reader) ([]byte, error)

Encode encodes the tombstones from the reader. It does not attach any magic number or checksum.

func WriteFile

func WriteFile(logger log.Logger, dir string, tr Reader) (int64, error)

Types

type Interval

type Interval struct {
	Mint, Maxt int64
}

Interval represents a single time-interval.

func (Interval) InBounds

func (tr Interval) InBounds(t int64) bool

func (Interval) IsSubrange

func (tr Interval) IsSubrange(dranges Intervals) bool

type Intervals

type Intervals []Interval

Intervals represents a set of increasing and non-overlapping time-intervals.

func (Intervals) Add

func (in Intervals) Add(n Interval) Intervals

Add the new time-range to the existing ones. The existing ones must be sorted.

type MemTombstones

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

func NewMemTombstones

func NewMemTombstones() *MemTombstones

NewMemTombstones creates new in memory Tombstone Reader that allows adding new intervals.

func NewTestMemTombstones

func NewTestMemTombstones(intervals []Intervals) *MemTombstones

func (*MemTombstones) AddInterval

func (t *MemTombstones) AddInterval(ref storage.SeriesRef, itvs ...Interval)

AddInterval to an existing memTombstones.

func (*MemTombstones) Close

func (*MemTombstones) Close() error

func (*MemTombstones) DeleteTombstones

func (t *MemTombstones) DeleteTombstones(refs map[storage.SeriesRef]struct{})

func (*MemTombstones) Get

func (*MemTombstones) Iter

func (t *MemTombstones) Iter(f func(storage.SeriesRef, Intervals) error) error

func (*MemTombstones) Total

func (t *MemTombstones) Total() uint64

func (*MemTombstones) TruncateBefore

func (t *MemTombstones) TruncateBefore(beforeT int64)

type Reader

type Reader interface {
	// Get returns deletion intervals for the series with the given reference.
	Get(ref storage.SeriesRef) (Intervals, error)

	// Iter calls the given function for each encountered interval.
	Iter(func(storage.SeriesRef, Intervals) error) error

	// Total returns the total count of tombstones.
	Total() uint64

	// Close any underlying resources
	Close() error
}

Reader gives access to tombstone intervals by series reference.

func Decode

func Decode(b []byte) (Reader, error)

Decode decodes the tombstones from the bytes which was encoded using the Encode method.

func ReadTombstones

func ReadTombstones(dir string) (Reader, int64, error)

type Stone

type Stone struct {
	Ref       storage.SeriesRef
	Intervals Intervals
}

Stone holds the information on the posting and time-range that is deleted.

Jump to

Keyboard shortcuts

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