viam.resource.manager
Attributes
Classes
Registry containing all components registered to this server. |
Module Contents
- viam.resource.manager.LOGGER
- viam.resource.manager.ResourceType
- class viam.resource.manager.ResourceManager(components: List[viam.resource.base.ResourceBase] = [])[source]
Registry containing all components registered to this server.
- resources: Dict[viam.proto.common.ResourceName, viam.resource.base.ResourceBase]
- register(resource: viam.resource.base.ResourceBase)[source]
Register a new resource with the registry. Resources may not have the same name. If a resource is remote and the short name is unique, save a short name version.
- Raises:
DuplicateResourceError – Error if attempting to register resource with the name of an existing resource
ResourceNotFoundError – Raised if the subtype of the resource is not registered
- Parameters:
resource (ResourceBase) – The resource to register
- get_resource(of_type: Type[ResourceType], name: viam.proto.common.ResourceName) ResourceType [source]
Return a resource from the registry. If a unique short name version is given, return a remote resource with the name.
- Parameters:
of_type (Type[ResourceType]) – The type of the resource
name (viam.proto.common.ResourceName) – The name of the resource
- Raises:
ResourceNotFoundError – Error if resource with the given type and name does not exist in the registry
- Returns:
The resource
- Return type:
ResourceType
- async remove_resource(name: viam.proto.common.ResourceName)[source]
Remove the resource with the specified
`ResourceName`
.- Parameters:
name (viam.proto.common.ResourceName) – The ResourceName of the resource