compactor

package
v0.0.0-...-bfa2730 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compactor

type Compactor struct {
	services.Service

	Ring *ring.Ring
	// contains filtered or unexported fields
}

func New

func New(cfg Config, store storage.Store, overrides *overrides.Overrides, reg prometheus.Registerer) (*Compactor, error)

New makes a new Compactor.

func (*Compactor) BlockRetentionForTenant

func (c *Compactor) BlockRetentionForTenant(tenantID string) time.Duration

BlockRetentionForTenant implements CompactorOverrides

func (*Compactor) MaxBytesPerSnapshotForTenant

func (c *Compactor) MaxBytesPerSnapshotForTenant(tenantID string) int

func (*Compactor) OnRingInstanceHeartbeat

func (c *Compactor) OnRingInstanceHeartbeat(*ring.BasicLifecycler, *ring.Desc, *ring.InstanceDesc)

OnRingInstanceHeartbeat is called while the instance is updating its heartbeat in the ring.

func (*Compactor) OnRingInstanceRegister

func (c *Compactor) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, _ string, instanceDesc ring.InstanceDesc) (ring.InstanceState, ring.Tokens)

OnRingInstanceRegister is called while the lifecycler is registering the instance within the ring and should return the state and set of tokens to use for the instance itself.

func (*Compactor) OnRingInstanceStopping

func (c *Compactor) OnRingInstanceStopping(*ring.BasicLifecycler)

OnRingInstanceStopping is called while the lifecycler is stopping. The lifecycler will continue to hearbeat the ring the this function is executing and will proceed to unregister the instance from the ring only after this function has returned.

func (*Compactor) OnRingInstanceTokens

func (c *Compactor) OnRingInstanceTokens(*ring.BasicLifecycler, ring.Tokens)

OnRingInstanceTokens is called once the instance tokens are set and are stable within the ring (honoring the observe period, if set).

func (*Compactor) Owns

func (c *Compactor) Owns(hash string) bool

Owns implements deepdb.CompactorSharder

func (*Compactor) RecordDiscardedSnapshots

func (c *Compactor) RecordDiscardedSnapshots(count int, tenantID string, snapshotID string)

RecordDiscardedSnapshots implements deepdb.CompactorSharder

type Config

type Config struct {
	Disabled        bool                   `yaml:"disabled,omitempty"`
	ShardingRing    RingConfig             `yaml:"ring,omitempty"`
	Compactor       deepdb.CompactorConfig `yaml:"compaction"`
	OverrideRingKey string                 `yaml:"override_ring_key"`
}

func (*Config) RegisterFlagsAndApplyDefaults

func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet)

RegisterFlagsAndApplyDefaults registers the flags.

type RingConfig

type RingConfig struct {
	KVStore          kv.Config     `yaml:"kvstore"`
	HeartbeatPeriod  time.Duration `yaml:"heartbeat_period"`
	HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`

	// Wait ring stability.
	WaitStabilityMinDuration time.Duration `yaml:"wait_stability_min_duration"`
	WaitStabilityMaxDuration time.Duration `yaml:"wait_stability_max_duration"`

	// Instance details
	InstanceID             string   `yaml:"instance_id" doc:"hidden"`
	InstanceInterfaceNames []string `yaml:"instance_interface_names"`
	InstancePort           int      `yaml:"instance_port" doc:"hidden"`
	InstanceAddr           string   `yaml:"instance_addr" doc:"hidden"`

	// Injected internally
	ListenPort int `yaml:"-"`

	WaitActiveInstanceTimeout time.Duration `yaml:"wait_active_instance_timeout"`

	ObservePeriod time.Duration `yaml:"-"`
}

RingConfig masks the ring lifecycler config which contains many options not really required by the compactors ring. This config is used to strip down the config to the minimum, and avoid confusion to the user.

func (*RingConfig) RegisterFlags

func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*RingConfig) ToLifecyclerConfig

func (cfg *RingConfig) ToLifecyclerConfig() ring.LifecyclerConfig

ToLifecyclerConfig returns a LifecyclerConfig based on the compactor ring config.

Jump to

Keyboard shortcuts

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