manager

package
v18.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 23 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
	// OffloadRepository offloads the repository objects onto a second storage
	OffloadRepository(context.Context, *localrepo.Repo, config.OffloadingConfig) error
	// RehydrateRepository restores an offloaded repository by downloading objects from remote storage
	// back to local storage. The prefix parameter specifies the object prefix in the remote storage
	// where the repository objects are stored.
	RehydrateRepository(context.Context, *localrepo.Repo, string) 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, node storage.Node) *RepositoryManager

New creates a new RepositoryManager.

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) OffloadRepository

func (m *RepositoryManager) OffloadRepository(ctx context.Context, repo *localrepo.Repo, cfg config.OffloadingConfig) error

OffloadRepository tells a transaction that this repository needs to be offloaded with the specified configuration.

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.

func (*RepositoryManager) RehydrateRepository

func (m *RepositoryManager) RehydrateRepository(ctx context.Context, repo *localrepo.Repo, prefix string) error

RehydrateRepository restores an offloaded repository by downloading objects from remote storage back to local storage.

The `prefix` parameter identifies the path in remote storage where the repository’s objects are located. It is derived by removing the GoCloudURL prefix from the configured remote.offload.url.

For example:

  • Git config: remote.offload.url = "gcp://my_bucket/@hash/11/22/112233abc.git/my_uuid"
  • Gitaly config: GoCloudURL = "gcp://my_bucket" then, Prefix is "@hash/11/22/112233abc.git/my_uuid"

Jump to

Keyboard shortcuts

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