componentmanager

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRegistryNotConfigured reports that the component manager registry is
	// not available.
	ErrRegistryNotConfigured = errors.New("component manager registry is not configured")

	// ErrManagerNotConfigured reports that no active manager is configured for
	// the requested component type.
	ErrManagerNotConfigured = errors.New("component manager is not configured")

	// ErrComponentManagerFactoryNotRegistered reports that no factories were
	// registered for a component type.
	ErrComponentManagerFactoryNotRegistered = errors.New("component manager factory is not registered")

	// ErrComponentManagerFactoryNotConfigured reports that a descriptor was
	// registered without a factory.
	ErrComponentManagerFactoryNotConfigured = errors.New("component manager factory is not configured")

	// ErrDuplicateDescriptor reports duplicate descriptor
	// registration for the same component type and implementation.
	ErrDuplicateDescriptor = errors.New("duplicate component manager descriptor")

	// ErrUnknownComponentManagerImplementation reports that the configured
	// implementation name is not registered for a component type.
	ErrUnknownComponentManagerImplementation = errors.New("unknown component manager implementation")

	// ErrManagerCreationFailed reports that a registered manager factory failed.
	ErrManagerCreationFailed = errors.New("component manager creation failed")

	// ErrConfigNotConfigured reports that a nil component manager config was
	// provided where a config value is required.
	ErrConfigNotConfigured = cmconfig.ErrConfigNotConfigured

	// ErrUnknownComponentType reports an unrecognized component type in config.
	ErrUnknownComponentType = cmconfig.ErrUnknownComponentType

	// ErrComponentManagerImplementationNameEmpty reports that a component type
	// was configured without an implementation name.
	ErrComponentManagerImplementationNameEmpty = cmconfig.ErrComponentManagerImplementationNameEmpty

	// ErrComponentManagersNotConfigured reports that the service config has no
	// component manager entries.
	ErrComponentManagersNotConfigured = cmconfig.ErrComponentManagersNotConfigured

	// ErrProviderRegistryNotConfigured reports that the provider registry is not
	// available.
	ErrProviderRegistryNotConfigured = providerapi.ErrProviderRegistryNotConfigured

	// ErrProviderNotConfigured reports that a provider or provider config is not
	// available.
	ErrProviderNotConfigured = providerapi.ErrProviderNotConfigured

	// ErrUnknownProvider reports that a provider name is not known in the
	// current provider context.
	ErrUnknownProvider = providerapi.ErrUnknownProvider

	// ErrProviderTypeMismatch reports that a provider exists but has a different
	// concrete type than the caller requested.
	ErrProviderTypeMismatch = providerapi.ErrProviderTypeMismatch

	// ErrProviderNameEmpty reports an empty provider name.
	ErrProviderNameEmpty = providerapi.ErrProviderNameEmpty

	// ErrDuplicateProvider reports that a provider is already registered.
	ErrDuplicateProvider = providerapi.ErrDuplicateProvider

	// ErrProviderConfigNameMismatch reports that a provider config's name does
	// not match the name it was registered under.
	ErrProviderConfigNameMismatch = providerapi.ErrProviderConfigNameMismatch

	// ErrProviderNameMismatch reports that a created provider's name does not
	// match the provider config name.
	ErrProviderNameMismatch = providerapi.ErrProviderNameMismatch

	// ErrDuplicateProviderConfig reports duplicate provider configuration after
	// provider names are normalized.
	ErrDuplicateProviderConfig = cmconfig.ErrDuplicateProviderConfig

	// ErrProviderConfigDecoderNotRegistered reports that a provider is required
	// but no config decoder is registered for it.
	ErrProviderConfigDecoderNotRegistered = cmconfig.ErrProviderConfigDecoderNotRegistered

	// ErrProviderConfigTypeMismatch reports that a provider config has a
	// different concrete type than the caller expected.
	ErrProviderConfigTypeMismatch = errors.New("provider config type mismatch")
)

Functions

This section is empty.

Types

type BringUpController

type BringUpController interface {
	// BringUpControl opens the power-on gate for the target components, allowing
	// them to proceed through the bring-up sequence.
	BringUpControl(ctx context.Context, target common.Target) error

	// GetBringUpStatus returns the current bring-up state for each component in
	// the target. Returns a map of component ID to MachineBringUpState.
	GetBringUpStatus(ctx context.Context, target common.Target) (map[string]operations.MachineBringUpState, error)
}

BringUpController is an optional interface for component managers that support bring-up operations.

type Catalog

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

Catalog contains the component manager implementations supported by a particular binary. Service-specific packages such as builtin own the list of descriptors that goes into a catalog.

func NewCatalog

func NewCatalog(descriptors []Descriptor) (Catalog, error)

NewCatalog validates descriptors and indexes them by component type and implementation.

func (Catalog) Get

func (c Catalog) Get(
	componentType devicetypes.ComponentType,
	implementation string,
) (Descriptor, bool)

Get returns the descriptor for a component type and implementation.

func (Catalog) Implementations

func (c Catalog) Implementations(
	componentType devicetypes.ComponentType,
) []string

Implementations returns the implementations registered for a component type.

func (Catalog) ListImplementations

func (c Catalog) ListImplementations() map[devicetypes.ComponentType][]string

ListImplementations returns all registered implementation names by component type.

type ComponentManager

type ComponentManager interface {
	// Type returns the component type this manager is responsible for.
	Type() devicetypes.ComponentType

	// InjectExpectation registers expected component configurations with the
	// component manager service for the target components.
	InjectExpectation(ctx context.Context, target common.Target, info operations.InjectExpectationTaskInfo) error //nolint

	// PowerControl applies a power state transition to the target components.
	PowerControl(ctx context.Context, target common.Target, info operations.PowerControlTaskInfo) error //nolint

	// GetPowerStatus queries the current power state of each component in the
	// target. Returns a map of component ID to PowerStatus.
	GetPowerStatus(ctx context.Context, target common.Target) (map[string]operations.PowerStatus, error) //nolint

	// FirmwareControl initiates a firmware update without waiting for completion.
	// Returns immediately after the update request is accepted.
	FirmwareControl(ctx context.Context, target common.Target, info operations.FirmwareControlTaskInfo) error //nolint

	// GetFirmwareStatus returns the current firmware update state for each
	// component in the target. Returns a map of component ID to FirmwareUpdateStatus.
	GetFirmwareStatus(ctx context.Context, target common.Target) (map[string]operations.FirmwareUpdateStatus, error) //nolint
}

ComponentManager defines the interface for managing various types of components. Implementations handle component-specific operations like power control, firmware management, and status monitoring.

type ComponentManagerFactoryNotConfiguredError

type ComponentManagerFactoryNotConfiguredError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
}

ComponentManagerFactoryNotConfiguredError includes the descriptor identity that has no factory.

func (ComponentManagerFactoryNotConfiguredError) Error

func (ComponentManagerFactoryNotConfiguredError) Is

type ComponentManagerFactoryNotRegisteredError

type ComponentManagerFactoryNotRegisteredError struct {
	ComponentType devicetypes.ComponentType
}

ComponentManagerFactoryNotRegisteredError includes the component type that has no registered factories.

func (ComponentManagerFactoryNotRegisteredError) Error

func (ComponentManagerFactoryNotRegisteredError) Is

type ComponentManagerImplementationNameEmptyError

type ComponentManagerImplementationNameEmptyError = cmconfig.ComponentManagerImplementationNameEmptyError

ComponentManagerImplementationNameEmptyError includes the component type whose configured implementation name is empty.

type Descriptor

type Descriptor struct {
	Type              devicetypes.ComponentType
	Implementation    string
	RequiredProviders []string
	Factory           ManagerFactory
}

Descriptor describes a component manager implementation registered in this process. The descriptor identity is Type plus Implementation; provider names stay separate because one manager can require multiple providers and one provider can serve multiple component manager implementations.

type DuplicateDescriptorError

type DuplicateDescriptorError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
}

DuplicateDescriptorError includes the duplicate descriptor identity.

func (DuplicateDescriptorError) Error

func (e DuplicateDescriptorError) Error() string

func (DuplicateDescriptorError) Is

func (e DuplicateDescriptorError) Is(target error) bool

type DuplicateProviderConfigError

type DuplicateProviderConfigError = cmconfig.DuplicateProviderConfigError

DuplicateProviderConfigError includes the normalized duplicate provider name.

type DuplicateProviderError

type DuplicateProviderError = providerapi.DuplicateProviderError

DuplicateProviderError includes the duplicate provider name.

type FirmwareConsistencyChecker

type FirmwareConsistencyChecker interface {
	// VerifyFirmwareConsistency checks that all target components report the same
	// firmware version set. Returns an error if versions diverge.
	VerifyFirmwareConsistency(ctx context.Context, target common.Target) error
}

FirmwareConsistencyChecker is an optional interface for component managers that can verify firmware version consistency across a set of components.

type ManagerCreationError

type ManagerCreationError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
	Err            error
}

ManagerCreationError includes the configured manager identity and wraps the factory error.

func (ManagerCreationError) Error

func (e ManagerCreationError) Error() string

func (ManagerCreationError) Is

func (e ManagerCreationError) Is(target error) bool

func (ManagerCreationError) Unwrap

func (e ManagerCreationError) Unwrap() error

type ManagerFactory

type ManagerFactory func(providers *providerapi.ProviderRegistry) (ComponentManager, error)

ManagerFactory is a function that creates a ComponentManager instance. It receives a ProviderRegistry from which it can retrieve the providers it needs.

type ManagerNotConfiguredError

type ManagerNotConfiguredError struct {
	ComponentType devicetypes.ComponentType
}

ManagerNotConfiguredError includes the component type that has no active manager.

func (ManagerNotConfiguredError) Error

func (ManagerNotConfiguredError) Is

func (e ManagerNotConfiguredError) Is(target error) bool

type ProviderConfigDecoderNotRegisteredError

type ProviderConfigDecoderNotRegisteredError = cmconfig.ProviderConfigDecoderNotRegisteredError

ProviderConfigDecoderNotRegisteredError includes the provider name with no registered config decoder.

type ProviderConfigNameMismatchError

type ProviderConfigNameMismatchError = providerapi.ProviderConfigNameMismatchError

ProviderConfigNameMismatchError includes the provider config map key and the name returned by the config.

type ProviderConfigTypeMismatchError

type ProviderConfigTypeMismatchError struct {
	Name string
	Got  any
	Want string
}

ProviderConfigTypeMismatchError includes the provider config type and the type expected by the caller.

func (ProviderConfigTypeMismatchError) Error

func (ProviderConfigTypeMismatchError) Is

type ProviderNameMismatchError

type ProviderNameMismatchError = providerapi.ProviderNameMismatchError

ProviderNameMismatchError includes the expected provider name and the name returned by the created provider.

type ProviderNotConfiguredError

type ProviderNotConfiguredError = providerapi.ProviderNotConfiguredError

ProviderNotConfiguredError includes the provider name that is required but not configured.

type ProviderTypeMismatchError

type ProviderTypeMismatchError = providerapi.ProviderTypeMismatchError

ProviderTypeMismatchError includes the provider name with the unexpected concrete type.

type Registry

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

Registry maintains the active component managers selected from a catalog.

func NewRegistry

func NewRegistry(
	catalog Catalog,
	config cmconfig.Config,
	providers *providerapi.ProviderRegistry,
) (*Registry, error)

NewRegistry creates and initializes a Registry from the supplied catalog and component manager configuration.

func (*Registry) FindManager

func (r *Registry) FindManager(
	componentType devicetypes.ComponentType,
) ComponentManager

FindManager returns the active manager for the specified component type. It returns nil when the registry is nil or when no manager is active for the type. Use GetManager when the caller needs a descriptive configuration error.

func (*Registry) GetAllManagers

func (r *Registry) GetAllManagers() []ComponentManager

GetAllManagers returns all active managers.

func (*Registry) GetDescriptor

func (r *Registry) GetDescriptor(
	componentType devicetypes.ComponentType,
) (Descriptor, error)

GetDescriptor returns the descriptor selected for the specified component type.

func (*Registry) GetManager

func (r *Registry) GetManager(
	componentType devicetypes.ComponentType,
) (ComponentManager, error)

GetManager returns the active manager for the specified component type. It returns a descriptive error when the registry is nil or when no manager is active for the type.

type UnknownComponentManagerImplementationError

type UnknownComponentManagerImplementationError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
	Available      []string
	RegisteredFor  []devicetypes.ComponentType
}

UnknownComponentManagerImplementationError includes the implementation name that was requested and the implementations that were available.

func (UnknownComponentManagerImplementationError) Error

func (UnknownComponentManagerImplementationError) Is

type UnknownComponentTypeError

type UnknownComponentTypeError = cmconfig.UnknownComponentTypeError

UnknownComponentTypeError includes the unrecognized component type string.

type UnknownProviderError

type UnknownProviderError = providerapi.UnknownProviderError

UnknownProviderError includes the unknown provider name.

Directories

Path Synopsis
Package builtin registers the component manager extensions compiled into the Flow binary.
Package builtin registers the component manager extensions compiled into the Flow binary.
compute
Package config loads, normalizes, and validates component manager configuration.
Package config loads, normalizes, and validates component manager configuration.
nvlswitch
nvswitchmanager
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
powershelf
psm
Package providerapi contains provider abstractions that must be shared between the componentmanager package and provider implementation packages without creating an import cycle.
Package providerapi contains provider abstractions that must be shared between the componentmanager package and provider implementation packages without creating an import cycle.
providers
nvswitchmanager
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
psm

Jump to

Keyboard shortcuts

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