diskprune

package
v0.172.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 9 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 diskprune reclaims explicitly disposable disk data, keeping process references, recent data, symlinks and checkouts intact.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disposable

func Disposable(dir string, cutoff time.Time) (int64, string, error)

Disposable inspects every entry without following symlinks. An unknown directory, checkout, unreadable subtree or recent file is kept.

func InUse

func InUse(dir string, refs []string) bool

InUse reports whether a candidate contains a live reference, including references reached through a symlink. A reference to a parent alone does not make all its children busy.

func Remove

func Remove(dir string) error

Remove deletes disposable output through its parent root: an intervening symlink cannot redirect removal outside the candidate's parent.

Types

type Result

type Result struct {
	Freed   int64
	Removed int
	Moved   int64
	Staged  int
	Kept    map[string]int
	Errors  []error
}

Result is one cleanup's measured bytes and keep/error reasons.

func Children

func Children(base string, cutoff time.Time, refs []string, dry bool) Result

Children prunes stale direct children only, never the containing directory.

func Output

func Output(dir string, cutoff time.Time, refs []string, dry bool) Result

Output reclaims a known output directory, refusing checkouts, active references and data newer than cutoff. A dry run measures without writes.

func Stage

func Stage(dir, trash string, now time.Time, refs []string, dry bool) Result

Stage moves build output into trash on the same filesystem. Moving does not free bytes. The new entry starts its retention window now, even when all the output's files are old. Cross-filesystem output is retained.

func (*Result) Add

func (r *Result) Add(other Result)

Add records another cleanup in the same report.

func (*Result) Keep

func (r *Result) Keep(why string)

Keep records a reason without naming private paths in the watch line.

Jump to

Keyboard shortcuts

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