filetree

package
v0.0.0-...-31f31c2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filetree streams every layer's tar headers (bodies are never read) and diffs the resulting file trees across layers to find wasted bytes: files that a later layer overwrites or deletes (OCI whiteouts), which still ship in the image. It also derives per-layer file counts and the overall efficiency score.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Score

func Score(wasted, total int64) float64

Score computes the base efficiency score: the share of shipped file bytes that are actually live in the final filesystem, scaled to 0-100.

Types

type LayerStats

type LayerStats struct {
	FileCount   int
	WastedBytes int64 // bytes in this layer that a later layer shadows or deletes
}

LayerStats is the per-layer output of the analysis.

type Result

type Result struct {
	PerLayer        []LayerStats
	WastedFiles     []report.WastedFile
	WastedBytes     int64
	TotalFileBytes  int64 // sum of all regular-file bytes across all layers
	EfficiencyScore float64
	OSRelease       map[string]string // parsed /etc/os-release (ID, VERSION_ID, PRETTY_NAME, ...)
}

Result is the full filetree analysis.

func Analyze

func Analyze(img v1.Image) (*Result, error)

Analyze streams all layers in order and computes the diff.

Jump to

Keyboard shortcuts

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