Documentation
¶
Overview ¶
Package hostfacts observes bounded, read-only facts about the current host.
Hostfacts reports caller-available disk capacity, the rotational class of the block device backing a directory, the Go runtime's logical CPU count, total physical memory, Go-runtime-managed memory, the effective Linux cgroup memory ceiling, logical regular-file tree extent, the presence of canonical Go runtime out-of-memory banners, the column geometry of a terminal attached to an open descriptor, the platform's own name for the host, and the platform's per-user home, configuration, cache, and temporary bases. It never changes limits, monitors resources, removes files, supervises processes, or chooses the action a caller takes from an observation.
Index ¶
- Constants
- func CurrentPlatform() (core.Platform, error)
- func TemporaryDirectory() (core.AbsolutePath, error)
- func UserCacheDirectory() (core.AbsolutePath, error)
- func UserConfigDirectory() (core.AbsolutePath, error)
- func UserHomeDirectory() (core.AbsolutePath, error)
- type DiskAssessment
- type DiskAssessmentRequest
- type DiskCapacity
- type DiskPressurePolicy
- type DiskPressureState
- type DiskRotation
- type DiskRotationRequest
- type Failure
- type GoMemoryAssessment
- type GoMemoryAssessmentRequest
- type GoMemoryPressurePolicy
- type GoMemorySnapshot
- type GoOOMBannerEvidence
- type GoOOMBannerRequest
- type GoOOMBannerState
- type Hostname
- type LogicalCPUCount
- type MemoryPressureState
- type MissingPathPolicy
- type Operation
- type Percent
- type PhysicalMemory
- type RegularFileCount
- type TerminalAttachment
- type TerminalColumns
- type TerminalGeometry
- type TerminalGeometryRequest
- type TreeUsage
- type TreeUsageRequest
- type WorkloadMemoryLimit
- func (l WorkloadMemoryLimit) InterfacePath() (core.AbsolutePath, bool)
- func (l WorkloadMemoryLimit) LimitBytes() (core.ByteLength, bool)
- func (l WorkloadMemoryLimit) Source() WorkloadMemoryLimitSource
- func (l WorkloadMemoryLimit) State() WorkloadMemoryLimitState
- func (l WorkloadMemoryLimit) Validate() error
- type WorkloadMemoryLimitSource
- type WorkloadMemoryLimitState
Constants ¶
const ( // GoOOMMaximumEvidenceBytes bounds one banner-classification source. GoOOMMaximumEvidenceBytes = 1 << 20 // GoOOMPrefixedBanner and GoOOMPlainBanner are the exact Go runtime // diagnostics recognized by ClassifyGoOOMBanner. Consumers use these // compiler-visible values when constructing boundary fixtures. GoOOMPrefixedBanner = "fatal error: runtime: out of memory" GoOOMPlainBanner = "fatal error: out of memory" )
Variables ¶
This section is empty.
Functions ¶
func CurrentPlatform ¶ added in v2026.0.4
CurrentPlatform returns the compiler-owned platform represented by the Go runtime. A runtime target outside Primitive's closed platform domain is rejected instead of being projected as an informal string.
func TemporaryDirectory ¶ added in v2026.0.42
func TemporaryDirectory() (core.AbsolutePath, error)
TemporaryDirectory reports the platform's temporary-file base for this process, admitted as an absolute path. It is where a product builds its own uniquely named scratch entries; uniqueness is the caller's to supply from keygen, because a name this door invented would be a hidden entropy source.
func UserCacheDirectory ¶ added in v2026.0.47
func UserCacheDirectory() (core.AbsolutePath, error)
UserCacheDirectory reports the platform's per-user cache base: the XDG, Library, or AppData rules the standard library already encodes, admitted as an absolute path. Products place their own named subdirectory below it; this door owns only where the base is. Entries below it are disposable by the platform's own convention, so nothing load-bearing belongs there.
func UserConfigDirectory ¶ added in v2026.0.42
func UserConfigDirectory() (core.AbsolutePath, error)
UserConfigDirectory reports the platform's per-user configuration base: the XDG, HOME, or AppData rules the standard library already encodes, admitted as an absolute path. Products place their own named subdirectory below it; this door owns only where the base is.
func UserHomeDirectory ¶ added in v2026.0.47
func UserHomeDirectory() (core.AbsolutePath, error)
UserHomeDirectory reports the platform's home directory for the current user: the HOME, USERPROFILE, or account-database rules the standard library already encodes, admitted as an absolute path. It is a base for platform-conventional entries a product must resolve, such as a tool cache a host tool already keeps there; a product's own data belongs under the configuration or cache base, not loose in the home.
Types ¶
type DiskAssessment ¶
type DiskAssessment struct {
// contains filtered or unexported fields
}
DiskAssessment is the validated capacity, policy, and classification.
func AssessDisk ¶
func AssessDisk(ctx context.Context, request DiskAssessmentRequest) (DiskAssessment, error)
AssessDisk observes capacity through one held directory capability and classifies it against caller policy.
func (DiskAssessment) Capacity ¶
func (a DiskAssessment) Capacity() DiskCapacity
Capacity returns the observed capacity.
func (DiskAssessment) Policy ¶
func (a DiskAssessment) Policy() DiskPressurePolicy
Policy returns the caller policy used for classification.
func (DiskAssessment) State ¶
func (a DiskAssessment) State() DiskPressureState
State returns the closed pressure state.
func (DiskAssessment) Validate ¶
func (a DiskAssessment) Validate() error
Validate closes the assessment shape.
type DiskAssessmentRequest ¶
type DiskAssessmentRequest struct {
Directory core.AbsolutePath
Policy DiskPressurePolicy
}
DiskAssessmentRequest binds one exact directory to one caller policy.
func (DiskAssessmentRequest) Validate ¶
func (r DiskAssessmentRequest) Validate() error
Validate rejects an unset or malformed directory and invalid policy.
type DiskCapacity ¶
type DiskCapacity struct {
// contains filtered or unexported fields
}
DiskCapacity is caller-available and total capacity for one held directory.
func (DiskCapacity) AvailableBytes ¶
func (c DiskCapacity) AvailableBytes() core.ByteLength
AvailableBytes returns capacity available to the current caller.
func (DiskCapacity) TotalBytes ¶
func (c DiskCapacity) TotalBytes() core.ByteCount
TotalBytes returns the filesystem's total byte capacity.
func (DiskCapacity) Validate ¶
func (c DiskCapacity) Validate() error
Validate rejects an unset total or caller-available bytes above total.
type DiskPressurePolicy ¶
type DiskPressurePolicy struct {
FreeSpaceFloor core.ByteLength
}
DiskPressurePolicy is the caller-owned available-space floor. A zero floor disables pressure classification without disabling capacity observation.
func (DiskPressurePolicy) Validate ¶
func (p DiskPressurePolicy) Validate() error
Validate rejects a floor outside Go's signed size domain.
type DiskPressureState ¶
type DiskPressureState uint8
DiskPressureState classifies caller-available capacity against a floor.
const ( DiskPressureUnknown DiskPressureState = iota DiskPressureDisabled DiskPressureHealthy DiskPressureReached )
func (DiskPressureState) IsValid ¶
func (s DiskPressureState) IsValid() bool
IsValid reports membership in the closed pressure domain.
func (DiskPressureState) OffWireEnum ¶
func (DiskPressureState) OffWireEnum()
OffWireEnum declares DiskPressureState as a runtime assessment rather than a wire encoding.
func (DiskPressureState) String ¶
func (s DiskPressureState) String() string
String returns the compiler-owned diagnostic label for s.
func (DiskPressureState) Validate ¶
func (s DiskPressureState) Validate() error
Validate rejects states outside the closed domain.
type DiskRotation ¶ added in v2026.0.47
type DiskRotation uint8
DiskRotation is the closed set of answers to one capacity-planning question: does the block device backing a directory rotate?
Closed rather than boolean because a host can decline to answer two different ways: an operating system with no portable interface is unsupported, and a directory no single block device backs, such as an overlay or a network mount, is unavailable. A caller planning I/O treats both as unknown; a caller recording host facts records which one it observed.
const ( // DiskRotationUnknown is outside the admitted domain. DiskRotationUnknown DiskRotation = iota // DiskRotationUnsupported reports an operating system with no portable // rotation interface. DiskRotationUnsupported // but names no single block device behind this directory. DiskRotationUnavailable // DiskRotationRotational reports a spinning device. DiskRotationRotational // DiskRotationNonRotational reports a device that does not spin. DiskRotationNonRotational )
func ObserveDiskRotation ¶ added in v2026.0.47
func ObserveDiskRotation(ctx context.Context, request DiskRotationRequest) (DiskRotation, error)
ObserveDiskRotation reports whether the block device backing one held directory is rotational.
The backing device's identity comes from the same held capability every other disk observation opens, and on Linux the answer comes from the kernel's own block-device index, so no mount-table text or device-name heuristic ever decides which disk a directory lives on. A directory no single block device backs answers unavailable; an operating system with no portable rotation interface answers unsupported after validating the directory the same way. Both are observations a caller records, never errors to swallow.
func (DiskRotation) IsValid ¶ added in v2026.0.47
func (r DiskRotation) IsValid() bool
IsValid reports membership in the closed rotation domain.
func (DiskRotation) OffWireEnum ¶ added in v2026.0.47
func (DiskRotation) OffWireEnum()
OffWireEnum declares DiskRotation as a runtime observation rather than a wire encoding.
func (DiskRotation) String ¶ added in v2026.0.47
func (r DiskRotation) String() string
String returns the compiler-owned diagnostic label for r.
func (DiskRotation) Validate ¶ added in v2026.0.47
func (r DiskRotation) Validate() error
Validate rejects rotations outside the closed domain.
type DiskRotationRequest ¶ added in v2026.0.47
type DiskRotationRequest struct {
Directory core.AbsolutePath
}
DiskRotationRequest binds the observation to one exact directory.
func (DiskRotationRequest) Validate ¶ added in v2026.0.47
func (r DiskRotationRequest) Validate() error
Validate rejects an unset or malformed directory.
type Failure ¶
type Failure struct {
Cause error
Identity core.ErrorIdentity
Operation Operation
}
Failure carries the typed operation while preserving stable and native causes through errors.Is and errors.As.
type GoMemoryAssessment ¶
type GoMemoryAssessment struct {
// contains filtered or unexported fields
}
GoMemoryAssessment is a validated snapshot, trigger, policy, and state.
func AssessGoMemory ¶
func AssessGoMemory(request GoMemoryAssessmentRequest) (GoMemoryAssessment, error)
AssessGoMemory observes the exact Go soft-limit accounting metric and classifies it against caller policy. Its runtime.ReadMemStats call briefly stops all application goroutines to obtain an up-to-date snapshot.
func (GoMemoryAssessment) Policy ¶
func (a GoMemoryAssessment) Policy() GoMemoryPressurePolicy
Policy returns the caller policy.
func (GoMemoryAssessment) Snapshot ¶
func (a GoMemoryAssessment) Snapshot() GoMemorySnapshot
Snapshot returns the observed Go runtime facts.
func (GoMemoryAssessment) State ¶
func (a GoMemoryAssessment) State() MemoryPressureState
State returns the closed pressure state.
func (GoMemoryAssessment) TriggerBytes ¶
func (a GoMemoryAssessment) TriggerBytes() core.ByteCount
TriggerBytes returns the projected trigger.
func (GoMemoryAssessment) Validate ¶
func (a GoMemoryAssessment) Validate() error
Validate closes the assessment shape and independently reprojects trigger.
type GoMemoryAssessmentRequest ¶
type GoMemoryAssessmentRequest struct {
Policy GoMemoryPressurePolicy
}
GoMemoryAssessmentRequest carries one caller policy.
func (GoMemoryAssessmentRequest) Validate ¶
func (r GoMemoryAssessmentRequest) Validate() error
Validate rejects an invalid policy.
type GoMemoryPressurePolicy ¶
type GoMemoryPressurePolicy struct {
TriggerPercent Percent
}
GoMemoryPressurePolicy owns the caller's Go-memory trigger percentage.
func (GoMemoryPressurePolicy) TriggerBytes ¶
TriggerBytes projects the policy over a positive observed limit using exact upward rounding.
func (GoMemoryPressurePolicy) Validate ¶
func (p GoMemoryPressurePolicy) Validate() error
Validate rejects an invalid percentage.
type GoMemorySnapshot ¶
type GoMemorySnapshot struct {
// contains filtered or unexported fields
}
GoMemorySnapshot is the exact Go runtime memory-limit accounting fact.
func (GoMemorySnapshot) HeapReleasedBytes ¶
func (s GoMemorySnapshot) HeapReleasedBytes() core.ByteLength
HeapReleasedBytes returns runtime.MemStats.HeapReleased.
func (GoMemorySnapshot) LimitBytes ¶
func (s GoMemorySnapshot) LimitBytes() core.ByteCount
LimitBytes returns the current Go soft memory limit.
func (GoMemorySnapshot) ManagedBytes ¶
func (s GoMemorySnapshot) ManagedBytes() core.ByteLength
ManagedBytes returns Sys minus HeapReleased.
func (GoMemorySnapshot) SystemBytes ¶
func (s GoMemorySnapshot) SystemBytes() core.ByteCount
SystemBytes returns runtime.MemStats.Sys.
func (GoMemorySnapshot) Validate ¶
func (s GoMemorySnapshot) Validate() error
Validate closes every arithmetic relationship in the snapshot.
type GoOOMBannerEvidence ¶
type GoOOMBannerEvidence struct {
// contains filtered or unexported fields
}
GoOOMBannerEvidence is bounded, persistable banner-presence evidence.
func ClassifyGoOOMBanner ¶
func ClassifyGoOOMBanner(ctx context.Context, request GoOOMBannerRequest) (GoOOMBannerEvidence, error)
ClassifyGoOOMBanner consumes exactly the declared bounded extent and reports only canonical Go runtime OOM banner presence.
func (GoOOMBannerEvidence) BytesExamined ¶
func (e GoOOMBannerEvidence) BytesExamined() core.ByteLength
BytesExamined returns the exact declared extent consumed.
func (GoOOMBannerEvidence) MarshalJSON ¶
func (e GoOOMBannerEvidence) MarshalJSON() ([]byte, error)
MarshalJSON emits one canonical object.
func (GoOOMBannerEvidence) State ¶
func (e GoOOMBannerEvidence) State() GoOOMBannerState
State returns banner presence or absence.
func (*GoOOMBannerEvidence) UnmarshalJSON ¶
func (e *GoOOMBannerEvidence) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts only the canonical object and preserves the receiver on refusal.
func (GoOOMBannerEvidence) Validate ¶
func (e GoOOMBannerEvidence) Validate() error
Validate rejects evidence that the production classifier could not emit.
type GoOOMBannerRequest ¶
type GoOOMBannerRequest struct {
Source io.Reader
Length core.ByteLength
}
GoOOMBannerRequest declares the exact source extent to examine.
func (GoOOMBannerRequest) Validate ¶
func (r GoOOMBannerRequest) Validate() error
Validate rejects a nil source or an extent beyond the production bound.
type GoOOMBannerState ¶
type GoOOMBannerState uint8
GoOOMBannerState reports only whether a canonical Go runtime OOM banner was present. It does not claim that a process terminated or identify its cause.
const ( GoOOMBannerUnknown GoOOMBannerState = iota GoOOMBannerAbsent GoOOMBannerPresent )
func (GoOOMBannerState) IsValid ¶
func (s GoOOMBannerState) IsValid() bool
IsValid reports membership in the closed wire domain.
func (GoOOMBannerState) MarshalJSON ¶
func (s GoOOMBannerState) MarshalJSON() ([]byte, error)
MarshalJSON emits the canonical state token.
func (GoOOMBannerState) String ¶
func (s GoOOMBannerState) String() string
String returns the canonical wire token or "unknown" for an invalid value.
func (*GoOOMBannerState) UnmarshalJSON ¶
func (s *GoOOMBannerState) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts one canonical state token without mutating on refusal.
func (GoOOMBannerState) Validate ¶
func (s GoOOMBannerState) Validate() error
Validate rejects states outside the closed domain.
type Hostname ¶ added in v2026.0.42
type Hostname struct {
// contains filtered or unexported fields
}
Hostname is the platform's reported name for this host, bounded and free of control bytes. It is a label for diagnostics and device records, never a network identity claim: nothing here resolved it or proved it reachable.
func ObserveHostname ¶ added in v2026.0.42
ObserveHostname reports the platform's name for this host. An empty, oversized, or control-carrying answer is a failed observation rather than a value, because a device record built from it would carry bytes no label admission downstream should ever meet.
type LogicalCPUCount ¶ added in v2026.0.95
type LogicalCPUCount struct {
// contains filtered or unexported fields
}
LogicalCPUCount is the Go runtime's immutable observation of the logical CPUs available to the current process. It is a host fact, not a worker or scheduling policy.
func ObserveLogicalCPUCount ¶ added in v2026.0.95
func ObserveLogicalCPUCount() (LogicalCPUCount, error)
ObserveLogicalCPUCount reports the logical CPU count exposed by Go's runtime. Consumers retain ownership of any worker-budget policy derived from this observation.
func (LogicalCPUCount) Int ¶ added in v2026.0.95
func (c LogicalCPUCount) Int() int
Int returns the observed logical-CPU count.
func (LogicalCPUCount) Validate ¶ added in v2026.0.95
func (c LogicalCPUCount) Validate() error
Validate rejects an absent logical-CPU observation.
type MemoryPressureState ¶
type MemoryPressureState uint8
MemoryPressureState classifies Go-managed bytes against a projected trigger.
const ( MemoryPressureUnknown MemoryPressureState = iota MemoryPressureDisabled MemoryPressureHealthy MemoryPressureReached )
func (MemoryPressureState) IsValid ¶
func (s MemoryPressureState) IsValid() bool
IsValid reports membership in the closed pressure domain.
func (MemoryPressureState) OffWireEnum ¶
func (MemoryPressureState) OffWireEnum()
OffWireEnum declares MemoryPressureState as a runtime assessment rather than a wire encoding.
func (MemoryPressureState) String ¶
func (s MemoryPressureState) String() string
String returns the compiler-owned diagnostic label for s.
func (MemoryPressureState) Validate ¶
func (s MemoryPressureState) Validate() error
Validate rejects states outside the closed domain.
type MissingPathPolicy ¶
type MissingPathPolicy uint8
MissingPathPolicy controls the exact missing-root behavior.
const ( MissingPathUnknown MissingPathPolicy = iota MissingPathReject MissingPathIsEmpty )
func (MissingPathPolicy) IsValid ¶
func (p MissingPathPolicy) IsValid() bool
IsValid reports membership in the closed missing-path policy domain.
func (MissingPathPolicy) OffWireEnum ¶
func (MissingPathPolicy) OffWireEnum()
OffWireEnum declares MissingPathPolicy as traversal execution policy rather than a wire encoding.
func (MissingPathPolicy) String ¶
func (p MissingPathPolicy) String() string
String returns the compiler-owned diagnostic label for p.
func (MissingPathPolicy) Validate ¶
func (p MissingPathPolicy) Validate() error
Validate rejects policies outside the closed domain.
type Operation ¶
type Operation uint8
Operation identifies the exact Hostfacts operation that failed.
const ( OperationUnknown Operation = iota OperationOpenRoot OperationDiskCapacity OperationGoMemory OperationPhysicalMemory OperationCgroupMembership OperationCgroupMount OperationCgroupLimit OperationTreeWalk OperationGoOOMBanner OperationTerminalGeometry OperationDiskRotation OperationLogicalCPUCount )
func (Operation) OffWireEnum ¶
func (Operation) OffWireEnum()
OffWireEnum declares Operation as an in-process failure classification rather than a wire encoding.
type Percent ¶
type Percent struct {
// contains filtered or unexported fields
}
Percent is a Hostfacts-owned whole percentage in the closed range 1..100.
func NewPercent ¶
NewPercent constructs a validated whole percentage.
type PhysicalMemory ¶ added in v2026.0.5
type PhysicalMemory struct {
// contains filtered or unexported fields
}
PhysicalMemory is the operating system's current total physical-memory fact. It is immutable after observation and excludes runtime and workload limits, which have separate owners in this package.
func ObservePhysicalMemory ¶ added in v2026.0.5
func ObservePhysicalMemory(ctx context.Context) (PhysicalMemory, error)
ObservePhysicalMemory observes total physical memory through the operating system interface owned by the current platform.
func (PhysicalMemory) TotalBytes ¶ added in v2026.0.5
func (m PhysicalMemory) TotalBytes() core.ByteLength
TotalBytes returns the observed total physical-memory extent.
func (PhysicalMemory) Validate ¶ added in v2026.0.5
func (m PhysicalMemory) Validate() error
Validate rejects an absent or numerically invalid physical-memory fact.
type RegularFileCount ¶
type RegularFileCount struct {
// contains filtered or unexported fields
}
RegularFileCount is a Hostfacts-owned count. Its zero value is valid.
func (RegularFileCount) Uint64 ¶
func (c RegularFileCount) Uint64() uint64
Uint64 returns the count.
func (RegularFileCount) Validate ¶
func (RegularFileCount) Validate() error
Validate accepts the complete unsigned domain.
type TerminalAttachment ¶ added in v2026.0.33
type TerminalAttachment uint8
TerminalAttachment is the closed set of things one interrogated descriptor can turn out to be.
Closed rather than a boolean because the zero value must be rejectable: a geometry whose attachment was never observed is not the same fact as a descriptor that was observed to be detached, and a bool would collapse the two.
const ( // TerminalAttachmentUnknown is the unset attachment and describes nothing. TerminalAttachmentUnknown TerminalAttachment = iota // TerminalAttachmentTerminal means the descriptor answered the geometry // question: it is attached to a terminal with a usable column count. TerminalAttachmentTerminal // TerminalAttachmentNotTerminal means the descriptor is not attached to a // terminal at all: it is a pipe, a regular file, or a device that is not a // terminal. The kernel named that case itself, so nobody who asked for a // width should also be told a terminal was there. TerminalAttachmentNotTerminal // TerminalAttachmentTerminalWithoutGeometry means the descriptor answered // as a terminal but reported no usable width. Attachment was positively // observed; geometry was not. A fresh pseudo terminal reports zero columns // until someone sets its window size, and recording that as "not a // terminal" would be a detachment nobody observed: a caller deciding // whether it may draw interactively must see the terminal, and only the // width question stays unanswered. TerminalAttachmentTerminalWithoutGeometry )
func (TerminalAttachment) IsValid ¶ added in v2026.0.33
func (a TerminalAttachment) IsValid() bool
IsValid reports membership in the closed attachment domain.
func (TerminalAttachment) OffWireEnum ¶ added in v2026.0.33
func (TerminalAttachment) OffWireEnum()
OffWireEnum declares TerminalAttachment as an in-process observation vocabulary. It names what a caller found on this machine and is never serialized.
func (TerminalAttachment) String ¶ added in v2026.0.33
func (a TerminalAttachment) String() string
String names the attachment for diagnostics.
func (TerminalAttachment) Validate ¶ added in v2026.0.33
func (a TerminalAttachment) Validate() error
Validate rejects the unset attachment and every value outside the closed set.
type TerminalColumns ¶ added in v2026.0.33
type TerminalColumns uint16
TerminalColumns is the column count of one attached terminal.
The value is bounded by the kernel's window-size structure, which reports columns as an unsigned 16-bit integer on every supported platform, so the type carries exactly the domain the observation can produce. Zero is not a column count: a terminal reporting zero columns has no usable geometry and is reported as exactly that rather than as a zero-width terminal a renderer would divide by.
func (TerminalColumns) IsValid ¶ added in v2026.0.33
func (c TerminalColumns) IsValid() bool
IsValid reports whether c is a usable column count.
func (TerminalColumns) OffWireEnum ¶ added in v2026.0.37
func (TerminalColumns) OffWireEnum()
OffWireEnum declares TerminalColumns as an in-process observation that is never serialized: a renderer reads the width and draws, and nothing durable or wire-bound carries it.
func (TerminalColumns) String ¶ added in v2026.0.37
func (c TerminalColumns) String() string
String renders the column count for diagnostics.
func (TerminalColumns) Validate ¶ added in v2026.0.33
func (c TerminalColumns) Validate() error
Validate rejects the zero column count.
type TerminalGeometry ¶ added in v2026.0.33
type TerminalGeometry struct {
// contains filtered or unexported fields
}
TerminalGeometry is one observed descriptor. Its fields are unexported and reachable only through accessors that revalidate, so a caller cannot assemble an observation it never made.
func ObserveTerminalGeometry ¶ added in v2026.0.33
func ObserveTerminalGeometry(request TerminalGeometryRequest) (TerminalGeometry, error)
ObserveTerminalGeometry reports whether one open descriptor is attached to a terminal, and the terminal's column count when it is.
Detachment is an observation rather than a failure: a renderer deciding how wide to draw needs "you are piped" as an answer, not an error to swallow. The request is refused when the descriptor cannot be interrogated at all, because the caller must not record a detachment nobody observed.
func (TerminalGeometry) Attachment ¶ added in v2026.0.33
func (g TerminalGeometry) Attachment() (TerminalAttachment, error)
Attachment returns what the descriptor turned out to be.
func (TerminalGeometry) Columns ¶ added in v2026.0.33
func (g TerminalGeometry) Columns() (TerminalColumns, error)
Columns returns the attached terminal's column count.
Only an attached terminal with geometry has one. A detached descriptor and a terminal that reported no usable width are both refused rather than answered with zero, which a renderer would treat as a real width.
func (TerminalGeometry) Validate ¶ added in v2026.0.33
func (g TerminalGeometry) Validate() error
Validate rejects a geometry whose attachment and column count disagree.
type TerminalGeometryRequest ¶ added in v2026.0.33
TerminalGeometryRequest names the open file whose descriptor is interrogated.
func (TerminalGeometryRequest) Validate ¶ added in v2026.0.33
func (r TerminalGeometryRequest) Validate() error
Validate rejects a request naming no file.
type TreeUsage ¶
type TreeUsage struct {
// contains filtered or unexported fields
}
TreeUsage is the logical extent and entry count of regular files.
func MeasureTree ¶
func MeasureTree(ctx context.Context, request TreeUsageRequest) (TreeUsage, error)
MeasureTree measures logical regular-file extent and count beneath one held root without following links, reparse points, or crossing volumes.
func (TreeUsage) RegularFileBytes ¶
func (u TreeUsage) RegularFileBytes() core.ByteLength
RegularFileBytes returns logical regular-file bytes.
func (TreeUsage) RegularFileCount ¶
func (u TreeUsage) RegularFileCount() RegularFileCount
RegularFileCount returns the typed regular-file count.
type TreeUsageRequest ¶
type TreeUsageRequest struct {
Root core.AbsolutePath
MissingPolicy MissingPathPolicy
}
TreeUsageRequest binds one root to one missing-path policy.
func (TreeUsageRequest) Validate ¶
func (r TreeUsageRequest) Validate() error
Validate rejects an unset root or policy.
type WorkloadMemoryLimit ¶
type WorkloadMemoryLimit struct {
// contains filtered or unexported fields
}
WorkloadMemoryLimit is the effective cgroup hard limit for the current membership. A Limited result may carry zero bytes.
func ObserveEffectiveWorkloadMemoryLimit ¶
func ObserveEffectiveWorkloadMemoryLimit(ctx context.Context) (WorkloadMemoryLimit, error)
ObserveEffectiveWorkloadMemoryLimit observes the current Linux cgroup membership and folds finite memory ceilings from that cgroup through its mounted ancestors. Other operating systems return an Unsupported result.
func (WorkloadMemoryLimit) InterfacePath ¶
func (l WorkloadMemoryLimit) InterfacePath() (core.AbsolutePath, bool)
InterfacePath returns the exact interface file that supplied the effective finite limit, or the closest present interface when every declaration is unlimited.
func (WorkloadMemoryLimit) LimitBytes ¶
func (l WorkloadMemoryLimit) LimitBytes() (core.ByteLength, bool)
LimitBytes returns a present limit, including a valid zero-byte limit.
func (WorkloadMemoryLimit) Source ¶
func (l WorkloadMemoryLimit) Source() WorkloadMemoryLimitSource
Source returns the kernel interface source.
func (WorkloadMemoryLimit) State ¶
func (l WorkloadMemoryLimit) State() WorkloadMemoryLimitState
State returns the availability and limit state.
func (WorkloadMemoryLimit) Validate ¶
func (l WorkloadMemoryLimit) Validate() error
Validate closes state, source, path, and value combinations.
type WorkloadMemoryLimitSource ¶
type WorkloadMemoryLimitSource uint8
WorkloadMemoryLimitSource identifies the kernel interface used.
const ( WorkloadMemoryLimitSourceUnknown WorkloadMemoryLimitSource = iota WorkloadMemoryLimitSourceNone WorkloadMemoryLimitSourceCgroupV2 WorkloadMemoryLimitSourceCgroupV1 )
func (WorkloadMemoryLimitSource) IsValid ¶
func (s WorkloadMemoryLimitSource) IsValid() bool
IsValid reports membership in the closed source domain.
func (WorkloadMemoryLimitSource) OffWireEnum ¶
func (WorkloadMemoryLimitSource) OffWireEnum()
OffWireEnum declares WorkloadMemoryLimitSource as a runtime observation rather than a wire encoding.
func (WorkloadMemoryLimitSource) String ¶
func (s WorkloadMemoryLimitSource) String() string
String returns the compiler-owned diagnostic label for s.
func (WorkloadMemoryLimitSource) Validate ¶
func (s WorkloadMemoryLimitSource) Validate() error
Validate rejects sources outside the closed domain.
type WorkloadMemoryLimitState ¶
type WorkloadMemoryLimitState uint8
WorkloadMemoryLimitState classifies availability and limit presence.
const ( WorkloadMemoryLimitUnknown WorkloadMemoryLimitState = iota WorkloadMemoryLimitUnsupported WorkloadMemoryLimitUnlimited WorkloadMemoryLimitLimited )
func (WorkloadMemoryLimitState) IsValid ¶
func (s WorkloadMemoryLimitState) IsValid() bool
IsValid reports membership in the closed state domain.
func (WorkloadMemoryLimitState) OffWireEnum ¶
func (WorkloadMemoryLimitState) OffWireEnum()
OffWireEnum declares WorkloadMemoryLimitState as a runtime observation rather than a wire encoding.
func (WorkloadMemoryLimitState) String ¶
func (s WorkloadMemoryLimitState) String() string
String returns the compiler-owned diagnostic label for s.
func (WorkloadMemoryLimitState) Validate ¶
func (s WorkloadMemoryLimitState) Validate() error
Validate rejects states outside the closed domain.