hostcap

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Shared (non OS-specific) helper for locating the filesystem whose capacity the agent reports as the host's tenant-data disk. The per-OS DetectDisk functions statfs this path. British English. No em dashes.

Package hostcap detects the physical box's capacity (CPU cores and total RAM) from the host's /proc, so the agent can report it to the control plane on every heartbeat. It reports HOST values, not the container's cgroup limits, so a resized VPS is reflected automatically.

Every read is defensive: a failure yields 0 for that field rather than an error, so a detection miss can never sink a status report. The control plane treats 0 as "no change" and never overwrites a known-good value with it.

British English throughout. No em dashes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect() (cpuCores float64, totalRamMb int)

Detect returns the host's CPU core count and total RAM in MB. Either may be 0 when it cannot be read; the caller omits a zero field from the report.

func DetectDisk added in v0.1.24

func DetectDisk() (totalGb, freeGb int)

DetectDisk returns the total and available space (GB) of the tenant-data filesystem (see dataDir). Either is 0 on a statfs miss, which the caller omits so it never overwrites a known value.

func QuotaEnforced added in v0.1.41

func QuotaEnforced() *bool

QuotaEnforced reports whether this host can hard-enforce a per-volume size quota: its tenant-data filesystem is xfs, mounted with prjquota, and the xfs_quota tool is available. Returns a non-nil bool on Linux (false means volume sizes are advisory only here); the caller sends it every heartbeat so operators can see which hosts actually cap disk.

Types

This section is empty.

Jump to

Keyboard shortcuts

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