Documentation
¶
Index ¶
- Variables
- type Catalog
- func (c Catalog) Get(componentType devicetypes.ComponentType, implementation string) (Descriptor, bool)
- func (c Catalog) Implementations(componentType devicetypes.ComponentType) []string
- func (c Catalog) ListImplementations() map[devicetypes.ComponentType][]string
- func (c Catalog) SelectedDescriptors(componentManagers map[devicetypes.ComponentType]string) ([]Descriptor, error)
- type ComponentManagerFactoryNotRegisteredError
- type ComponentManagerImplementationNameEmptyError
- type Descriptor
- type DuplicateDescriptorError
- type UnknownComponentManagerImplementationError
- type UnknownComponentTypeError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownComponentType reports an unrecognized component type. ErrUnknownComponentType = errors.New("unknown component type") // ErrComponentManagerImplementationNameEmpty reports that a component type // was configured without an implementation name. ErrComponentManagerImplementationNameEmpty = errors.New("component manager implementation name is empty") // ErrComponentManagerFactoryNotRegistered reports that no component manager // implementation was registered for a component type. ErrComponentManagerFactoryNotRegistered = errors.New("component manager factory is not registered") // 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") )
Functions ¶
This section is empty.
Types ¶
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 New ¶
func New(descriptors []Descriptor) (Catalog, error)
New 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.
func (Catalog) SelectedDescriptors ¶
func (c Catalog) SelectedDescriptors( componentManagers map[devicetypes.ComponentType]string, ) ([]Descriptor, error)
SelectedDescriptors returns descriptors for the component managers selected by config.
type ComponentManagerFactoryNotRegisteredError ¶
type ComponentManagerFactoryNotRegisteredError struct {
ComponentType devicetypes.ComponentType
}
ComponentManagerFactoryNotRegisteredError includes the component type that has no registered implementations.
func (ComponentManagerFactoryNotRegisteredError) Error ¶
func (e ComponentManagerFactoryNotRegisteredError) Error() string
func (ComponentManagerFactoryNotRegisteredError) Is ¶
func (e ComponentManagerFactoryNotRegisteredError) Is(target error) bool
type ComponentManagerImplementationNameEmptyError ¶
type ComponentManagerImplementationNameEmptyError struct {
// ComponentType is the component type with an empty implementation name.
ComponentType devicetypes.ComponentType
}
ComponentManagerImplementationNameEmptyError includes the component type whose configured implementation name is empty.
func (ComponentManagerImplementationNameEmptyError) Error ¶
func (e ComponentManagerImplementationNameEmptyError) Error() string
func (ComponentManagerImplementationNameEmptyError) Is ¶
func (e ComponentManagerImplementationNameEmptyError) Is(target error) bool
type Descriptor ¶
type Descriptor struct {
Type devicetypes.ComponentType
Implementation string
RequiredProviders []string
Capabilities capability.CapabilitySet
}
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. Capabilities describe the operations this manager supports and are used to validate that active managers can execute a task before it is dispatched.
func (Descriptor) Clone ¶
func (d Descriptor) Clone() Descriptor
Clone returns a descriptor copy whose mutable fields do not share storage with the source descriptor.
func (Descriptor) Equal ¶
func (d Descriptor) Equal(other Descriptor) bool
Equal reports whether two normalized descriptors describe the same component manager implementation, provider requirements, and capabilities.
func (Descriptor) Normalize ¶
func (d Descriptor) Normalize() (Descriptor, error)
Normalize validates a descriptor and returns its normalized value.
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 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 (e UnknownComponentManagerImplementationError) Error() string
func (UnknownComponentManagerImplementationError) Is ¶
func (e UnknownComponentManagerImplementationError) Is(target error) bool
type UnknownComponentTypeError ¶
type UnknownComponentTypeError struct {
// Name is the component type name read from config or descriptor metadata.
Name string
}
UnknownComponentTypeError includes the unrecognized component type string.
func (UnknownComponentTypeError) Error ¶
func (e UnknownComponentTypeError) Error() string
func (UnknownComponentTypeError) Is ¶
func (e UnknownComponentTypeError) Is(target error) bool