Text.ProtocolBuffers.Reflections
Description
A strong feature of the protocol-buffers package is that it does
not contain any structures defined by descriptor.proto! This
prevents me hitting any annoying circular dependencies. The
structures defined here are included in each module created by
hprotoc
. They are optimized for use in code generation.
These values can be inspected at runtime by the user's code, but I have yet to write much documentation. Luckily the record field names are somewhat descriptive.
- data ProtoName = ProtoName {}
- data ProtoInfo = ProtoInfo {
- protoMod :: ProtoName
- protoFilePath :: [FilePath]
- protoSource :: String
- extensionKeys :: Seq KeyInfo
- messages :: [DescriptorInfo]
- enums :: [EnumInfo]
- knownKeyMap :: Map ProtoName (Seq FieldInfo)
- data DescriptorInfo = DescriptorInfo {}
- data FieldInfo = FieldInfo {}
- type KeyInfo = (ProtoName, FieldInfo)
- data HsDefault
- data EnumInfo = EnumInfo {
- enumName :: ProtoName
- enumFilePath :: [FilePath]
- enumValues :: [(EnumCode, String)]
- type EnumInfoApp e = [(EnumCode, String, e)]
- class ReflectDescriptor m where
- getMessageInfo :: m -> GetMessageInfo
- reflectDescriptorInfo :: m -> DescriptorInfo
- class ReflectEnum e where
- reflectEnum :: EnumInfoApp e
- reflectEnumInfo :: e -> EnumInfo
- parentOfEnum :: e -> Maybe DescriptorInfo
- data GetMessageInfo = GetMessageInfo {}
Documentation
This is fully qualified name data type for code generation. The
haskellPrefix
was possibly specified on the hprotoc
command
line. The parentModule
is a combination of the module prefix
from the '.proto' file and any nested levels of definition.
The name components are likely to have been mangled to ensure the
baseName
started with an uppercase letter, in ['A'..'Z']
.
Constructors
ProtoName | |
Fields
|
Constructors
ProtoInfo | |
Fields
|
data DescriptorInfo Source
Constructors
DescriptorInfo | |
Constructors
FieldInfo | |
Fields
|
HsDefault
stores the parsed default from the proto file in a
form that will make a nice literal in the
Language.Haskell.Exts.Syntax code generation by hprotoc
.
Note that Utf8 labeled byte sequences have been stripped to just
ByteString
here as this is sufficient for code generation.
Constructors
EnumInfo | |
Fields
|
type EnumInfoApp e = [(EnumCode, String, e)]Source
class ReflectDescriptor m whereSource
Methods
getMessageInfo :: m -> GetMessageInfoSource
This is obtained via read
on the stored show
output of the DescriptorInfo
in
the module file. It is used in getting messages from the wire.
Must not inspect argument
Arguments
:: m | |
-> DescriptorInfo | Must not inspect argument |
class ReflectEnum e whereSource
Methods
reflectEnum :: EnumInfoApp eSource
Arguments
:: e | |
-> EnumInfo | Must not inspect argument |
Arguments
:: e | |
-> Maybe DescriptorInfo | Must not inspect argument |
data GetMessageInfo Source
GetMessageInfo
is used in getting messages from the wire. It
supplies the Set
of precomposed wire tags that must be found in
the message as well as a Set
of all allowed tags (including known
extension fields and all required wire tags).
Extension fields not in the allowedTags set are still loaded, but
only as ByteString
blobs that will have to interpreted later.
Constructors
GetMessageInfo | |
Fields
|