housekeeping

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package housekeeping keeps the pools healthy and the disk clean, by itself.

It never runs `git gc`: gc prunes, and a pool must never lose an object. A pool is repacked with the objects nothing points at kept in a cruft pack that never expires, and only once it has piled up enough loose objects or packs to be worth it.

Index

Constants

View Source
const MinimumUnused = 24 * time.Hour

MinimumUnused is the least a pool must have gone unused before it is retired on request.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

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

Keeper maintains the pools of one gitd, and sweeps the roots its workspaces are made in. A pool is repacked once it holds looseLimit loose objects or packLimit packs; temporary directories are looked for down to the configured sweep depth under the roots, where the deepest workspace is, and as deep as a repository's path goes under the pools.

func New

func New(
	pools *pool.Pools, templates *template.Store, overlay *strategy.OverlayMaker, runner *git.Runner, roots []string,
	settings config.Housekeeping, measured *metrics.Metrics,
) *Keeper

New returns the keeper of pools and templates, whose workspaces are made under roots.

func (*Keeper) DiskUsed

func (keeper *Keeper) DiskUsed() int64

DiskUsed is the disk pools and templates took, as of the last round: what a tenant's disk limit is held to.

func (*Keeper) Remount

func (keeper *Keeper) Remount(ctx context.Context) int

Remount mounts again the overlay workspaces that are not mounted — after a reboot, or after somebody unmounted one — and logs what it could not.

func (*Keeper) Retire

func (keeper *Keeper) Retire(ctx context.Context, unusedFor time.Duration) (int, int64)

Retire removes now every pool no workspace borrows from and nothing has used for at least unusedFor, and says how many there were and the disk they took. Totals then count the pools that are left.

func (*Keeper) Run

func (keeper *Keeper) Run(ctx context.Context)

Run maintains every pool a minute after starting, so that it does not compete with the first calls after a start, and then every so often, until ctx ends.

func (*Keeper) Sweep

func (keeper *Keeper) Sweep()

Sweep removes what a gitd that died left half built: the temporary directories and files it builds pools and workspaces in before moving them into place.

func (*Keeper) TemplateTotals

func (keeper *Keeper) TemplateTotals() (int, int64)

TemplateTotals are how many templates there were and the disk they took, as of the last round.

func (*Keeper) Totals

func (keeper *Keeper) Totals() (int, int64)

Totals are how many pools there were and the disk they took, as of the last round.

Jump to

Keyboard shortcuts

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