Documentation
¶
Index ¶
- Constants
- func Read(body io.Reader) ([]byte, error)
- func ValidateURL(u *url.URL) error
- type Collector
- func (c *Collector[R]) AcceptEmpty()
- func (c *Collector[R]) Close()
- func (c *Collector[R]) Initialized() bool
- func (c *Collector[R]) Refresh(ctx context.Context, initialOnly bool)
- func (c *Collector[R]) Run(ctx context.Context, interval time.Duration)
- func (c *Collector[R]) SetSources(urls []*url.URL)
- func (c *Collector[R]) Snapshots() []Snapshot[R]
- type Entry
- type Runner
- type Snapshot
Constants ¶
const ClockSkew = 30 * time.Second
const MaxBody = 1 << 20
Variables ¶
This section is empty.
Functions ¶
func ValidateURL ¶
ValidateURL checks discovery base URLs, retaining deployment paths.
Types ¶
type Collector ¶
type Collector[R Runner] struct { Client *http.Client Logger *slog.Logger MaxFailures int // contains filtered or unexported fields }
Collector polls complete discovery endpoints and retains per-source inventories. Configure the client and failure limit before starting workers.
func (*Collector[R]) AcceptEmpty ¶
func (c *Collector[R]) AcceptEmpty()
AcceptEmpty marks a successful empty source selection as initialized. Later source additions are collected by the worker rather than HTTP requests.
func (*Collector[R]) Close ¶
func (c *Collector[R]) Close()
Close cancels and joins pending work, and prevents further refreshes.
func (*Collector[R]) Initialized ¶
func (*Collector[R]) Refresh ¶
Refresh coalesces fetches owned by the collector; any caller may stop waiting.
func (*Collector[R]) Run ¶
Run polls immediately, on source additions, and periodically, then closes the collector.
func (*Collector[R]) SetSources ¶
SetSources preserves retained sources in input order and removes deleted ones.