manager

package
v16.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	// CleanStaleData removes any stale data in the repository as per the provided configuration.
	CleanStaleData(context.Context, *localrepo.Repo, housekeeping.CleanStaleDataConfig) error
	// OptimizeRepository optimizes the repository's data structures such that it can be more
	// efficiently served.
	OptimizeRepository(context.Context, *localrepo.Repo, ...OptimizeRepositoryOption) error
	// AddPackRefsInhibitor allows clients to block housekeeping from running git-pack-refs(1).
	AddPackRefsInhibitor(ctx context.Context, repoPath string) (bool, func(), error)
}

Manager is a housekeeping manager. It is supposed to handle housekeeping tasks for repositories such as the cleanup of unneeded files and optimizations for the repository's data structures.

type OptimizationStrategyConstructor

type OptimizationStrategyConstructor func(stats.RepositoryInfo) housekeeping.OptimizationStrategy

OptimizationStrategyConstructor is a constructor for an OptimizationStrategy that is being informed by the passed-in RepositoryInfo.

type OptimizeRepositoryConfig

type OptimizeRepositoryConfig struct {
	StrategyConstructor OptimizationStrategyConstructor
}

OptimizeRepositoryConfig is the configuration used by OptimizeRepository that is computed by applying all the OptimizeRepositoryOption modifiers.

type OptimizeRepositoryOption

type OptimizeRepositoryOption func(cfg *OptimizeRepositoryConfig)

OptimizeRepositoryOption is an option that can be passed to OptimizeRepository.

func WithOptimizationStrategyConstructor

func WithOptimizationStrategyConstructor(strategyConstructor OptimizationStrategyConstructor) OptimizeRepositoryOption

WithOptimizationStrategyConstructor changes the constructor for the optimization strategy.that is used to determine which parts of the repository will be optimized. By default the HeuristicalOptimizationStrategy is used.

type RepositoryManager

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

RepositoryManager is an implementation of the Manager interface.

func New

func New(promCfg gitalycfgprom.Config, logger log.Logger, txManager transaction.Manager) *RepositoryManager

New creates a new RepositoryManager.

func (*RepositoryManager) AddPackRefsInhibitor

func (m *RepositoryManager) AddPackRefsInhibitor(ctx context.Context, repoPath string) (successful bool, _ func(), err error)

AddPackRefsInhibitor exposes the internal function addPackRefsInhibitor on the RepositoryManager level. This can then be used by other clients to block housekeeping from running git-pack-refs(1).

func (*RepositoryManager) CleanStaleData

CleanStaleData removes any stale data in the repository as per the provided configuration.

func (*RepositoryManager) Collect

func (m *RepositoryManager) Collect(metrics chan<- prometheus.Metric)

Collect is used to collect Prometheus metrics.

func (*RepositoryManager) Describe

func (m *RepositoryManager) Describe(descs chan<- *prometheus.Desc)

Describe is used to describe Prometheus metrics.

func (*RepositoryManager) OptimizeRepository

func (m *RepositoryManager) OptimizeRepository(
	ctx context.Context,
	repo *localrepo.Repo,
	opts ...OptimizeRepositoryOption,
) error

OptimizeRepository performs optimizations on the repository. Whether optimizations are performed or not depends on a set of heuristics.

Jump to

Keyboard shortcuts

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