diskutil

package
v0.80.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package diskutil exposes filesystem-level disk usage, shared by the local mounts browser and the streaming cache stats so neither has to embed its own statfs call (and so the streamer doesn't have to import the handlers package).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRotational

func IsRotational(path string) bool

IsRotational reports whether the block device backing path is a spinning HDD (rotational=1 in sysfs). Callers use it to avoid running parallel copies on the same HDD: concurrent reads/writes make the head seek between them and throughput collapses versus a single sequential copy.

Linux-only and best-effort: returns false on ANY failure (FUSE/rclone, overlay, unknown device, non-Linux) — i.e. "treat as non-rotational, allow parallelism" — so it never blocks a transfer, only opts into serialization when it's sure the backing device spins.

func Usage

func Usage(path string) (free, total int64)

Usage returns (free, total) bytes for the filesystem holding path. Best-effort: returns (0, 0) when statfs fails — e.g. a stale rclone mount or a path that no longer exists — so callers just omit the figure instead of erroring out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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