Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Darwin ¶
type Darwin struct {
provider.FactsAware
PartitionsFn func(all bool) ([]disk.PartitionStat, error)
UsageFn func(path string) (*disk.UsageStat, error)
// contains filtered or unexported fields
}
Darwin implements the Disk interface for Darwin (macOS).
func NewDarwinProvider ¶
NewDarwinProvider factory to create a new Darwin instance.
func (*Darwin) GetLocalUsageStats ¶
GetLocalUsageStats retrieves disk space statistics for local disks only. It returns a slice of Result structs, each containing the total, used, and free space in bytes for the corresponding local disk. It gracefully skips partitions where a permission error occurs (e.g., for mounts that the user cannot access without root privileges), and continues processing the remaining partitions. If a non-permission-related error occurs, the function returns an error.
type Debian ¶
type Debian struct {
provider.FactsAware
PartitionsFn func(all bool) ([]disk.PartitionStat, error)
UsageFn func(path string) (*disk.UsageStat, error)
// contains filtered or unexported fields
}
Debian implements the Mem interface for Debian.
func NewDebianProvider ¶
NewDebianProvider factory to create a new Debian instance.
func (*Debian) GetLocalUsageStats ¶
GetLocalUsageStats retrieves disk space statistics for local disks only. It returns a slice of Result structs, each containing the total, used, and free space in bytes for the corresponding local disk. It gracefully skips partitions where a permission error occurs (e.g., for mounts that the user cannot access without root privileges), and continues processing the remaining partitions. If a non-permission-related error occurs, the function returns an error.
type Linux ¶
type Linux struct {
provider.FactsAware
}
Linux implements the Disk interface for Linux.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
func (*Linux) GetLocalUsageStats ¶
GetLocalUsageStats retrieves disk space statistics for local disks only. It returns a slice of Result structs, each containing the total, used, and free space in bytes for the corresponding local disk. An error is returned if somethng goes wrong.
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.