Documentation
¶
Overview ¶
Package format defines the microfat binary trailer, index structure, integrity verification, diagnostics classification, and serialization logic.
Package format defines the microfat binary trailer, index structure, integrity verification, and serialization logic.
Index ¶
- Constants
- Variables
- func DiagnoseError(stage string, err error) string
- func EscapeJSONString(s string) string
- func ExtractErrno(err error) (int, string)
- func IsFatBinary(r io.ReaderAt, totalSize int64) bool
- func MarshalBinaryIndex(idx *Index) ([]byte, error)
- func NormalizeVariant(level string) string
- func OpenAndValidateCacheDirFD(dir string, allowRemediate bool) (int, error)
- func ResolveCacheDir(customDir string) (string, error)
- func ResolveCacheDirFD(customDir string) (int, string, error)
- func ResolveExistingCacheDir(customDir string) (string, error)
- func ResolveExistingCacheDirFD(customDir string) (int, string, error)
- func ValidateChecksum(s string) bool
- func WriteIndexAndTrailer(w io.Writer, idx *Index, currentOffset int64) (int64, error)
- func WriteIndexAndTrailerWithVersion(w io.Writer, idx *Index, currentOffset int64, version int) (int64, error)
- type BinaryInfo
- type CgroupInfo
- type DispatchError
- type DispatchTelemetry
- type ErrorTelemetry
- type ExecutionAttempt
- type Index
- type PrewarmResult
- type PrewarmTelemetry
- type RuntimeCandidate
- type RuntimeEnvironmentValue
- type RuntimeInfo
- type RuntimeTuningInfo
- type VariantEntry
Constants ¶
const ( // InsecureCacheWriteBits identifies group and world write permission bits that are forbidden on cache directories. InsecureCacheWriteBits = 0o022 // PermissionMask extracts standard Unix permission bits (0777). PermissionMask = 0o777 )
const ( StageMemfdCreate = "memfd_create" StageMemfdSeal = "memfd_seal" StageMemfdExtract = "extract_memfd" StageMemfdExec = "execve_memfd" StageCacheDirInit = "cache_dir_init" StageCacheCreateTemp = "cache_create_temp" StageCacheExtract = "cache_extract" StageCacheExec = "execve_cache" StageCodecLookup = "codec_lookup" StageDecompress = "decompress" StageLauncherMain = "launcher_main" )
Standard launcher execution stage names.
const ( HintMemfdEPERM = "memfd_create failed with EPERM. " + "Possible causes include host security policy, seccomp filters, or container profile restrictions. " + "If disk cache execution is permitted, run with MICROFAT_EXEC_MODE=cache." HintMemfdEACCES = "memfd_create failed with EACCES. " + "Possible causes include permission restrictions or kernel memfd policy limits. " + "If disk cache execution is permitted, run with MICROFAT_EXEC_MODE=cache." HintMemfdSeal = "memfd sealing (F_ADD_SEALS) failed or was restricted by kernel security policy. " + "If disk cache execution is permitted, run with MICROFAT_EXEC_MODE=cache, or adjust kernel sealing permissions." HintMemfdKernelUnsupported = "memfd_create is unsupported on this Linux kernel or disabled (ENOSYS). " + "If disk cache execution is permitted, run with MICROFAT_EXEC_MODE=cache." HintFileDescriptorLimit = "File descriptor limit reached. " + "Increase nofile limits (ulimit -n) or free open file descriptors." HintReadOnlyFS = "Read-only filesystem detected. " + "Set $MICROFAT_CACHE_DIR or $TMPDIR to a writable tmpfs/volume." HintCacheUnwritable = "Unable to write cached binary. " + "Ensure $XDG_CACHE_HOME or $TMPDIR is writable, or mount a writable tmpfs." HintDiskFull = "No space left on device. " + "Free disk space in cache directory or set $MICROFAT_CACHE_DIR to a volume with available space." HintExecEACCES = "execve failed with EACCES. " + "Possible causes include missing execute permissions, a 'noexec' filesystem mount, or security policy restrictions." HintExecEPERM = "execve failed with EPERM. " + "Possible causes include security policy (seccomp, LSM/AppArmor/SELinux), or container execution restrictions." HintTextBusy = "Binary is currently open for writing by another process (ETXTBSY). " + "Retrying or prewarming with --microfat:prewarm avoids concurrency contention." HintExecFormat = "Binary format is invalid or incompatible with host kernel/architecture." HintUnsupportedCodec = "Binary variant uses an unsupported compression algorithm. " + "Update microfat launcher stub or re-package with a supported codec (e.g. zstd, lz4, none)." HintDecompressFailed = "Payload decompression failed or corrupted. " + "Re-package the binary with 'microfat pack' or verify integrity with 'microfat verify'." HintInsecureCacheDir = "Cache directory has insecure permissions, is a symlink, or is owned by another user. " + "Use a private directory owned by your UID with mode 0700 or set MICROFAT_CACHE_DIR." // Deprecated compatibility aliases: HintMemfdSeccomp = HintMemfdEPERM HintExecNoExec = HintExecEACCES )
Standard diagnostic remediation hints for operator troubleshooting.
const ( // MagicString identifies a microfat-enabled fat executable. MagicString = "\x00\xFA\x7FMICRO" // TrailerSize is the fixed size of the trailer at EOF: // 8 bytes IndexOffset + 8 bytes IndexSize + 32 bytes IndexSHA256 + 8 bytes Magic. TrailerSize = 56 // OffsetLen is length in bytes of uint64 fields in trailer. OffsetLen = 8 // SizeLen is length in bytes of uint64 size fields in trailer. SizeLen = 8 // HashLen is the byte length of SHA-256 checksums. HashLen = 32 // MagicLen is the length of magic string in bytes. MagicLen = 8 // IndexMagicV2 is the 4-byte magic signature at the start of Format v2 binary indices. IndexMagicV2 = "\x00\xFAM2" // FormatVersion1 is the legacy JSON manifest format. FormatVersion1 = 1 // FormatVersion2 is the reflection-free compact binary index table format. FormatVersion2 = 2 // FormatVersionCurrent is the default format version used for new fat binaries. FormatVersionCurrent = FormatVersion2 // MaxIndexSize is the maximum allowable index table size (1 MB). MaxIndexSize = 1024 * 1024 // MaxPayloadSize is the maximum allowable single payload uncompressed size (1 GB). MaxPayloadSize = 1024 * 1024 * 1024 // MaxDictionarySize is the maximum allowable shared dictionary size (1 MB). MaxDictionarySize = 1024 * 1024 // Environment variable names for telemetry and control. EnvSelectedVariant = "MICROFAT_SELECTED_VARIANT" EnvHostArch = "MICROFAT_HOST_ARCH" EnvHostLevel = "MICROFAT_HOST_LEVEL" EnvExecMode = "MICROFAT_EXEC_MODE" EnvDispatchMode = "MICROFAT_DISPATCH_MODE" EnvSelectedSHA256 = "MICROFAT_SELECTED_SHA256" EnvSelectedSize = "MICROFAT_SELECTED_SIZE" EnvCgroupVersion = "MICROFAT_CGROUP_VERSION" EnvCgroupGOMEMLIMIT = "MICROFAT_CGROUP_GOMEMLIMIT" EnvCgroupGOMAXPROCS = "MICROFAT_CGROUP_GOMAXPROCS" EnvCgroupLimitBytes = "MICROFAT_CGROUP_LIMIT_BYTES" EnvCgroupHighBytes = "MICROFAT_CGROUP_HIGH_BYTES" EnvCgroupEffectiveLimitBytes = "MICROFAT_CGROUP_EFFECTIVE_LIMIT_BYTES" EnvCgroupCPUs = "MICROFAT_CGROUP_CPUS" EnvCgroupGOGC = "MICROFAT_CGROUP_GOGC" EnvCgroupGOGCSkippedReason = "MICROFAT_CGROUP_GOGC_SKIPPED_REASON" EnvCgroupGCProfile = "MICROFAT_CGROUP_GC_PROFILE" EnvDebug = "MICROFAT_DEBUG" EnvLog = "MICROFAT_LOG" EnvAutotune = "MICROFAT_AUTOTUNE" EnvCPUPolicy = "MICROFAT_CPU_POLICY" EnvDryRun = "MICROFAT_DRY_RUN" EnvMemRatio = "MICROFAT_MEM_RATIO" EnvGCProfile = "MICROFAT_GC_PROFILE" EnvLiveHeapEstimate = "MICROFAT_LIVE_HEAP_ESTIMATE" EnvForceLevel = "MICROFAT_FORCE_LEVEL" EnvMaxLevel = "MICROFAT_MAX_LEVEL" EnvDisableVariants = "MICROFAT_DISABLE_VARIANTS" EnvPolicy = "MICROFAT_POLICY" EnvAVX512DownclockProtection = "MICROFAT_AVX512_DOWNCLOCK_PROTECTION" EnvCacheDir = "MICROFAT_CACHE_DIR" EnvVerifyCache = "MICROFAT_VERIFY_CACHE" EnvPolicyApplied = "MICROFAT_POLICY_APPLIED" EnvOverrideReason = "MICROFAT_OVERRIDE_REASON" // EnvOriginalExe specifies the informational asset-resolution hint indicating the // original fat binary path prior to memfd/cache execution. // // Security boundary: This variable is strictly an informational asset-resolution hint // for locating neighboring filesystem resources (configurations, plugins, static assets, // sibling CLI binaries). It is propagated via the process environment and must NOT be used // by applications or libraries as a cryptographic identity, access-control token, or // trusted binary origin. EnvOriginalExe = "MICROFAT_ORIGINAL_EXE" // Execution modes. ExecModeAuto = "auto" ExecModeMemfd = "memfd" ExecModeCache = "cache" // Telemetry event types. EventDispatch = "dispatch" EventError = "dispatch_error" EventPrewarm = "prewarm" // File permissions. PrivateCacheDirMode = 0o700 PrivateExecMode = 0o700 )
Constants for binary layout and verification.
const ( PrewarmStatusExtracted = "extracted" PrewarmStatusAlreadyCached = "already_cached" PrewarmStatusValid = "valid" PrewarmStatusMissing = "missing" PrewarmStatusCorrupted = "corrupted" )
Prewarm and verify status constants.
const MaxJSONDepth = 128
MaxJSONDepth bounds legacy manifest nesting, including unknown fields.
Variables ¶
var ( ErrBinaryTooSmall = errors.New("binary size is smaller than trailer size") ErrInvalidMagic = errors.New("invalid microfat magic bytes at EOF") ErrUnsupportedVersion = errors.New("unsupported microfat format version") ErrInvalidIndexOffset = errors.New("invalid index offset in trailer") ErrInvalidIndexSize = errors.New("invalid index size in trailer") ErrIndexCorrupted = errors.New("index SHA-256 checksum mismatch") ErrOutOfBounds = errors.New("variant payload extends beyond binary boundary") ErrPayloadTooLarge = errors.New("variant payload size exceeds safety limit") ErrOverlappingVariant = errors.New("variant payloads overlap or are unsorted") ErrTruncatedIndex = errors.New("truncated index data") ErrInvalidJSONSyntax = errors.New("invalid json syntax in manifest index") ErrDictionaryCorrupted = errors.New("shared dictionary SHA-256 checksum mismatch") ErrPayloadCorrupted = errors.New("variant payload SHA-256 checksum mismatch") ErrInvalidDictionary = errors.New("invalid shared dictionary offset or size") ErrInvalidChecksum = errors.New("invalid sha256 checksum format") ErrNoVariantsSpecified = errors.New("at least one microarchitecture variant must be specified") ErrDuplicateVariant = errors.New("duplicate or conflicting variant level in index") ErrInvalidVariant = errors.New("invalid or empty variant level") // Launcher execution stage sentinels for typed error diagnostics. ErrMemfdCreate = errors.New("memfd_create failed") ErrMemfdSealingFailed = errors.New("memfd sealing failed") ErrMemfdExtract = errors.New("memfd payload extraction failed") ErrExecve = errors.New("execve failed") ErrCacheInit = errors.New("cache directory initialization failed") ErrInsecureCacheDir = errors.New("cache directory has insecure permissions or invalid ownership") ErrCacheWrite = errors.New("cache file creation failed") ErrCacheExtract = errors.New("cache decompression failed") )
Standard error definitions for binary format parsing and execution.
Functions ¶
func DiagnoseError ¶ added in v0.2.0
DiagnoseError inspects an execution failure and stage context, returning an actionable human-readable remediation hint if a recognized restriction or error is detected.
func EscapeJSONString ¶ added in v0.2.5
EscapeJSONString escapes JSON string content without adding quotes or using reflection. The format writer and launcher telemetry share this byte-preserving encoder.
func ExtractErrno ¶ added in v0.3.0
ExtractErrno inspects an error for a syscall.Errno and returns its numeric value and symbol name.
func IsFatBinary ¶
IsFatBinary returns true if the reader contains valid microfat magic bytes at EOF.
func MarshalBinaryIndex ¶ added in v0.2.0
MarshalBinaryIndex serializes an Index struct into a compact Format v2 binary representation.
func NormalizeVariant ¶ added in v0.2.1
NormalizeVariant cleans up and standardizes variant level strings (e.g. "amd64_v3" -> "v3", "V3" -> "v3", "v8.0" -> "v8.0", "arm64-v8.2" -> "v8.2").
func OpenAndValidateCacheDirFD ¶ added in v0.2.2
OpenAndValidateCacheDirFD opens dir with O_DIRECTORY|O_NOFOLLOW|O_CLOEXEC and asserts:
- Target is a regular directory and NOT a symlink.
- Target is owned by the current process effective UID (os.Geteuid()).
- Target does not grant group or world write access (mode & 0o022 == 0).
Cache ownership follows the effective UID of an ordinary, non-elevated process. The launcher rejects setuid/setgid and secure execution before cache access.
If allowRemediate is true and the directory is owned by the current effective UID but has group/world write bits, it remediates the descriptor directly via fchmod to 0700, completely eliminating pathname TOCTOU. On success, returns the open pinned directory descriptor (fd >= 0). The caller is responsible for closing it.
func ResolveCacheDir ¶
ResolveCacheDir resolves and creates the microfat cache directory with 0700 permissions. On Unix systems, it validates security invariants using descriptor-based pinning to prevent TOCTOU races.
func ResolveCacheDirFD ¶ added in v0.2.2
ResolveCacheDirFD resolves, creates, and securely validates the microfat cache directory, returning an open file descriptor pinned to the directory alongside its absolute path.
On Unix systems, the returned directory descriptor allows callers to anchor subsequent operations using *at syscalls (openat, unlinkat, renameat) relative to dirFD, eliminating pathname TOCTOU vulnerabilities between directory validation and payload extraction or execution. On non-Unix platforms, dirFD is -1. If dirFD >= 0, the caller is responsible for closing dirFD when finished.
Cache ownership follows the effective UID of an ordinary, non-elevated process. The launcher rejects setuid/setgid and secure execution before cache access.
Precedence:
- customDir argument (if non-empty)
- MICROFAT_CACHE_DIR environment variable (if set)
- $XDG_CACHE_HOME/microfat (or ~/.cache/microfat)
- Fallback: /tmp/.microfat-<euid>
Security Invariants:
- Explicit paths (customDir or MICROFAT_CACHE_DIR) must be regular directories (not symlinks), owned by the current process effective UID, and without group or other write permissions (mode & 0o022 == 0). Insecure configurations fail fast with an error wrapping ErrInsecureCacheDir without attempting remediation.
- For the automatic discovery cascade (XDG_CACHE_HOME, ~/.cache, /tmp/.microfat-<euid>), candidate directories owned by the current process effective UID with permissive write bits are tightened directly on the open descriptor via fchmod to 0700. Foreign-owned directories, symlinks, or candidates where chmod fails are rejected, falling through to the next candidate in the cascade.
func ResolveExistingCacheDir ¶ added in v0.2.4
ResolveExistingCacheDir is the read-only counterpart of ResolveCacheDir.
func ResolveExistingCacheDirFD ¶ added in v0.2.4
ResolveExistingCacheDirFD discovers and opens a secure existing cache directory. It never creates directories or repairs permissions. Explicit paths fail directly; automatic discovery tries the same candidates as ResolveCacheDirFD, without changes. The caller owns the returned descriptor and must close it when it is nonnegative.
func ValidateChecksum ¶ added in v0.2.1
ValidateChecksum verifies that a SHA-256 hex string contains exactly 64 valid hex characters. An empty string is treated as valid to support optional dictionary or unchecksummed fields.
func WriteIndexAndTrailer ¶
WriteIndexAndTrailer serializes the index in Format v2 (binary) and writes it followed by the 56-byte trailer.
Types ¶
type BinaryInfo ¶
type BinaryInfo struct {
AppName string `json:"app_name"`
TargetOS string `json:"target_os"`
TargetArch string `json:"target_arch"`
FatBinarySize int64 `json:"fat_binary_size"`
HostOS string `json:"host_os"`
HostArch string `json:"host_arch"`
HostLevel string `json:"host_level"`
SelectedVariant string `json:"selected_variant"`
SelectedSize int64 `json:"selected_size"`
SelectionError string `json:"selection_error,omitempty"`
ExecMode string `json:"exec_mode"`
PolicyApplied string `json:"policy_applied,omitempty"`
PolicyReason string `json:"policy_reason,omitempty"`
DictionaryOffset int64 `json:"dictionary_offset,omitempty"`
DictionarySize int64 `json:"dictionary_size,omitempty"`
DictionarySHA256 string `json:"dictionary_sha256,omitempty"`
DictionaryID uint32 `json:"dictionary_id,omitempty"`
Cgroup *CgroupInfo `json:"cgroup,omitempty"`
Runtime *RuntimeInfo `json:"runtime,omitempty"`
Variants []VariantEntry `json:"variants"`
HostFeatures []string `json:"host_features"`
}
BinaryInfo represents the structured JSON output for launcher inspection.
type CgroupInfo ¶
type CgroupInfo struct {
Version int `json:"version"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
MemoryLimitBytes int64 `json:"memory_limit_bytes"`
MemoryLimitStatus string `json:"memory_limit_status,omitempty"`
MemoryHighBytes int64 `json:"memory_high_bytes,omitempty"`
MemoryHighStatus string `json:"memory_high_status,omitempty"`
EffectiveMemoryLimitBytes int64 `json:"effective_memory_limit_bytes,omitempty"`
EffectiveMemoryLimitStatus string `json:"effective_memory_limit_status,omitempty"`
CPUQuota float64 `json:"cpu_quota"`
CPUQuotaStatus string `json:"cpu_quota_status,omitempty"`
GOMEMLIMIT string `json:"gomemlimit,omitempty"`
GOMAXPROCS int `json:"gomaxprocs,omitempty,omitzero"`
GOGC string `json:"gogc,omitempty"`
GCProfile string `json:"gc_profile,omitempty"`
}
CgroupInfo represents container cgroup telemetry and auto-tuning limits.
type DispatchError ¶ added in v0.3.0
type DispatchError struct {
PrimarySentinel error
RequestedMode string
Attempts []ExecutionAttempt
Summary string
}
DispatchError records the ordered execution attempts that failed during dispatch.
func (*DispatchError) As ¶ added in v0.3.0
func (e *DispatchError) As(target any) bool
func (*DispatchError) Error ¶ added in v0.3.0
func (e *DispatchError) Error() string
func (*DispatchError) Is ¶ added in v0.3.0
func (e *DispatchError) Is(target error) bool
func (*DispatchError) Unwrap ¶ added in v0.3.0
func (e *DispatchError) Unwrap() error
type DispatchTelemetry ¶
type DispatchTelemetry struct {
Event string `json:"event"`
TimestampUnixNano int64 `json:"timestamp_unix_nano"`
HostArch string `json:"host_arch"`
HostLevel string `json:"host_level"`
SelectedVariant string `json:"selected_variant"`
SelectedSHA256 string `json:"selected_sha256,omitempty"`
SelectedSizeBytes int64 `json:"selected_size_bytes,omitempty"`
ExecMode string `json:"exec_mode"`
PolicyApplied string `json:"policy_applied,omitempty"`
PolicyReason string `json:"policy_reason,omitempty"`
CgroupVersion int `json:"cgroup_version,omitempty"`
CgroupMemLimitBytes int64 `json:"cgroup_mem_limit_bytes,omitempty"`
CgroupCPUQuota float64 `json:"cgroup_cpu_quota,omitempty"`
GOMEMLIMIT string `json:"gomemlimit,omitempty"`
GOMAXPROCS string `json:"gomaxprocs,omitempty"`
GOGC string `json:"gogc,omitempty"`
GCProfile string `json:"gc_profile,omitempty"`
DecompressionDurationUs int64 `json:"decompression_duration_us,omitempty"`
TotalLauncherUs int64 `json:"total_launcher_us"`
}
DispatchTelemetry records structured runtime execution metadata and performance timings.
type ErrorTelemetry ¶
type ErrorTelemetry struct {
Event string `json:"event"`
TimestampUnixNano int64 `json:"timestamp_unix_nano"`
HostArch string `json:"host_arch,omitempty"`
HostLevel string `json:"host_level,omitempty"`
SelectedVariant string `json:"selected_variant,omitempty"`
PolicyApplied string `json:"policy_applied,omitempty"`
PolicyReason string `json:"policy_reason,omitempty"`
Stage string `json:"stage"`
RequestedMode string `json:"requested_mode,omitempty"`
AttemptedMode string `json:"attempted_mode,omitempty"`
Error string `json:"error"`
Errno int `json:"errno,omitempty"`
ErrnoName string `json:"errno_name,omitempty"`
Attempts []ExecutionAttempt `json:"attempts,omitempty"`
Details string `json:"details,omitempty"`
Hint string `json:"hint,omitempty"`
}
ErrorTelemetry records structured error events during launcher initialization or dispatch.
type ExecutionAttempt ¶ added in v0.3.0
type ExecutionAttempt struct {
Stage string `json:"stage"`
RequestedMode string `json:"requested_mode"`
AttemptedMode string `json:"attempted_mode"`
Err error `json:"-"`
Error string `json:"error"`
Errno int `json:"errno,omitempty"`
ErrnoName string `json:"errno_name,omitempty"`
}
ExecutionAttempt records the details of an individual dispatch attempt.
type Index ¶
type Index struct {
Version int `json:"version"`
AppName string `json:"app_name,omitempty"`
TargetOS string `json:"os"`
TargetArch string `json:"arch"`
CreatedUnix int64 `json:"created_unix"`
DictionaryOffset int64 `json:"dictionary_offset,omitempty"`
DictionarySize int64 `json:"dictionary_size,omitempty"`
DictionarySHA256 string `json:"dictionary_sha256,omitempty"`
DictionaryID uint32 `json:"dictionary_id,omitempty"`
Variants []VariantEntry `json:"variants"`
}
Index holds the manifest of all embedded variants and target platform metadata.
func ReadTrailerAndIndex ¶
ReadTrailerAndIndex reads the trailing 56 bytes of the binary, verifies magic and index SHA-256 hash, deserializes the index table (binary Format v2 or JSON Format v1), and enforces bounds checks.
func UnmarshalBinaryIndex ¶ added in v0.2.0
UnmarshalBinaryIndex deserializes a Format v2 compact binary index buffer with lowercase SHA-256 digests.
func (*Index) FindVariant ¶
func (idx *Index) FindVariant(level string) (*VariantEntry, bool)
FindVariant returns the VariantEntry corresponding to the specified level string, performing normalized matching.
func (*Index) ValidateBounds ¶
ValidateBounds verifies that all variants and offsets in the index are within safe boundaries.
func (*Index) VariantLevels ¶
VariantLevels returns a slice of all variant level strings present in the index.
type PrewarmResult ¶
type PrewarmResult struct {
Level string `json:"level"`
SHA256 string `json:"sha256"`
UncompressedSize int64 `json:"uncompressed_size"`
CachedPath string `json:"cached_path"`
AlreadyCached bool `json:"already_cached"`
DecompressionUs int64 `json:"decompression_us,omitempty"`
Valid bool `json:"valid"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
}
PrewarmResult records the cache status for an individual prewarmed or verified variant.
type PrewarmTelemetry ¶
type PrewarmTelemetry struct {
Event string `json:"event"`
TimestampUnixNano int64 `json:"timestamp_unix_nano"`
AppName string `json:"app_name,omitempty"`
CacheDir string `json:"cache_dir"`
Results []PrewarmResult `json:"results"`
}
PrewarmTelemetry records structured telemetry for a prewarm operation.
type RuntimeCandidate ¶ added in v0.3.0
type RuntimeCandidate struct {
ExecMode string `json:"exec_mode"`
RetainedExecutableBytes int64 `json:"retained_executable_bytes"`
Tuning RuntimeTuningInfo `json:"tuning"`
EffectiveEnvironment map[string]RuntimeEnvironmentValue `json:"effective_environment"`
}
RuntimeCandidate separates computed tuning from the environment a candidate would receive.
type RuntimeEnvironmentValue ¶ added in v0.3.0
type RuntimeEnvironmentValue struct {
Present bool `json:"present"`
Value string `json:"value"`
Source string `json:"source"`
}
RuntimeEnvironmentValue preserves the distinction between an absent and an empty inherited variable.
type RuntimeInfo ¶ added in v0.3.0
type RuntimeInfo struct {
Autotune string `json:"autotune"`
CPUPolicy string `json:"cpu_policy"`
Candidates []RuntimeCandidate `json:"candidates"`
}
RuntimeInfo describes prospective execution candidates; inspection does not execute a payload.
type RuntimeTuningInfo ¶ added in v0.3.0
type RuntimeTuningInfo struct {
Available bool `json:"available"`
GOMEMLIMIT string `json:"gomemlimit,omitempty"`
GOMEMLIMITBytes int64 `json:"gomemlimit_bytes,omitempty"`
GOMAXPROCS int `json:"gomaxprocs,omitempty"`
GOMAXPROCSValue string `json:"gomaxprocs_value,omitempty"`
GOGC string `json:"gogc,omitempty"`
GCProfile string `json:"gc_profile,omitempty"`
AppliedRatio float64 `json:"applied_ratio,omitempty"`
ConstrainingLimit string `json:"constraining_limit,omitempty"`
GOGCSkippedReason string `json:"gogc_skipped_reason,omitempty"`
}
RuntimeTuningInfo is a computed candidate plan, before opt-outs and inherited runtime overrides.
type VariantEntry ¶
type VariantEntry struct {
Level string `json:"level"` // Microarchitecture level (e.g., "v1", "v2", "v3", "v4")
Offset int64 `json:"offset"` // Absolute byte offset in the fat binary
CompressedSize int64 `json:"compressed_size"` // Compressed zstd byte length
UncompressedSize int64 `json:"uncompressed_size"` // Raw binary byte length
SHA256 string `json:"sha256,omitempty"` // Checksum of uncompressed payload
Compression string `json:"compression"` // Compression algorithm (e.g., "zstd")
}
VariantEntry describes an individual compressed microarchitecture variant payload.