inventory

package
v1.3.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package inventory owns inventory collection and sync state.

Index

Constants

View Source
const (
	// DefaultRetryInterval is the delay after a failed inventory attempt.
	DefaultRetryInterval = 5 * time.Minute

	// DefaultStartupJitter is the maximum random delay before the first inventory attempt.
	DefaultStartupJitter = time.Minute
)

Variables

View Source
var ErrNotReady = errors.New("inventory backend not ready")

ErrNotReady indicates inventory export cannot proceed because backend state is not ready yet.

Functions

func ComputeHash

func ComputeHash(snap *Snapshot) (string, error)

ComputeHash returns a deterministic hash for the stable inventory contents.

Types

type AgentConfig

type AgentConfig struct {
	TotalComponents            int64
	RetentionPeriodSeconds     int64
	EnabledComponents          []string
	DisabledComponents         []string
	InventoryEnabled           bool
	InventoryIntervalSeconds   int64
	AttestationEnabled         bool
	AttestationIntervalSeconds int64
}

type BlockDevice

type BlockDevice struct {
	Name       string
	Type       string
	Size       int64
	WWN        string
	MountPoint string
	FSType     string
	PartUUID   string
	Parents    []string
}

type CPUInfo

type CPUInfo struct {
	Type         string
	Manufacturer string
	Architecture string
	LogicalCores int64
}

type DiskInfo

type DiskInfo struct {
	ContainerRootDisk string
	BlockDevices      []BlockDevice
}

type GPUDevice

type GPUDevice struct {
	UUID         string
	BusID        string
	SN           string
	MinorID      string
	BoardID      int
	VBIOSVersion string
	ChassisSN    string
	GPUIndex     string
}

type GPUInfo

type GPUInfo struct {
	Product      string
	Manufacturer string
	Architecture string
	Memory       string
	GPUs         []GPUDevice
}

type InventoryConfig

type InventoryConfig struct {
	Interval      time.Duration
	RetryInterval time.Duration
	Timeout       time.Duration
	StartupJitter time.Duration
}

InventoryConfig controls periodic inventory scheduling.

type Manager

type Manager interface {
	Run(ctx context.Context) error
	CollectOnce(ctx context.Context) (*Snapshot, error)
}

Manager coordinates periodic inventory collection into a store.

func NewManager

func NewManager(source Source, sink Sink, cfg InventoryConfig) Manager

NewManager creates an inventory manager.

type MemoryInfo

type MemoryInfo struct {
	TotalBytes uint64
}

type NICInfo

type NICInfo struct {
	PrivateIPInterfaces []NICInterface
}

type NICInterface

type NICInterface struct {
	Interface string
	MAC       string
	IP        string
}

type Resources

type Resources struct {
	CPUInfo    CPUInfo
	MemoryInfo MemoryInfo
	GPUInfo    GPUInfo
	DiskInfo   DiskInfo
	NICInfo    NICInfo
}

type Sink

type Sink interface {
	Export(ctx context.Context, snap *Snapshot) error
}

Sink exports inventory snapshots to an external destination.

type Snapshot

type Snapshot struct {
	CollectedAt             time.Time
	InventoryHash           string
	Hostname                string
	MachineID               string
	SystemUUID              string
	BootID                  string
	Uptime                  time.Time
	OperatingSystem         string
	OSImage                 string
	KernelVersion           string
	AgentVersion            string
	GPUDriverVersion        string
	CUDAVersion             string
	DCGMVersion             string
	ContainerRuntimeVersion string
	NetPrivateIP            string
	AgentConfig             AgentConfig
	Resources               Resources
}

Snapshot is the agent-owned inventory state model.

type Source

type Source interface {
	Collect(ctx context.Context) (*Snapshot, error)
}

Source collects inventory from local providers.

Directories

Path Synopsis
Package mapper contains inventory payload mappers.
Package mapper contains inventory payload mappers.
Package sink contains inventory sink implementations.
Package sink contains inventory sink implementations.
Package source contains inventory collection adapters.
Package source contains inventory collection adapters.

Jump to

Keyboard shortcuts

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