pruner

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates the statushistorypruner worker.

Types

type Config

type Config struct {
	Facade             Facade
	ModelConfigService ModelConfigService
	PruneInterval      time.Duration
	Clock              clock.Clock
	Logger             logger.Logger
}

Config holds all necessary attributes to start a pruner worker.

func (*Config) Validate

func (c *Config) Validate() error

Validate will err unless basic requirements for a valid config are met.

type Facade

type Facade interface {
	Prune(context.Context, time.Duration, int) error
}

Facade represents an API that implements status history pruning.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName      string
	DomainServicesName string
	Clock              clock.Clock
	PruneInterval      time.Duration
	NewWorker          func(Config) (worker.Worker, error)
	NewClient          func(base.APICaller) Facade
	Logger             logger.Logger
}

ManifoldConfig describes the resources and configuration on which the statushistorypruner worker depends.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

type ModelConfigService

type ModelConfigService interface {
	// ModelConfig returns the current config for the model.
	ModelConfig(ctx context.Context) (*config.Config, error)

	// Watch returns a watcher that returns keys for any changes to model
	// config.
	Watch() (watcher.StringsWatcher, error)
}

type PrunerWorker

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

PrunerWorker prunes status history or action records at regular intervals.

func New

func New(conf Config) PrunerWorker

New returns a worker.Worker for history Pruner.

func (*PrunerWorker) Catacomb

func (w *PrunerWorker) Catacomb() *catacomb.Catacomb

Catacomb returns the prune worker's catacomb.

func (*PrunerWorker) Config

func (w *PrunerWorker) Config() *Config

Config return the prune worker's config.

func (*PrunerWorker) Kill

func (w *PrunerWorker) Kill()

Kill is defined on worker.Worker.

func (*PrunerWorker) Wait

func (w *PrunerWorker) Wait() error

Wait is defined on worker.Worker.

func (*PrunerWorker) Work

func (w *PrunerWorker) Work(getPrunerConfig func(*config.Config) (time.Duration, uint)) error

Work is the main body of generic pruner loop.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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