disk

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package disk reads the local disks of the host through gohai.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gohai added in v0.3.0

type Gohai struct {
	// Sources are what the collector reads. A zero field is the real
	// host's.
	Sources source.Sources
}

Gohai reads the usage of the host's local disks with gohai's filesystem collector, on every Linux family and on macOS.

func New added in v0.3.0

func New() *Gohai

New returns a provider that reads the real host.

func (*Gohai) GetLocalUsageStats added in v0.3.0

func (g *Gohai) GetLocalUsageStats() ([]Result, error)

GetLocalUsageStats is the total, used and free bytes of each local disk's mount. A mount without sizes, such as one that df cannot read, is left out.

type Provider

type Provider interface {
	// GetLocalUsageStats retrieves disk space statistics.
	GetLocalUsageStats() ([]Result, error)
}

Provider implements the methods to interact with various Disk components.

type Result

type Result struct {
	// Disk identifier, e.g., "/dev/sda1"
	Name string
	// Total disk space in bytes
	Total uint64
	// Used disk space in bytes
	Used uint64
	// Free disk space in bytes
	Free uint64
	// Changed indicates whether system state was modified.
	Changed bool `json:"changed"`
}

Result holds information about disk space usage.

Directories

Path Synopsis
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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