package precreator

import "github.com/influxdata/influxdb/services/precreator"

Package precreator provides the shard precreation service.

Index

Constants

const (
	// DefaultCheckInterval is the shard precreation check time if none is specified.
	DefaultCheckInterval = 10 * time.Minute

	// DefaultAdvancePeriod is the default period ahead of the endtime of a shard group
	// that its successor group is created.
	DefaultAdvancePeriod = 30 * time.Minute
)

Types

type Config

type Config struct {
	Enabled       bool          `toml:"enabled"`
	CheckInterval toml.Duration `toml:"check-interval"`
	AdvancePeriod toml.Duration `toml:"advance-period"`
}

Config represents the configuration for shard precreation.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with defaults.

func (Config) Diagnostics

func (c Config) Diagnostics() (*diagnostics.Diagnostics, error)

Diagnostics returns a diagnostics representation of a subset of the Config.

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the Config is invalid.

type Service

type Service struct {
	Logger *zap.Logger

	MetaClient interface {
		PrecreateShardGroups(now, cutoff time.Time) error
	}
	// contains filtered or unexported fields
}

Service manages the shard precreation service.

func NewService

func NewService(c Config) *Service

NewService returns an instance of the precreation service.

func (*Service) Close

func (s *Service) Close() error

Close stops the precreation service.

func (*Service) Open

func (s *Service) Open() error

Open starts the precreation service.

func (*Service) WithLogger

func (s *Service) WithLogger(log *zap.Logger)

WithLogger sets the logger for the service.

Source Files

config.go service.go

Version
v1.12.0 (latest)
Published
Apr 8, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
2 days ago

Tools for package owners.