housekeeping

package
v14.9.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupWorktrees added in v14.9.0

func CleanupWorktrees(ctx context.Context, repo *localrepo.Repo) error

CleanupWorktrees cleans up stale and disconnected worktrees for the given repository.

func FixDirectoryPermissions

func FixDirectoryPermissions(ctx context.Context, path string) error

FixDirectoryPermissions does a recursive directory walk to look for directories that cannot be accessed by the current user, and tries to fix those with chmod. The motivating problem is that directories with mode 0 break os.RemoveAll.

func GetRepackGitConfig added in v14.9.0

func GetRepackGitConfig(ctx context.Context, bitmap bool) []git.ConfigPair

GetRepackGitConfig returns configuration suitable for Git commands which write new packfiles.

func IsPoolPath added in v14.9.0

func IsPoolPath(relativePath string) bool

IsPoolPath returns whether the relative path indicates the repository is an object pool.

func RepackObjects added in v14.9.0

func RepackObjects(ctx context.Context, repo *localrepo.Repo, cfg RepackObjectsConfig) error

RepackObjects repacks objects in the given repository and updates the commit-graph. The way objects are repacked is determined via the RepackObjectsConfig.

func WriteCommitGraph added in v14.9.0

func WriteCommitGraph(ctx context.Context, repo *localrepo.Repo) error

WriteCommitGraph updates the commit-graph in the given repository. The commit-graph is updated incrementally, except in the case where it doesn't exist yet or in case it is detected that the commit-graph is missing bloom filters.

Types

type Manager added in v14.9.0

type Manager interface {
	// CleanStaleData removes any stale data in the repository.
	CleanStaleData(context.Context, *localrepo.Repo) error
	// OptimizeRepository optimizes the repository's data structures such that it can be more
	// efficiently served.
	OptimizeRepository(context.Context, *localrepo.Repo) 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 RepackObjectsConfig added in v14.9.0

type RepackObjectsConfig struct {
	// FullRepack determines whether all reachable objects should be repacked into a single
	// packfile. This is much less efficient than doing incremental repacks, which only soak up
	// all loose objects into a new packfile.
	FullRepack bool
	// WriteBitmap determines whether reachability bitmaps should be written or not. There is no
	// reason to set this to `false`, except for legacy compatibility reasons with existing RPC
	// behaviour
	WriteBitmap bool
}

RepackObjectsConfig is configuration for RepackObjects.

type RepositoryManager added in v14.9.0

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

RepositoryManager is an implementation of the Manager interface.

func NewManager added in v14.9.0

func NewManager(txManager transaction.Manager) *RepositoryManager

NewManager creates a new RepositoryManager.

func (*RepositoryManager) CleanStaleData added in v14.9.0

func (m *RepositoryManager) CleanStaleData(ctx context.Context, repo *localrepo.Repo) error

CleanStaleData cleans up any stale data in the repository.

func (*RepositoryManager) Collect added in v14.9.0

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

Collect is used to collect Prometheus metrics.

func (*RepositoryManager) Describe added in v14.9.0

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

Describe is used to describe Prometheus metrics.

func (*RepositoryManager) OptimizeRepository added in v14.9.0

func (m *RepositoryManager) OptimizeRepository(ctx context.Context, repo *localrepo.Repo) 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