Help us shape the future of Go! Take the 2026 Go Developer Survey

fsstat

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fsstat holds small, dependency-free helpers for reporting filesystem usage: human-readable byte sizes, on-disk directory accounting, and statfs capacity. They are shared by the operator inspector (mlfs-admin stats) and the standalone probe (mlfs-bench), neither of which should pull in the metadata or chunk-store packages just to print sizes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirUsage

func DirUsage(root string) (files, bytes int64)

DirUsage returns (file count, total bytes) of the regular files under root. A missing or unreadable root yields (0,0); unreadable entries are skipped, so accounting is best-effort and never fails — callers want a number, not an error, when pointing at a directory that may not exist on this node.

func HumanBytes

func HumanBytes(n int64) string

HumanBytes formats a byte count with binary (IEC) units (KiB, MiB, …).

func OldestModTime

func OldestModTime(root string) (oldest time.Time, ok bool)

OldestModTime returns the oldest modification time among the regular files directly under root (NOT recursive — the staging dir is flat, one file per staged slice), and ok=false when the directory is empty or unreadable. The write-back oldest-unflushed-age gauge reads it: a staging file's mtime is when the (durable, fsync'd) write was staged, so the oldest mtime bounds how long the oldest still-unflushed write has waited. Tmp files (dotfiles) are skipped.

func StatfsBytes

func StatfsBytes(path string) (avail, total int64)

StatfsBytes returns (available, total) bytes for the filesystem holding path, or (0,0) if it cannot be stat'd.

Types

This section is empty.

Jump to

Keyboard shortcuts

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