catalogcollector

package
v1.5.0-main Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateSnapshot

func ValidateSnapshot(snapshot *CatalogSnapshot) error

ValidateSnapshot validates a CatalogSnapshot before destination reconciliation.

Types

type CatalogSnapshot

type CatalogSnapshot struct {
	// Revision is an opaque, deterministic revision of the source-produced
	// desired content. It changes only when desired content changes.
	Revision string

	// Catalogs contains the desired Catalog resources.
	Catalogs []apiv1alpha1.Catalog

	// CatalogItems contains the desired CatalogItem resources.
	CatalogItems []apiv1alpha1.CatalogItem
}

CatalogSnapshot represents the complete desired state for a configured source scope as observed at a point in time.

Every emitted snapshot must be complete for the configured scope. If fetching, pagination, or normalization fails, the source must report the error and must not deliver a partial desired state to the downstream consumer.

Revision is an opaque, deterministic identifier that changes only when the desired source content changes. Destinations may use it for optimization but must not treat an unchanged revision as proof that their actual state is still correct. A source may replay a snapshot with the same revision so destinations can detect and repair drift.

Consumers must treat the supplied snapshot and its slices as immutable. Anything retaining or transforming the data must copy what it needs. The caller retains ownership of the supplied snapshot.

type ComponentConfig

type ComponentConfig = any

ComponentConfig is the type-erased handle for a component's typed configuration struct. Factories return a pointer to their concrete config from CreateDefaultConfig; the framework decodes raw YAML/JSON into it, then passes it back through the creation method. Components recover the concrete type with a type assertion.

type ComponentID

type ComponentID struct {
	Type ComponentType
	Name string
}

ComponentID identifies a configured component instance using the format type[/name]. The type selects the registered factory. The optional name distinguishes multiple instances of the same type.

A component ID is unique within its component kind. Therefore, "http/input" as a source and "http/input" as a destination do not collide because source and destination namespaces are separate.

Examples:

"http"           → Type: "http",      Name: ""
"http/dev-input" → Type: "http",      Name: "dev-input"
"flightctl"      → Type: "flightctl", Name: ""

func ParseComponentID

func ParseComponentID(value string) (ComponentID, error)

ParseComponentID parses a component identifier in the format type[/name].

Validation rejects:

  • Empty identifiers
  • Empty type (e.g. "/name")
  • Empty name after separator (e.g. "http/")
  • More than one separator (e.g. "a/b/c")

func (ComponentID) String

func (id ComponentID) String() string

String returns the canonical string representation: type when unnamed, type/name when named.

type ComponentType

type ComponentType string

ComponentType identifies the kind of component a factory creates. Each concrete component package defines its type as a package-level constant (e.g. httpsource.Type = "http"). The collector binary registers factory objects whose Type() methods return these values; the service matches them against configured component types at pipeline construction time.

type Consumer

type Consumer interface {
	Consume(ctx context.Context, snapshot *CatalogSnapshot) error
}

Consumer is one processing stage in a pipeline.

Processors implement Consumer, transform or filter the snapshot, and forward it to the next Consumer supplied by their factory.

type Destination

type Destination interface {
	Reconcile(
		ctx context.Context,
		pipelineID string,
		snapshot *CatalogSnapshot,
	) error
}

Destination is the terminal component of a pipeline.

A destination may be shared by multiple pipelines. The pipelineID identifies whose desired state is being reconciled, allowing the destination to isolate ownership, drift repair, and pruning.

Implementations must be safe for concurrent use.

type DestinationFactory

type DestinationFactory interface {
	Factory

	// CreateDestination constructs a shared terminal destination. Destinations
	// have no downstream consumer.
	CreateDestination(
		ctx context.Context,
		settings Settings,
		cfg ComponentConfig,
	) (Destination, error)
}

DestinationFactory constructs a Destination that reconciles catalog snapshots against a target system.

A destination may be referenced by multiple pipelines, so the returned Destination must be safe for concurrent use. The service constructs it once per configured destination and supplies the pipeline ID on each reconciliation.

type DestinationPreflight

type DestinationPreflight interface {
	Preflight(ctx context.Context) error
}

DestinationPreflight is an optional capability implemented by destinations that need to validate external dependencies before the service becomes ready.

Destinations implementing this interface have their Preflight method called once during service startup, after extensions have started and before any source Run goroutine is launched. A destination shared by several pipelines is constructed once and is therefore preflighted exactly once.

What a destination validates, and how, is up to that destination.

type Extension

type Extension interface {
	Start(ctx context.Context, host Host) error
	Shutdown(ctx context.Context) error
}

Extension provides a shared, out-of-band capability to collector components. Extensions are not pipeline stages and do not consume catalog snapshots.

Examples include client authentication, shared storage, and health services.

Start is called once after every configured extension has been constructed and before any source is started. Start performs initialization and returns; it must not block for the lifetime of the service.

Shutdown is called once during service shutdown. Extensions are shut down in reverse start order.

type ExtensionFactory

type ExtensionFactory interface {
	Factory

	// CreateExtension constructs an extension instance. The settings.Host
	// is fully populated with all configured extensions by the time any
	// factory is called; extension-to-extension lookups should be deferred
	// to [Extension.Start] rather than performed here.
	CreateExtension(
		ctx context.Context,
		settings Settings,
		cfg ComponentConfig,
	) (Extension, error)
}

ExtensionFactory constructs an Extension from its parsed configuration.

Extensions are constructed before any pipeline component so that the populated Host can be passed to all factories. The returned extension is not yet started; the service calls Extension.Start after all extensions have been constructed and registered.

type Factories

type Factories struct {
	Sources      []SourceFactory
	Processors   []ProcessorFactory
	Destinations []DestinationFactory
	Extensions   []ExtensionFactory
}

Factories holds the set of component factories available to a collector binary. The service builds private lookup maps from each factory's Type() method at pipeline construction time.

Factories are supplied explicitly by the collector binary's main function. There is no global registration, init()-time side effect, or package-level registry. External repositories provide additional factories by compiling their own collector distribution that includes their factory objects alongside the built-in set.

type Factory

type Factory interface {
	// Type returns the component type this factory creates. The returned
	// value is matched against the type portion of the component identifier
	// in the collector configuration file.
	Type() ComponentType

	// CreateDefaultConfig returns a pointer to a new instance of the
	// component's configuration struct, populated with default values.
	// The framework strict-decodes the user-supplied YAML/JSON on top of
	// this value, so any field not present in the config file retains its
	// default.
	CreateDefaultConfig() ComponentConfig
}

Factory is the base interface shared by all component factories. Every factory identifies the component type it handles through its Type method and provides a default configuration value through CreateDefaultConfig.

type Host

type Host interface {
	GetExtension(id ComponentID) (Extension, error)
}

Host provides components and extensions with access to configured shared extensions.

An extension is resolved by its complete type[/name] component ID. Callers must verify that the returned extension implements the capability they need.

type ProcessorFactory

type ProcessorFactory interface {
	Factory

	// CreateProcessor constructs a processor that receives snapshots
	// through its Consume method, transforms or filters them, and
	// forwards the result by calling next.Consume.
	CreateProcessor(
		ctx context.Context,
		settings Settings,
		cfg ComponentConfig,
		next Consumer,
	) (Consumer, error)
}

ProcessorFactory constructs a Consumer that transforms or filters snapshots before forwarding them downstream.

type Readiness

type Readiness interface {
	Ready()
	NotReady()
}

Readiness is an optional capability that extensions may implement to participate in the service readiness lifecycle.

After all extensions have started, the service discovers extensions that implement this interface. It calls Ready after every configured source goroutine has entered its run wrapper, and calls NotReady before extension shutdown begins.

Extensions that do not implement Readiness are unaffected by the readiness lifecycle.

type Settings

type Settings struct {
	// ID is the parsed component identifier from the collector
	// configuration file (e.g. "http/dev-input", "flightctl/local").
	ID ComponentID

	// Host provides access to configured extensions. All factories
	// receive the same fully-populated Host instance; extensions
	// should be looked up during Start, not during construction.
	Host Host

	// Logger is a structured logger pre-scoped with component_kind and
	// component_id fields. Components should store it and use it for
	// operational log output. Never log raw configuration or credentials.
	Logger *logrus.Entry

	// MeterProvider supplies meters for recording operational metrics.
	// Components that emit metrics should create instruments from this
	// provider. The service supplies either a real provider backed by a
	// dedicated Prometheus registry or a no-op provider when metrics are
	// disabled. Components must not use the global meter provider.
	MeterProvider metric.MeterProvider
}

Settings carries per-instance metadata that the service provides to a factory when constructing a component. It is separate from the component-specific configuration so that factories receive a stable, typed context without needing to parse it from the raw config.

type Source

type Source interface {
	Run(ctx context.Context) error
}

Source produces complete snapshots and sends them to the Consumer supplied by its factory.

Run blocks until the context is cancelled or a fatal error occurs.

type SourceFactory

type SourceFactory interface {
	Factory

	// CreateSource constructs a source that delivers complete snapshots
	// through next. The source must call next.Consume for every
	// successfully produced snapshot and must handle the returned error
	// according to its protocol (e.g. returning an HTTP error to the
	// caller, retrying, or propagating the failure).
	//
	// The returned Source is not yet running; the caller starts it by
	// invoking [Source.Run].
	CreateSource(
		ctx context.Context,
		settings Settings,
		cfg ComponentConfig,
		next Consumer,
	) (Source, error)
}

SourceFactory constructs a Source from its parsed configuration.

The service calls CreateSource after resolving the pipeline topology. The next consumer is the immediate downstream stage selected by the service — either the first processor or the terminal destination.

type SourcePreflight

type SourcePreflight interface {
	Preflight(ctx context.Context) error
}

SourcePreflight is an optional capability implemented by sources that need to validate external dependencies before the service becomes ready.

Sources implementing this interface have their Preflight method called once during service startup, after extensions have started and before any source Run goroutine is launched.

Directories

Path Synopsis
Package config provides the configuration loader for the flightctl-catalog-collector.
Package config provides the configuration loader for the flightctl-catalog-collector.
destination
debugdestination
Package debugdestination provides a diagnostic catalog collector destination that logs snapshot summaries instead of reconciling resources against a remote system.
Package debugdestination provides a diagnostic catalog collector destination that logs snapshot summaries instead of reconciling resources against a remote system.
flightctldestination
Package flightctldestination provides a catalog collector destination that mirrors complete CatalogSnapshot values into a Flightctl API server.
Package flightctldestination provides a catalog collector destination that mirrors complete CatalogSnapshot values into a Flightctl API server.
extension
processor
catalognameprocessor
Package catalognameprocessor provides a catalog name mapping processor for the flightctl catalog collector.
Package catalognameprocessor provides a catalog name mapping processor for the flightctl catalog collector.
Package service provides the pipeline builder and runner for the flightctl-catalog-collector.
Package service provides the pipeline builder and runner for the flightctl-catalog-collector.
source
httpsource
Package httpsource provides an HTTP snapshot source for the catalog collector.
Package httpsource provides an HTTP snapshot source for the catalog collector.
pollsource
Package pollsource provides a reusable polling loop with bounded exponential backoff and jitter for pull-based catalog collector sources.
Package pollsource provides a reusable polling loop with bounded exponential backoff and jitter for pull-based catalog collector sources.

Jump to

Keyboard shortcuts

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