Documentation
¶
Overview ¶
Package grpcschema holds a policy's gRPC schema as the engine reads messages with it (design 0013 §5, §6): the compiled form the operator puts in the bundle (bundlev1.GRPCSchema, which pkg/grpcschema/load reads), checked and indexed. The engine never parses descriptors: New checks integers and short strings only, so that a schema that passes can be walked without further checks.
Index ¶
Constants ¶
const ( MaxMethods = 4096 MaxMessages = 16384 MaxFields = 65536 MaxMessageFields = 4096 MaxFieldName = 128 MaxFullName = 512 MaxCompiledBytes = 1 << 20 )
Bounds of a compiled schema (design 0013 §5.4), which the operator's compiler and New both check.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Def ¶
type Def struct {
ID, Source string
// Size is the compiled size in bytes.
Size int
Methods []MethodDef
Messages []MessageDef
}
Def is a compiled schema as plain data (bundlev1.GRPCSchema, which pkg/grpcschema/load reads): what New checks and indexes. The package doesn't import the bundle, so that the reader (pkg/grpcwire) links no protobuf runtime.
type Field ¶
type Field struct {
Number protowire.Number
// Name is the proto name, or "[package.extension]".
Name string
Kind Kind
// Message is the type of a KindMessage or KindGroup field.
Message *Message
// Repeated: a repeated number may come packed.
Repeated bool
// contains filtered or unexported fields
}
Field is a field of a message type.
type FieldDef ¶
FieldDef is a field: Message, for KindMessage and KindGroup only, is an index into Def.Messages.
type Kind ¶
type Kind uint8
Kind is how a field's value is read: the values of bundlev1.GRPCFieldKind.
type Message ¶
type Message struct {
FullName string
// Any: google.protobuf.Any, whose value is read as the type its
// type_url names.
Any bool
// contains filtered or unexported fields
}
Message is a message type.
type MessageDef ¶
MessageDef is a message type.
type MethodDef ¶
MethodDef is a method: its path, and its input and output types, indexes into Def.Messages.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is a loaded schema. It is immutable and safe for concurrent use.
func New ¶
New checks a compiled schema and indexes it. An error means the schema can't be read with: the operator compiles only schemas that pass, so the bundle carrying it is invalid.
func (*Schema) AnyType ¶
AnyType returns the message type an Any's type_url names: the part after its last '/' ("type.googleapis.com/package.Message"), or nil.
func (*Schema) Message ¶
Message returns the message type of a full name ("package.Message"), for an Any's type_url, or nil when the schema doesn't have it.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package compile compiles a FileDescriptorSet into the schema engines read gRPC messages with (design 0013 §5.1, §5.2): the operator runs it on a policy's descriptor set, so that engines never parse descriptors.
|
Package compile compiles a FileDescriptorSet into the schema engines read gRPC messages with (design 0013 §5.1, §5.2): the operator runs it on a policy's descriptor set, so that engines never parse descriptors. |
|
Package grpcschematest builds gRPC schemas for tests, as the operator compiles them and an engine loads them.
|
Package grpcschematest builds gRPC schemas for tests, as the operator compiles them and an engine loads them. |
|
Package load reads a bundle's compiled gRPC schema (bundlev1.GRPCSchema) into a grpcschema.Schema.
|
Package load reads a bundle's compiled gRPC schema (bundlev1.GRPCSchema) into a grpcschema.Schema. |