mem

package
v0.0.0-...-36c55c0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mem provides memory usage statistics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Darwin

type Darwin struct {
	provider.FactsAware

	VirtualMemoryFn func() (*mem.VirtualMemoryStat, error)
}

Darwin implements the Mem interface for Darwin (macOS).

func NewDarwinProvider

func NewDarwinProvider() *Darwin

NewDarwinProvider factory to create a new Darwin instance.

func (*Darwin) GetStats

func (d *Darwin) GetStats() (*Result, error)

GetStats retrieves memory statistics of the system. It returns a Stats struct with total, free, and cached memory in bytes, and an error if something goes wrong.

type Debian

type Debian struct {
	provider.FactsAware

	VirtualMemoryFn func() (*mem.VirtualMemoryStat, error)
}

Debian implements the Mem interface for Debian.

func NewDebianProvider

func NewDebianProvider() *Debian

NewDebianProvider factory to create a new Debian instance.

func (*Debian) GetStats

func (u *Debian) GetStats() (*Result, error)

GetStats retrieves memory statistics of the system. It returns a Stats struct with total, free, and cached memory in bytes, and an error if something goes wrong.

type Linux

type Linux struct {
	provider.FactsAware
}

Linux implements the Mem interface for Linux.

func NewLinuxProvider

func NewLinuxProvider() *Linux

NewLinuxProvider factory to create a new Linux instance.

func (*Linux) GetStats

func (l *Linux) GetStats() (*Result, error)

GetStats retrieves memory statistics of the system. It returns a Stats struct with total, free, and cached memory in bytes, and an error if something goes wrong.

type Provider

type Provider interface {
	// GetStats retrieves memory statistics of the system.
	GetStats() (*Result, error)
}

Provider implements the methods to interact with various Mem components.

type Result

type Result struct {
	// Total memory in bytes
	Total uint64
	// Available memory in bytes (free + reclaimable)
	Available uint64
	// Free memory in bytes
	Free uint64
	// Cached memory in bytes
	Cached uint64
	// Changed indicates whether system state was modified.
	Changed bool `json:"changed"`
}

Result holds memory information in bytes.

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