Documentation ¶
Overview ¶
Package registry operates the global registry of robotic parts.
Index ¶
- func DiscoveryFunctionLookup(q discovery.Query) (discovery.Discover, bool)
- func FindValidServiceModels(rName resource.Name) []string
- func RegisterComponent(subtype resource.Subtype, model string, creator Component)
- func RegisterDiscoveryFunction(q discovery.Query, discover discovery.Discover)
- func RegisterResourceSubtype(subtype resource.Subtype, creator ResourceSubtype)
- func RegisterService(subtype resource.Subtype, model string, creator Service)
- func RegisteredComponents() map[string]Component
- func RegisteredResourceSubtypes() map[resource.Subtype]ResourceSubtype
- func RegisteredServices() map[string]Service
- type Component
- type CreateComponent
- type CreateComponentWithRobot
- type CreateRPCClient
- type CreateReconfigurable
- type CreateService
- type CreateStatus
- type Dependencies
- type DependencyNotReadyError
- type RegDebugInfo
- type RegisterSubtypeRPCService
- type ResourceSubtype
- type Service
- type SubtypeGrpc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoveryFunctionLookup ¶
DiscoveryFunctionLookup finds a discovery function registration for a given query.
func FindValidServiceModels ¶ added in v0.1.0
FindValidServiceModels returns a list of valid models for a specified service.
func RegisterComponent ¶
RegisterComponent register a creator to its corresponding component and model.
func RegisterDiscoveryFunction ¶
RegisterDiscoveryFunction registers a discovery function for a given query.
func RegisterResourceSubtype ¶
func RegisterResourceSubtype(subtype resource.Subtype, creator ResourceSubtype)
RegisterResourceSubtype register a ResourceSubtype to its corresponding component subtype.
func RegisterService ¶
RegisterService registers a service type to a registration.
func RegisteredComponents ¶
RegisteredComponents returns a copy of the registered components.
func RegisteredResourceSubtypes ¶
func RegisteredResourceSubtypes() map[resource.Subtype]ResourceSubtype
RegisteredResourceSubtypes returns a copy of the registered resource subtypes.
func RegisteredServices ¶
RegisteredServices returns a copy of the registered services.
Types ¶
type Component ¶
type Component struct { RegDebugInfo Constructor CreateComponent // TODO(RSDK-418): remove this legacy constructor once all components that use it no longer need to receive the entire robot. RobotConstructor CreateComponentWithRobot }
Component stores a resource constructor (mandatory) and a Frame building function (optional).
type CreateComponent ¶
type CreateComponent func(ctx context.Context, deps Dependencies, config config.Component, logger golog.Logger) (interface{}, error)
A CreateComponent creates a resource from a collection of dependencies and a given config.
type CreateComponentWithRobot ¶
type CreateComponentWithRobot func(ctx context.Context, r robot.Robot, config config.Component, logger golog.Logger) (interface{}, error)
A CreateComponentWithRobot creates a resource from a robot and a given config.
type CreateRPCClient ¶
type CreateRPCClient func(ctx context.Context, conn rpc.ClientConn, name string, logger golog.Logger) interface{}
A CreateRPCClient will create the client for the resource.
type CreateReconfigurable ¶
type CreateReconfigurable func(resource interface{}) (resource.Reconfigurable, error)
A CreateReconfigurable makes a reconfigurable resource from a given resource.
type CreateService ¶
type CreateService func(ctx context.Context, r robot.Robot, config config.Service, logger golog.Logger) (interface{}, error)
A CreateService creates a service from a given config.
type CreateStatus ¶
CreateStatus creates a status from a given resource. The return type is expected to be comprised of string keys (or it should be possible to decompose it into string keys) and values comprised of primitives, list of primitives, maps with string keys (or at least can be decomposed into one), or lists of the aforementioned type of maps. Results with other types of data are not guaranteed.
type Dependencies ¶
Dependencies is a map of resources that a component requires for creation.
type DependencyNotReadyError ¶
type DependencyNotReadyError struct {
Name string
}
A DependencyNotReadyError is used whenever we reference a dependency that has not been constructed and registered yet.
func (*DependencyNotReadyError) Error ¶
func (e *DependencyNotReadyError) Error() string
type RegDebugInfo ¶
type RegDebugInfo struct {
RegistrarLoc string
}
RegDebugInfo represents some runtime information about the registration used for debugging purposes.
type RegisterSubtypeRPCService ¶
type RegisterSubtypeRPCService func(ctx context.Context, rpcServer rpc.Server, subtypeSvc subtype.Service) error
A RegisterSubtypeRPCService will register the subtype service to the grpc server.
type ResourceSubtype ¶
type ResourceSubtype struct { Reconfigurable CreateReconfigurable Status CreateStatus RegisterRPCService RegisterSubtypeRPCService RPCServiceDesc *grpc.ServiceDesc ReflectRPCServiceDesc *desc.ServiceDescriptor `copy:"shallow"` RPCClient CreateRPCClient }
ResourceSubtype stores subtype-specific functions and clients.
func ResourceSubtypeLookup ¶
func ResourceSubtypeLookup(subtype resource.Subtype) *ResourceSubtype
ResourceSubtypeLookup looks up a ResourceSubtype by the given subtype. nil is returned if there is None.
type Service ¶
type Service struct { RegDebugInfo // MaxInstance sets a limit on the number of services allowed on a robot. // If MaxInstance is not set then it will default to 0 and there will be no limit. MaxInstance int Constructor CreateService AttributeMapConverter config.AttributeMapConverter }
Service stores a Service constructor (mandatory) and an attribute converter.
type SubtypeGrpc ¶
type SubtypeGrpc struct{}
SubtypeGrpc stores functions necessary for a resource subtype to be accessible through grpc.