package protoregistry

Import Path
	google.golang.org/protobuf/reflect/protoregistry (on go.dev)

Dependency Relation
	imports 8 packages, and imported by 9 packages

Involved Source Files Package protoregistry provides data structures to register and lookup protobuf descriptor types. The Files registry contains file descriptors and provides the ability to iterate over the files or lookup a specific descriptor within the files. Files only contains protobuf descriptors and has no understanding of Go type information that may be associated with each descriptor. The Types registry contains descriptor types for which there is a known Go type associated with that descriptor. It provides the ability to iterate over the registered types or lookup a type by name.
Package-Level Type Names (total 9, in which 4 are exported)
/* sort exporteds by: | */
ExtensionTypeResolver is an interface for looking up extensions. A compliant implementation must deterministically return the same type if no error is encountered. The Types type implements this interface. ( T) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) ( T) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) *Types
Files is a registry for looking up or iterating over files and the descriptors contained within them. The Find and Range methods are safe for concurrent use. FindDescriptorByName looks up a descriptor by the full name. This returns (nil, NotFound) if not found. FindFileByPath looks up a file by the path. This returns (nil, NotFound) if not found. NumFiles reports the number of registered files. NumFilesByPackage reports the number of registered files in a proto package. RangeFiles iterates over all registered files while f returns true. The iteration order is undefined. RangeFilesByPackage iterates over all registered files in a given proto package while f returns true. The iteration order is undefined. RegisterFile registers the provided file descriptor. If any descriptor within the file conflicts with the descriptor of any previously registered file (e.g., two enums with the same full name), then the file is not registered and an error is returned. It is permitted for multiple files to have the same file path. *T : google.golang.org/protobuf/reflect/protodesc.Resolver func google.golang.org/protobuf/reflect/protodesc.NewFiles(fd *descriptorpb.FileDescriptorSet) (*Files, error) func google.golang.org/protobuf/reflect/protodesc.FileOptions.NewFiles(fds *descriptorpb.FileDescriptorSet) (*Files, error) var GlobalFiles *Files
MessageTypeResolver is an interface for looking up messages. A compliant implementation must deterministically return the same type if no error is encountered. The Types type implements this interface. FindMessageByName looks up a message by its full name. E.g., "google.protobuf.Any" This return (nil, NotFound) if not found. FindMessageByURL looks up a message by a URL identifier. See documentation on google.protobuf.Any.type_url for the URL format. This returns (nil, NotFound) if not found. *Types
Types is a registry for looking up or iterating over descriptor types. The Find and Range methods are safe for concurrent use. FindEnumByName looks up an enum by its full name. E.g., "google.protobuf.Field.Kind". This returns (nil, NotFound) if not found. FindExtensionByName looks up a extension field by the field's full name. Note that this is the full name of the field as determined by where the extension is declared and is unrelated to the full name of the message being extended. This returns (nil, NotFound) if not found. FindExtensionByNumber looks up a extension field by the field number within some parent message, identified by full name. This returns (nil, NotFound) if not found. FindMessageByName looks up a message by its full name, e.g. "google.protobuf.Any". This returns (nil, NotFound) if not found. FindMessageByURL looks up a message by a URL identifier. See documentation on google.protobuf.Any.type_url for the URL format. This returns (nil, NotFound) if not found. NumEnums reports the number of registered enums. NumExtensions reports the number of registered extensions. NumExtensionsByMessage reports the number of registered extensions for a given message type. NumMessages reports the number of registered messages. RangeEnums iterates over all registered enums while f returns true. Iteration order is undefined. RangeExtensions iterates over all registered extensions while f returns true. Iteration order is undefined. RangeExtensionsByMessage iterates over all registered extensions filtered by a given message type while f returns true. Iteration order is undefined. RangeMessages iterates over all registered messages while f returns true. Iteration order is undefined. RegisterEnum registers the provided enum type. If a naming conflict occurs, the type is not registered and an error is returned. RegisterExtension registers the provided extension type. If a naming conflict occurs, the type is not registered and an error is returned. RegisterMessage registers the provided message type. If a naming conflict occurs, the type is not registered and an error is returned. *T : ExtensionTypeResolver *T : MessageTypeResolver var GlobalTypes *Types
Package-Level Functions (total 5, none are exported)
Package-Level Variables (total 6, in which 3 are exported)
GlobalFiles is a global registry of file descriptors.
GlobalTypes is the registry used by default for type lookups unless a local registry is provided by the user.
NotFound is a sentinel error value to indicate that the type was not found. Since registry lookup can happen in the critical performance path, resolvers must return this exact error value, not an error wrapping it.