treestat

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package treestat counts regular files and bytes under a directory. The source agent and the control plane both use it so the two sides of a comparison measure identically.

Index

Constants

This section is empty.

Variables

View Source
var ErrLimit = errors.New("treestat: tree exceeds the scan limits")

ErrLimit means a walk stopped because the tree was larger or deeper than allowed.

Functions

This section is empty.

Types

type Limits

type Limits struct {
	MaxEntries int64
	MaxDepth   int
}

Limits bound a walk; a zero field means unlimited.

type Stat

type Stat struct {
	Files int64
	Bytes int64
}

Stat is the file count and total size of a tree.

func Walk

func Walk(ctx context.Context, root string) (Stat, error)

Walk totals regular files under root. Symlinks and special files are not followed or counted. The first unreadable entry is returned with the totals gathered so far.

func WalkLimited

func WalkLimited(ctx context.Context, root string, lim Limits) (Stat, error)

WalkLimited is Walk that fails with ErrLimit instead of walking past lim.

Jump to

Keyboard shortcuts

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