tombstones

package
v2.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 15 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 NewMemTombstones

func NewMemTombstones() *memTombstones

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

func NewTestMemTombstones

func NewTestMemTombstones(intervals []Intervals) *memTombstones

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 (itvs Intervals) Add(n Interval) Intervals

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

type Reader

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

	// Iter calls the given function for each encountered interval.
	Iter(func(uint64, 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 ReadTombstones

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

type Stone

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