A descriptor library is an object that contains known definitions. It contains a cache of descriptor objects mapped by definition name, and contains all types of descriptors except for file sets.
If the application provides a definition name that is not in the library, the application can include a descriptor loader that attempts to resolve the missing descriptor.
DescriptorLibrary is provided by the protorpc.descriptor
module.
Functions
DescriptorLibrary provides the following functions:
- lookup_descriptor(definition_name)
-
Gets a descriptor from the library for the given definition name. If the descriptor is not found, attempts to find it using the descriptor loader.
Arguments- definition_name
- The definition name for which to find a descriptor.
Returns a descriptor describing the definition name.
Raises a DefinitionNotFoundError error if no descriptor exists for the given definition name.
- lookup_package(definition_name)
-
Determines the package name that any definition name belongs to. May check the parent for the package name. Attempts to resolve missing descriptors if provided a descriptor loader.
Arguments- definition_name
- The definition name for which to find a package.
Returns a descriptor object describing the package name.