Documentation ¶
Index ¶
- func CleanupWorktrees(ctx context.Context, repo *localrepo.Repo) error
- func FixDirectoryPermissions(ctx context.Context, path string) error
- func GetRepackGitConfig(ctx context.Context, repo repository.GitRepo, bitmap bool) []git.ConfigPair
- func IsPoolRepository(repo repository.GitRepo) bool
- func IsRailsPoolRepository(repo repository.GitRepo) bool
- func RepackObjects(ctx context.Context, repo *localrepo.Repo, cfg RepackObjectsConfig) error
- func WriteCommitGraph(ctx context.Context, repo *localrepo.Repo, cfg WriteCommitGraphConfig) error
- type Manager
- type RepackObjectsConfig
- type RepositoryManager
- func (m *RepositoryManager) CleanStaleData(ctx context.Context, repo *localrepo.Repo) error
- func (m *RepositoryManager) Collect(metrics chan<- prometheus.Metric)
- func (m *RepositoryManager) Describe(descs chan<- *prometheus.Desc)
- func (m *RepositoryManager) OptimizeRepository(ctx context.Context, repo *localrepo.Repo) error
- type WriteCommitGraphConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupWorktrees ¶
CleanupWorktrees cleans up stale and disconnected worktrees for the given repository.
func FixDirectoryPermissions ¶
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 ¶
func GetRepackGitConfig(ctx context.Context, repo repository.GitRepo, bitmap bool) []git.ConfigPair
GetRepackGitConfig returns configuration suitable for Git commands which write new packfiles.
func IsPoolRepository ¶ added in v15.2.0
func IsPoolRepository(repo repository.GitRepo) bool
IsPoolRepository returns whether the repository is an object pool.
func IsRailsPoolRepository ¶ added in v15.2.0
func IsRailsPoolRepository(repo repository.GitRepo) bool
IsRailsPoolRepository returns whether the repository is a pool repository generated by Rails.
func RepackObjects ¶
RepackObjects repacks objects in the given repository and updates the commit-graph. The way objects are repacked is determined via the RepackObjectsConfig.
func WriteCommitGraph ¶
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 ¶
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 ¶
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 ¶
type RepositoryManager struct {
// contains filtered or unexported fields
}
RepositoryManager is an implementation of the Manager interface.
func NewManager ¶
func NewManager(promCfg gitalycfgprom.Config, txManager transaction.Manager) *RepositoryManager
NewManager creates a new RepositoryManager.
func (*RepositoryManager) CleanStaleData ¶
CleanStaleData cleans up any stale data in the repository.
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 ¶
OptimizeRepository performs optimizations on the repository. Whether optimizations are performed or not depends on a set of heuristics.
type WriteCommitGraphConfig ¶ added in v15.2.0
type WriteCommitGraphConfig struct { // ReplaceChain causes WriteCommitGraph to rewrite the complete commit-graph chain. This is // a lot more expensive than the default, incremental update of the commit-graph chains but // may be required in certain cases to fix up commit-graphs. ReplaceChain bool }
WriteCommitGraphConfig contains configuration that can be passed to WriteCommitGraph to alter its default behaviour.
func WriteCommitGraphConfigForRepository ¶ added in v15.2.0
func WriteCommitGraphConfigForRepository(ctx context.Context, repo *localrepo.Repo) (WriteCommitGraphConfig, error)
WriteCommitGraphConfigForRepository returns the optimal default-configuration for the given repo. By default, the configuration will ask for an incremental commit-graph update. If the preexisting commit-graph is missing bloom filters though then the whole commit-graph chain will be rewritten.