inventory

package
v0.0.0-...-890248b Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package inventory provides Docker resource inventory collection for the agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector collects Docker resource inventory.

func NewCollector

func NewCollector(dockerClient *docker.Client, cfg CollectorConfig, log *logger.Logger) *Collector

NewCollector creates a new inventory collector.

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context) (*protocol.Inventory, error)

Collect collects full inventory.

func (*Collector) CollectByFilter

func (c *Collector) CollectByFilter(ctx context.Context, f filters.Args) ([]protocol.ContainerInfo, error)

CollectByFilter collects containers matching a filter.

func (*Collector) CollectContainersOnly

func (c *Collector) CollectContainersOnly(ctx context.Context) ([]protocol.ContainerInfo, error)

CollectContainersOnly collects only container inventory.

func (*Collector) CollectImagesOnly

func (c *Collector) CollectImagesOnly(ctx context.Context) ([]protocol.ImageInfo, error)

CollectImagesOnly collects only image inventory.

func (*Collector) GetCached

func (c *Collector) GetCached() (*protocol.Inventory, bool)

GetCached returns cached inventory if still valid.

func (*Collector) QuickStats

func (c *Collector) QuickStats(ctx context.Context) (*protocol.QuickStats, error)

QuickStats returns quick stats for heartbeat.

type CollectorConfig

type CollectorConfig struct {
	AgentID  string
	HostID   string
	CacheTTL time.Duration
}

CollectorConfig configures the inventory collector.

type InventoryDiff

type InventoryDiff struct {
	AddedContainers   []string
	RemovedContainers []string
	ChangedContainers []string
	AddedImages       []string
	RemovedImages     []string
	AddedVolumes      []string
	RemovedVolumes    []string
	AddedNetworks     []string
	RemovedNetworks   []string
}

InventoryDiff represents changes between inventories.

func Diff

func Diff(old, new *protocol.Inventory) *InventoryDiff

Diff compares two inventories and returns differences.

func (*InventoryDiff) HasChanges

func (d *InventoryDiff) HasChanges() bool

HasChanges returns true if there are any differences.

Jump to

Keyboard shortcuts

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