bytecode

package
v2.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetName

func AssetName(baseName string, mode Mode) (string, error)

AssetName applies the repository's canonical core/noncore suffix contract.

Types

type AssetExists

type AssetExists func(name string) bool

AssetExists reports whether a concrete go-bindata key is embedded.

type Detector

type Detector func() (bool, error)

Detector reports whether usable kernel BTF is available.

type Mode

type Mode uint8

Mode is the resolved bytecode variant used by a probe generation.

const (
	ModeCore    Mode = Mode(config.BTFModeCore)
	ModeNonCore Mode = Mode(config.BTFModeNonCore)
)

func (Mode) String

func (m Mode) String() string

type Selector

type Selector struct {
	// contains filtered or unexported fields
}

Selector resolves a probe generation's bytecode mode exactly once and then maps every probe-specific base name to an embedded asset of that mode.

func NewSelector

func NewSelector(requestedMode, assetMode uint8) *Selector

NewSelector creates the production selector backed by the process-wide BTF detector cache and the current go-bindata catalog.

func NewSelectorWithDependencies

func NewSelectorWithDependencies(
	requestedMode, assetMode uint8,
	detector Detector,
	assetExists AssetExists,
) *Selector

NewSelectorWithDependencies creates a selector with injectable kernel and asset probes for deterministic unit tests.

func (*Selector) AssetMode

func (s *Selector) AssetMode() uint8

AssetMode returns the build-time embedded asset set.

func (*Selector) RequestedMode

func (s *Selector) RequestedMode() uint8

RequestedMode returns the user-facing BTF mode supplied to the selector.

func (*Selector) Resolve

func (s *Selector) Resolve() (Mode, error)

Resolve determines and memoizes the bytecode mode for this probe generation.

func (*Selector) Select

func (s *Selector) Select(baseName string) (string, error)

Select returns the concrete embedded key for baseName. It never falls back after Resolve: a missing selected asset is an explicit build/runtime contract error instead of a silent mode switch.

Jump to

Keyboard shortcuts

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