inventory

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package inventory keeps each host's cached instance inventory warm by refreshing it on a schedule, so UI/API reads are served without a live podman sweep and an unreachable host never stalls a request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Poller

type Poller struct {
	Svc      Refresher
	Interval time.Duration
	Timeout  time.Duration
	// contains filtered or unexported fields
}

Poller periodically refreshes every host's inventory into the service cache. It mirrors internal/prune.Scheduler: an immediate first pass so a fresh start warms within one cycle, per-tick panic recovery, a per-host timeout so one hung host can't bleed into the next cycle, and Wait() for clean shutdown.

func (*Poller) Start

func (p *Poller) Start(ctx context.Context, hostsFn func() []string)

Start launches the ticker loop until ctx is cancelled. hostsFn returns the current host ids on each tick (so SIGHUP host reloads are picked up).

func (*Poller) Wait

func (p *Poller) Wait()

Wait blocks until the poller goroutine has exited after ctx cancellation.

type Refresher

type Refresher interface {
	RefreshHost(ctx context.Context, host string) error
}

Refresher refreshes one host's cached inventory. Implemented by *instance.Service.RefreshHost.

Jump to

Keyboard shortcuts

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