planner

package
v0.0.0-...-6ee8545 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutSlab

func PutSlab(s *Slab)

Types

type Config

type Config struct {
	Mint                 int64
	Maxt                 int64
	SlabSizeLimitBytes   int64
	NumStores            int
	ProgressEnabled      bool
	JobName              string
	ProgressMetricName   string // Name for progress metric.
	ProgressClientConfig utils.ClientConfig
	HTTPConfig           config.HTTPClientConfig
	LaIncrement          time.Duration
	MaxReadDuration      time.Duration
	HumanReadableTime    bool
}

Config represents configuration for the planner.

type Plan

type Plan struct {

	// Test configs.
	Quiet         bool   // Avoid progress-bars during logs.
	TestCheckFunc func() // Helps peek into planner during testing. It is called at createSlab() to check the stats of the last slab.
	// contains filtered or unexported fields
}

Plan represents the plannings done by the planner.

func Init

func Init(config *Config) (*Plan, bool, error)

Init creates an in-memory planner and initializes it. It is responsible for fetching the last pushed maxt and based on that, updates the mint for the provided migration.

func (*Plan) DecrementSlabCount

func (p *Plan) DecrementSlabCount()

func (*Plan) LastMemoryFootprint

func (p *Plan) LastMemoryFootprint() int64

func (*Plan) NextSlab

func (p *Plan) NextSlab() (reference *Slab, err error)

NextSlab returns a new slab after allocating the time-range for fetch.

func (*Plan) ShouldProceed

func (p *Plan) ShouldProceed() bool

ShouldProceed reports whether the fetching process should proceeds further. If any time-range is left to be fetched from the provided time-range, it returns true, else false.

type Slab

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

Slab represents an in-memory storage for data that is fetched by the reader.

func (*Slab) Done

func (s *Slab) Done() error

Done updates the text and sets the spinner to done.

func (*Slab) Fetch

func (s *Slab) Fetch(ctx context.Context, client *utils.Client, mint, maxt int64, matchers []*labels.Matcher) (err error)

Fetch starts fetching the samples from remote read storage based on the matchers. It takes care of concurrent pulls as well.

func (*Slab) IsEmpty

func (s *Slab) IsEmpty() bool

IsEmpty returns true if the slab does not contain any time-series.

func (*Slab) Maxt

func (s *Slab) Maxt() int64

Maxt returns the maxt of the slab (exclusive).

func (*Slab) Mint

func (s *Slab) Mint() int64

Mint returns the mint of the slab (inclusive).

func (*Slab) PBarMax

func (s *Slab) PBarMax() int

func (*Slab) Series

func (s *Slab) Series() []*prompb.TimeSeries

Series returns the time-series in the slab.

func (*Slab) SetDescription

func (s *Slab) SetDescription(description string, proceed int)

func (*Slab) UpdatePBarMax

func (s *Slab) UpdatePBarMax(steps int)

func (*Slab) UpdateProgressSeries

func (s *Slab) UpdateProgressSeries(ts *prompb.TimeSeries) *prompb.TimeSeries

UpdateProgressSeries returns a time-series after appending a sample to the progress-metric.

Jump to

Keyboard shortcuts

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