compact

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package compact prunes old artifacts, snapshots, and checkpoints from a cloop project directory to reclaim disk space.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirSize

func DirSize(path string) (int64, error)

DirSize returns the total size of a directory tree in bytes.

Types

type Options

type Options struct {
	DryRun            bool
	KeepSnapshots     int // number of most-recent plan snapshots to keep
	KeepCheckpoints   int // task IDs no longer in plan have their checkpoints removed; this is not a count limit
	KeepArtifactsDays int // delete artifacts older than this many days for completed tasks
	TruncateStepLog   int // keep last N entries in replay.jsonl (0 = skip)
}

Options controls compaction behaviour.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the spec-mandated defaults.

type Summary

type Summary struct {
	SnapshotsBytesFreed   int64
	CheckpointsBytesFreed int64
	ArtifactsBytesFreed   int64
	StepLogBytesFreed     int64
	SnapshotsDeleted      int
	CheckpointsDeleted    int
	ArtifactsDeleted      int
	StepLogTruncated      bool
	// VerdictsDeleted and VerdictsBytesFreed count the orchestrator's verdict
	// sidecars removed from .cloop/artifacts (Task 20365).
	VerdictsDeleted    int
	VerdictsBytesFreed int64
}

Summary reports bytes freed per category.

func Run

func Run(workDir string, opts Options) (Summary, error)

Run executes compaction with the given options and returns a summary.

func (Summary) TotalBytesFreed

func (s Summary) TotalBytesFreed() int64

TotalBytesFreed returns total bytes freed across all categories.

Jump to

Keyboard shortcuts

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