componentmanager

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package componentmanager defines the manager contracts used to dispatch task operations. Each manager owns its descriptor metadata, which is used by the registry to validate configured implementations and supported capabilities.

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 = cmcatalog.ErrComponentManagerFactoryNotRegistered

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

	// ErrDuplicateDescriptor reports duplicate descriptor metadata for the same
	// component type and implementation.
	ErrDuplicateDescriptor = cmcatalog.ErrDuplicateDescriptor

	// ErrUnknownComponentManagerImplementation reports that the configured
	// implementation name is not registered for a component type.
	ErrUnknownComponentManagerImplementation = cmcatalog.ErrUnknownComponentManagerImplementation

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

	// ErrManagerNotCreated reports that a manager factory returned nil without
	// an error.
	ErrManagerNotCreated = errors.New("component manager was not created")

	// ErrManagerDescriptorMismatch reports that a manager factory returned a
	// manager with different descriptor metadata than its factory spec.
	ErrManagerDescriptorMismatch = errors.New("component manager descriptor mismatch")

	// 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 = cmcatalog.ErrUnknownComponentType

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

	// ErrCapabilityNameEmpty reports that a descriptor declared an empty
	// capability name.
	ErrCapabilityNameEmpty = capability.ErrNameEmpty

	// ErrUnknownCapability reports that a descriptor declared an unsupported
	// capability name.
	ErrUnknownCapability = capability.ErrUnknown

	// ErrUnsupportedCapability reports that the active manager for a component
	// type does not support the requested operation capability.
	ErrUnsupportedCapability = errors.New("component manager capability is not supported")

	// ErrCapabilityInterfaceNotImplemented reports that a manager declares a
	// capability but does not implement the matching operation interface.
	ErrCapabilityInterfaceNotImplemented = errors.New("component manager capability interface is not implemented")

	// 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
}

BringUpController is implemented by component managers that support bring-up control operations.

Required descriptor capability: capability.CapabilityBringUpControl.

type BringUpStatusReader added in v1.6.0

type BringUpStatusReader interface {
	// 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)
}

BringUpStatusReader is implemented by component managers that can report bring-up state.

Required descriptor capability: capability.CapabilityBringUpStatus.

type CapabilityInterfaceNotImplementedError added in v1.6.0

type CapabilityInterfaceNotImplementedError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
	Capability     capability.Capability
}

CapabilityInterfaceNotImplementedError includes the manager and capability whose descriptor metadata does not match the manager's operation interfaces.

func (CapabilityInterfaceNotImplementedError) Error added in v1.6.0

func (CapabilityInterfaceNotImplementedError) Is added in v1.6.0

type CapabilityNameEmptyError added in v1.6.0

type CapabilityNameEmptyError = capability.NameEmptyError

CapabilityNameEmptyError reports an empty capability name in descriptor metadata.

type ComponentManager

type ComponentManager interface {
	// Descriptor returns the component manager metadata for this manager.
	Descriptor() cmcatalog.Descriptor
}

ComponentManager defines the common identity and metadata every component manager must expose. Operation methods live on capability-specific interfaces so managers only implement the operations they support.

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 = cmcatalog.ComponentManagerFactoryNotRegisteredError

ComponentManagerFactoryNotRegisteredError includes the component type that has no registered factories.

type ComponentManagerImplementationNameEmptyError

type ComponentManagerImplementationNameEmptyError = cmcatalog.ComponentManagerImplementationNameEmptyError

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

type DuplicateDescriptorError

type DuplicateDescriptorError = cmcatalog.DuplicateDescriptorError

DuplicateDescriptorError includes the duplicate descriptor identity.

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 ExpectationInjector added in v1.6.0

type ExpectationInjector interface {
	// 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
}

ExpectationInjector is implemented by component managers that support registering expected component configuration.

Required descriptor capability: capability.CapabilityInjectExpectation.

type FactorySpec added in v1.6.0

type FactorySpec struct {
	Descriptor cmcatalog.Descriptor
	Factory    ManagerFactory
}

FactorySpec describes a component manager implementation that can be created at runtime. Descriptor contains selection and validation metadata; Factory creates the manager after config and providers are ready.

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.

Required descriptor capability: capability.CapabilityFirmwareConsistencyCheck.

type FirmwareController added in v1.6.0

type FirmwareController interface {
	// 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
}

FirmwareController is implemented by component managers that support initiating firmware operations.

Required descriptor capability: capability.CapabilityFirmwareControl.

type FirmwareStatusReader added in v1.6.0

type FirmwareStatusReader interface {
	// 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
}

FirmwareStatusReader is implemented by component managers that can report firmware operation state.

Required descriptor capability: capability.CapabilityFirmwareStatus.

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 ManagerDescriptorMismatchError added in v1.6.0

type ManagerDescriptorMismatchError struct {
	Expected cmcatalog.Descriptor
	Actual   cmcatalog.Descriptor
}

ManagerDescriptorMismatchError includes the expected factory spec descriptor and the descriptor reported by the created manager.

func (ManagerDescriptorMismatchError) Error added in v1.6.0

func (ManagerDescriptorMismatchError) Is added in v1.6.0

type ManagerFactory

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

ManagerFactory creates a ComponentManager instance from the provider registry. Implementations retrieve any required providers from the supplied registry.

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 ManagerNotCreatedError added in v1.6.0

type ManagerNotCreatedError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
}

ManagerNotCreatedError includes the descriptor identity whose factory returned no manager.

func (ManagerNotCreatedError) Error added in v1.6.0

func (e ManagerNotCreatedError) Error() string

func (ManagerNotCreatedError) Is added in v1.6.0

func (e ManagerNotCreatedError) Is(target error) bool

type PowerController added in v1.6.0

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

PowerController is implemented by component managers that support power state transitions.

Required descriptor capability: capability.CapabilityPowerControl.

type PowerStatusReader added in v1.6.0

type PowerStatusReader interface {
	// 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
}

PowerStatusReader is implemented by component managers that can report power state.

Required descriptor capability: capability.CapabilityPowerStatus.

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 factory specs.

func NewRegistry

func NewRegistry(
	factorySpecs []FactorySpec,
	config cmconfig.Config,
	providers *providerapi.ProviderRegistry,
) (*Registry, error)

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

func (*Registry) CheckCapability added in v1.6.0

func (r *Registry) CheckCapability(
	componentType devicetypes.ComponentType,
	requiredCapability capability.Capability,
) error

CheckCapability verifies that the active manager for componentType declares requiredCapability.

func (*Registry) ComponentManagers added in v1.6.0

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

ComponentManagers returns all active managers, sorted by component type.

func (*Registry) ComponentTypes added in v1.6.0

func (r *Registry) ComponentTypes() []devicetypes.ComponentType

ComponentTypes returns the component types with active managers, sorted by component type.

func (*Registry) Descriptors added in v1.6.0

func (r *Registry) Descriptors() ([]cmcatalog.Descriptor, error)

Descriptors returns descriptor copies for all active managers, sorted by component type.

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) GetCapableManager added in v1.6.0

func (r *Registry) GetCapableManager(
	componentType devicetypes.ComponentType,
	requiredCapability capability.Capability,
) (ComponentManager, error)

GetCapableManager returns the active manager for componentType after verifying its descriptor declares capability.

func (*Registry) GetDescriptor

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

GetDescriptor returns the descriptor reported by the active manager 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 RequiredProviderNotConfiguredError added in v1.6.0

type RequiredProviderNotConfiguredError = cmconfig.RequiredProviderNotConfiguredError

RequiredProviderNotConfiguredError includes the required provider and the manager identity that requires it.

type UnknownCapabilityError added in v1.6.0

type UnknownCapabilityError = capability.UnknownError

UnknownCapabilityError includes the unsupported capability name.

type UnknownComponentManagerImplementationError

type UnknownComponentManagerImplementationError = cmcatalog.UnknownComponentManagerImplementationError

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

type UnknownComponentTypeError

type UnknownComponentTypeError = cmcatalog.UnknownComponentTypeError

UnknownComponentTypeError includes the unrecognized component type string.

type UnknownProviderError

type UnknownProviderError = providerapi.UnknownProviderError

UnknownProviderError includes the unknown provider name.

type UnsupportedCapabilityError added in v1.6.0

type UnsupportedCapabilityError struct {
	ComponentType  devicetypes.ComponentType
	Implementation string
	Capability     capability.Capability
	Available      capability.CapabilitySet
}

UnsupportedCapabilityError includes the requested capability and the active manager that does not support it.

func (UnsupportedCapabilityError) Error added in v1.6.0

func (UnsupportedCapabilityError) Is added in v1.6.0

func (e UnsupportedCapabilityError) Is(target error) bool

Directories

Path Synopsis
Package builtin wires the component manager extensions compiled into the Flow binary.
Package builtin wires 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.
nvswitch
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