retention

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 10 Imported by: 8

Documentation

Overview

Package retention provides the retention policy enforcement service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OSSDropShardMetaRef added in v1.11.5

func OSSDropShardMetaRef(mc MetaClient) func(uint64, []uint64) error

OSSDropShardMetaRef creates a closure appropriate for OSS to use as DropShardMetaRef.

Types

type Config

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

Config represents the configuration for the retention service.

func NewConfig

func NewConfig() Config

NewConfig returns an instance of Config with defaults.

func (Config) Diagnostics added in v1.3.0

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

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

func (Config) Validate added in v1.2.0

func (c Config) Validate() error

Validate returns an error if the Config is invalid.

type MetaClient added in v1.11.5

type MetaClient interface {
	Databases() []meta.DatabaseInfo
	DeleteShardGroup(database, policy string, id uint64) error
	DropShard(id uint64) error
	PruneShardGroups() error
}

type Service

type Service struct {
	MetaClient
	TSDBStore interface {
		ShardIDs() []uint64
		DeleteShard(shardID uint64) error
	}

	// DropShardRef is a function that takes a shard ID and removes the
	// "reference" to it in the meta data. For OSS, this would be a DropShard
	// operation. For Enterprise, this would be a RemoveShardOwner operation.
	// Also provided is owners, the list of node IDs of the shard owners
	// according to the meta store. For OSS, owners will always be empty.
	// Enterprise can use owners to optimize out calls to RemoveShardOwner
	// if the current node doesn't actually own the shardID. This prevents
	// a lot of unnecessary RPC calls.
	DropShardMetaRef func(shardID uint64, owners []uint64) error
	// contains filtered or unexported fields
}

Service represents the retention policy enforcement service.

func NewService

func NewService(c Config) *Service

NewService returns a configured retention policy enforcement service.

func (*Service) Close

func (s *Service) Close() error

Close stops retention policy enforcement.

func (*Service) DeletionCheck added in v1.11.5

func (s *Service) DeletionCheck()

func (*Service) Open

func (s *Service) Open() error

Open starts retention policy enforcement.

func (*Service) WithLogger added in v1.2.0

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

WithLogger sets the logger on the service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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